fix wrong function call

This commit is contained in:
Flemmli97 2021-06-13 02:07:30 +02:00
parent 384e511cf4
commit 00fe6f554e
2 changed files with 8 additions and 12 deletions

View File

@ -414,7 +414,7 @@ public class CommandClaim {
} else {
OfflinePlayerData data = new OfflinePlayerData(server, of);
context.getSource().sendFeedback(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
data.claimBlocks, data.additionalClaimBlocks, data.getUsedClaimBlocks()), Formatting.GOLD), false);
data.claimBlocks, data.additionalClaimBlocks, data.usedClaimBlocks()), Formatting.GOLD), false);
}
}
context.getSource().sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.listClaims, Formatting.GOLD), false);

View File

@ -45,16 +45,6 @@ public class OfflinePlayerData implements IPlayerData {
this.server = server;
}
public int getUsedClaimBlocks() {
int usedClaimsBlocks = 0;
for (ServerWorld world : this.server.getWorlds()) {
Collection<Claim> claims = ClaimStorage.get(world).allClaimsFromPlayer(this.owner);
if (claims != null)
usedClaimsBlocks += claims.stream().filter(claim -> !claim.isAdminClaim()).mapToInt(Claim::getPlane).sum();
}
return usedClaimsBlocks;
}
@Override
public int getClaimBlocks() {
return this.claimBlocks;
@ -67,6 +57,12 @@ public class OfflinePlayerData implements IPlayerData {
@Override
public int usedClaimBlocks() {
return this.usedClaimBlocks();
int usedClaimsBlocks = 0;
for (ServerWorld world : this.server.getWorlds()) {
Collection<Claim> claims = ClaimStorage.get(world).allClaimsFromPlayer(this.owner);
if (claims != null)
usedClaimsBlocks += claims.stream().filter(claim -> !claim.isAdminClaim()).mapToInt(Claim::getPlane).sum();
}
return usedClaimsBlocks;
}
}