补充盔甲架放置控制权限

This commit is contained in:
zhangyuheng 2024-08-26 14:42:05 +08:00
parent 7157a27fa9
commit fbb0b4a2f9
3 changed files with 33 additions and 1 deletions

View File

@ -4,7 +4,7 @@ plugins {
}
group = "cn.lunadeer"
version = "2.3.4-beta"
version = "2.3.5-beta"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))

View File

@ -685,6 +685,22 @@ public class PlayerEvents implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.HIGHEST) // place - armor stand
public void placeArmorStand(EntityPlaceEvent event) {
Player player = event.getPlayer();
if (player == null) {
return;
}
Entity entity = event.getEntity();
if (!(entity instanceof ArmorStand)) {
return;
}
if (onPlace(player, entity.getLocation())) {
return;
}
event.setCancelled(true);
}
public static boolean onPlace(Player player, Location location) {
DominionDTO dom = Cache.instance.getDominionByLoc(location);
return checkFlag(dom, Flag.PLACE, player, null);

View File

@ -681,6 +681,22 @@ public class PlayerEvents implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.HIGHEST) // place - armor stand
public void placeArmorStand(EntityPlaceEvent event) {
Player player = event.getPlayer();
if (player == null) {
return;
}
Entity entity = event.getEntity();
if (!(entity instanceof ArmorStand)) {
return;
}
if (onPlace(player, entity.getLocation())) {
return;
}
event.setCancelled(true);
}
public static boolean onPlace(Player player, Location location) {
DominionDTO dom = Cache.instance.getDominionByLoc(location);
return checkFlag(dom, Flag.PLACE, player, null);