add cooldown to inspection to prevent double processing
This commit is contained in:
parent
843feb73e5
commit
01ae24f8ef
@ -207,6 +207,10 @@ public class ItemInteractEvents {
|
|||||||
|
|
||||||
public static void inspect(ServerPlayerEntity player, BlockPos target) {
|
public static void inspect(ServerPlayerEntity player, BlockPos target) {
|
||||||
Claim claim = ClaimStorage.get(player.getServerWorld()).getClaimAt(target);
|
Claim claim = ClaimStorage.get(player.getServerWorld()).getClaimAt(target);
|
||||||
|
PlayerClaimData data = PlayerClaimData.get(player);
|
||||||
|
if (data.claimCooldown())
|
||||||
|
return;
|
||||||
|
data.setClaimActionCooldown();
|
||||||
if (claim != null) {
|
if (claim != null) {
|
||||||
String owner = claim.isAdminClaim() ? "<Admin>" : "<UNKOWN>";
|
String owner = claim.isAdminClaim() ? "<Admin>" : "<UNKOWN>";
|
||||||
if (!claim.isAdminClaim()) {
|
if (!claim.isAdminClaim()) {
|
||||||
@ -218,7 +222,7 @@ public class ItemInteractEvents {
|
|||||||
owner,
|
owner,
|
||||||
target.getX(), target.getY(), target.getZ()), Formatting.GREEN);
|
target.getX(), target.getY(), target.getZ()), Formatting.GREEN);
|
||||||
player.sendMessage(text, false);
|
player.sendMessage(text, false);
|
||||||
PlayerClaimData.get(player).addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY());
|
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY());
|
||||||
} else
|
} else
|
||||||
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.inspectNoClaim, Formatting.RED), false);
|
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.inspectNoClaim, Formatting.RED), false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user