fix(review): check event.getKeepInventory(), equipment slot hand, and world height bounds
This commit is contained in:
@@ -934,7 +934,7 @@ public final class Canalhandia extends JavaPlugin implements Listener {
|
||||
Location loc = player.getLocation();
|
||||
String coords = loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ()
|
||||
+ " (" + loc.getWorld().getName() + ")";
|
||||
boolean keepInventory = Boolean.TRUE.equals(
|
||||
boolean keepInventory = event.getKeepInventory() || Boolean.TRUE.equals(
|
||||
loc.getWorld().getGameRuleValue(GameRule.KEEP_INVENTORY));
|
||||
pendingDeathCoords.put(player.getUniqueId(), new DeathCoords(coords, keepInventory));
|
||||
|
||||
|
||||
@@ -149,6 +149,9 @@ final class ChunkLoaderListener implements Listener {
|
||||
if (!plugin.settings().moduleEnabled(Module.CHUNKLOADER)) {
|
||||
return;
|
||||
}
|
||||
if (event.getHand() != org.bukkit.inventory.EquipmentSlot.HAND) {
|
||||
return;
|
||||
}
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -77,12 +77,19 @@ public final class VoidProtection {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (topY <= minHeight) {
|
||||
int maxHeight = world.getMaxHeight();
|
||||
if (topY <= minHeight || topY >= maxHeight - 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block ground = world.getBlockAt(x, topY, z);
|
||||
Block space = world.getBlockAt(x, topY + 1, z);
|
||||
Block ground;
|
||||
Block space;
|
||||
try {
|
||||
ground = world.getBlockAt(x, topY, z);
|
||||
space = world.getBlockAt(x, topY + 1, z);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isSafeGround(ground) && isReplaceable(space)) {
|
||||
double distSq = (dx * dx) + (dz * dz);
|
||||
|
||||
Reference in New Issue
Block a user