diff --git a/build.gradle.kts b/build.gradle.kts index dc488d66..a595a856 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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)) diff --git a/v1_20_1/src/main/java/cn/lunadeer/dominion/events_v1_20_1/PlayerEvents.java b/v1_20_1/src/main/java/cn/lunadeer/dominion/events_v1_20_1/PlayerEvents.java index cd6e7273..2150ec23 100644 --- a/v1_20_1/src/main/java/cn/lunadeer/dominion/events_v1_20_1/PlayerEvents.java +++ b/v1_20_1/src/main/java/cn/lunadeer/dominion/events_v1_20_1/PlayerEvents.java @@ -685,6 +685,22 @@ public void placeItemFrame(HangingPlaceEvent event) { 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); diff --git a/v1_21/src/main/java/cn/lunadeer/dominion/events_v1_21/PlayerEvents.java b/v1_21/src/main/java/cn/lunadeer/dominion/events_v1_21/PlayerEvents.java index d9ee4195..7c8ec7e2 100644 --- a/v1_21/src/main/java/cn/lunadeer/dominion/events_v1_21/PlayerEvents.java +++ b/v1_21/src/main/java/cn/lunadeer/dominion/events_v1_21/PlayerEvents.java @@ -681,6 +681,22 @@ public void placeItemFrame(HangingPlaceEvent event) { 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);