dont tick down display when the claiming tools are held

This commit is contained in:
Flemmli97 2020-11-28 20:50:52 +01:00
parent 27f39ea48e
commit 685bafc755
2 changed files with 7 additions and 10 deletions

View File

@ -55,10 +55,8 @@ public class ClaimDisplay {
}
}
public boolean display(ServerPlayerEntity player, boolean tick) {
if(tick)
--this.displayTime;
if (this.displayTime % 2 == 0)
public boolean display(ServerPlayerEntity player, boolean remove) {
if (--this.displayTime % 2 == 0)
return this.toDisplay.isRemoved();
int[] dims = this.toDisplay.getDimensions();
if (this.poss == null || this.changed(dims)) {
@ -82,7 +80,7 @@ public class ClaimDisplay {
player.networkHandler.sendPacket(new ParticleS2CPacket(this.middle, true, pos[0] + 0.5, pos[1] + 0.25, pos[3] + 0.5, 0, 0.5f, 0, 0, 1));
}
this.prevDims = dims;
return this.toDisplay.isRemoved() || this.displayTime < 0;
return this.toDisplay.isRemoved() || (remove && this.displayTime < 0);
}
private boolean changed(int[] dims) {

View File

@ -86,7 +86,7 @@ public class PlayerClaimData {
}
public boolean canUseClaimBlocks(int amount) {
if(ConfigHandler.config.maxClaimBlocks==-1)
if (ConfigHandler.config.maxClaimBlocks == -1)
return true;
int usedClaimsBlocks = this.usedClaimBlocks();
return usedClaimsBlocks + amount <= this.claimBlocks + this.additionalClaimBlocks;
@ -122,7 +122,7 @@ public class PlayerClaimData {
}
public void addDisplayClaim(IPermissionContainer cont, EnumDisplayType type, int height) {
if(cont instanceof Claim) {
if (cont instanceof Claim) {
Claim claim = (Claim) cont;
this.displayToAdd.add(new ClaimDisplay(claim, type, height));
if (type == EnumDisplayType.MAIN)
@ -180,7 +180,7 @@ public class PlayerClaimData {
|| this.player.getOffHandStack().getItem() == ConfigHandler.config.claimingItem;
boolean stick = this.player.getMainHandStack().getItem() == ConfigHandler.config.inspectionItem
|| this.player.getOffHandStack().getItem() == ConfigHandler.config.inspectionItem;
this.displayToAdd.forEach(add -> {
this.displayToAdd.forEach(add -> {
if (!this.claimDisplayList.add(add)) {
this.claimDisplayList.removeIf(c -> c.equals(add) && c.type != add.type);
this.claimDisplayList.add(add);
@ -205,8 +205,7 @@ public class PlayerClaimData {
this.setEditingCorner(null);
this.setEditClaim(null, 0);
this.claimBlockMessage = false;
}
else if(!this.claimBlockMessage){
} 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);