add message saying claimblocks amount when switching to tool or making/resizing claims

This commit is contained in:
Flemmli97 2020-11-06 20:08:56 +01:00
parent 996a78a73c
commit 240d009e1b
2 changed files with 11 additions and 1 deletions

View File

@ -84,6 +84,8 @@ public class ClaimStorage {
this.addClaim(claim);
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY());
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.claimCreateSuccess, Formatting.GOLD), false);
player.sendMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
data.getClaimBlocks(), data.getAdditionalClaims(), data.usedClaimBlocks()), Formatting.GOLD), false);
return true;
}
PlayerClaimData data = PlayerClaimData.get(player);
@ -158,6 +160,8 @@ public class ClaimStorage {
this.addClaim(claim);
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY());
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.resizeSuccess, Formatting.GOLD), false);
player.sendMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
data.getClaimBlocks(), data.getAdditionalClaims(), data.usedClaimBlocks()), Formatting.GOLD), false);
return true;
}
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.notEnoughBlocks, Formatting.RED), false);

View File

@ -47,7 +47,7 @@ public class PlayerClaimData {
private final ServerPlayerEntity player;
private boolean confirmDeleteAll, adminIgnoreClaim;
private boolean confirmDeleteAll, adminIgnoreClaim, claimBlockMessage;
private boolean dirty;
public PlayerClaimData(ServerPlayerEntity player) {
@ -200,6 +200,12 @@ public class PlayerClaimData {
if (this.player.getMainHandStack().getItem() != ConfigHandler.config.claimingItem && this.player.getOffHandStack().getItem() != ConfigHandler.config.claimingItem) {
this.setEditingCorner(null);
this.setEditClaim(null, 0);
this.claimBlockMessage = false;
}
else if(!this.claimBlockMessage){
this.claimBlockMessage = true;
this.player.sendMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
this.getClaimBlocks(), this.getAdditionalClaims(), this.usedClaimBlocks()), Formatting.GOLD), false);
}
this.actionCooldown--;
}