mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2025-01-12 09:14:26 +08:00
补充盔甲架放置控制权限
This commit is contained in:
parent
7157a27fa9
commit
fbb0b4a2f9
@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "cn.lunadeer"
|
group = "cn.lunadeer"
|
||||||
version = "2.3.4-beta"
|
version = "2.3.5-beta"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
|
@ -685,6 +685,22 @@ public class PlayerEvents implements Listener {
|
|||||||
event.setCancelled(true);
|
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) {
|
public static boolean onPlace(Player player, Location location) {
|
||||||
DominionDTO dom = Cache.instance.getDominionByLoc(location);
|
DominionDTO dom = Cache.instance.getDominionByLoc(location);
|
||||||
return checkFlag(dom, Flag.PLACE, player, null);
|
return checkFlag(dom, Flag.PLACE, player, null);
|
||||||
|
@ -681,6 +681,22 @@ public class PlayerEvents implements Listener {
|
|||||||
event.setCancelled(true);
|
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) {
|
public static boolean onPlace(Player player, Location location) {
|
||||||
DominionDTO dom = Cache.instance.getDominionByLoc(location);
|
DominionDTO dom = Cache.instance.getDominionByLoc(location);
|
||||||
return checkFlag(dom, Flag.PLACE, player, null);
|
return checkFlag(dom, Flag.PLACE, player, null);
|
||||||
|
Loading…
Reference in New Issue
Block a user