修复在领地外仍然能触发按钮的权限漏洞

This commit is contained in:
zhangyuheng 2024-06-25 09:31:48 +08:00
parent a090ea7bf1
commit e33be83b07

View File

@ -160,7 +160,8 @@ public class PlayerEvents implements Listener {
if (event.getClickedBlock() == null) {
return;
}
Material clicked = event.getClickedBlock().getType();
Block block = event.getClickedBlock();
Material clicked = block.getType();
if (clicked != Material.STONE_BUTTON &&
clicked != Material.BAMBOO_BUTTON &&
clicked != Material.OAK_BUTTON &&
@ -176,7 +177,7 @@ public class PlayerEvents implements Listener {
clicked != Material.CHERRY_BUTTON) {
return;
}
DominionDTO dom = Cache.instance.getPlayerCurrentDominion(player);
DominionDTO dom = Cache.instance.getDominion(block.getLocation());
checkFlag(dom, Flag.BUTTON, player, event);
}