修复没有权限仍然能通过床设置重生点的权限漏洞

This commit is contained in:
zhangyuheng 2024-06-25 09:43:20 +08:00
parent e33be83b07
commit 26bc618b93

View File

@ -103,9 +103,32 @@ public class PlayerEvents implements Listener {
}
@EventHandler(priority = EventPriority.HIGHEST) // bed
public void onBedUse(PlayerBedEnterEvent event) {
public void onBedUse(PlayerInteractEvent event) {
Player bukkitPlayer = event.getPlayer();
DominionDTO dom = Cache.instance.getDominion(event.getBed().getLocation());
Block block = event.getClickedBlock();
if (block == null) {
return;
}
Material clicked = block.getType();
if (clicked != Material.RED_BED &&
clicked != Material.ORANGE_BED &&
clicked != Material.YELLOW_BED &&
clicked != Material.LIME_BED &&
clicked != Material.GREEN_BED &&
clicked != Material.LIGHT_BLUE_BED &&
clicked != Material.CYAN_BED &&
clicked != Material.BLUE_BED &&
clicked != Material.PURPLE_BED &&
clicked != Material.MAGENTA_BED &&
clicked != Material.PINK_BED &&
clicked != Material.WHITE_BED &&
clicked != Material.LIGHT_GRAY_BED &&
clicked != Material.GRAY_BED &&
clicked != Material.BLACK_BED &&
clicked != Material.BROWN_BED) {
return;
}
DominionDTO dom = Cache.instance.getDominion(block.getLocation());
checkFlag(dom, Flag.BED, bukkitPlayer, event);
}