Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PlaceholderManager.java #42

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.craftaro.ultimateclaims.placeholder;

import com.craftaro.core.utils.PlayerUtils;
import com.craftaro.ultimateclaims.UltimateClaims;
import com.craftaro.ultimateclaims.claim.Claim;
import com.craftaro.ultimateclaims.member.ClaimMember;
import com.craftaro.ultimateclaims.settings.Settings;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand All @@ -32,7 +35,7 @@ public String onRequest(OfflinePlayer player, String params) {
return claims.isEmpty() ? "0" : claims.stream().map(Claim::getPowercellTimeRemaining).collect(Collectors.joining(", "));
case "totalchunks": {
if (!player.isOnline()) return "0/0";
return claims.isEmpty() ? "0/0" : claims.stream().mapToInt(Claim::getClaimSize).sum() + "/" + claims.stream().mapToInt(c -> c.getMaxClaimSize(player.getPlayer())).sum();
return claims.isEmpty() ? "0/" + PlayerUtils.getNumberFromPermission((Player) player, "ultimateclaims.maxclaims", Settings.MAX_CHUNKS.getInt()) + "/" + claims.stream().mapToInt(c -> c.getMaxClaimSize(player.getPlayer())).sum();
}
case "owner":
return claims.isEmpty() ? this.plugin.getLocale().getMessage("general.word.none").getMessage() : claims.stream().map(c -> c.getOwner().getName()).collect(Collectors.joining(", "));
Expand Down
Loading