Skip to content

Commit

Permalink
补充盔甲架放置控制权限
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdeZhang committed Aug 26, 2024
1 parent 7157a27 commit fbb0b4a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fbb0b4a

Please sign in to comment.