diff --git a/changelog.md b/changelog.md index 30e7ac6..10d2bf4 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,7 @@ These changes will (most likely) be included in the next version. ### Added - Support for chest references in item syntax. The new `inv` syntax allows for referencing container indices in the config-file. This should help bridge the gap between class chests and various other parts of the config-file, such as rewards and upgrade waves. - Support for saved items. The new `/ma save-item` command can be used to save the currently held item to disk, which allows it to be used in various places in the config-file. This should help bridge the gap between the config-file and class chests for config-file centric setups. +- New per-arena setting `monster-teleporting` allows monsters to teleport _inside_ the arena region. This should allow for stuff like `/tp` commands and for Endermen to "do their thing". - New permission `mobarena.admin.errors` for better error visibility. Players with this permission will get a message if an arena encounters an error. Currently, the only such error is the one resulting from Spigot's "max max health" setting throwing an exception when monster health is set "too high". ### Fixed diff --git a/src/main/java/com/garbagemule/MobArena/ArenaListener.java b/src/main/java/com/garbagemule/MobArena/ArenaListener.java index 431808d..93cf389 100644 --- a/src/main/java/com/garbagemule/MobArena/ArenaListener.java +++ b/src/main/java/com/garbagemule/MobArena/ArenaListener.java @@ -121,6 +121,7 @@ public class ArenaListener private boolean lockFoodLevel; private boolean useClassChests; private boolean allowTeleport; + private boolean monsterTeleport; private boolean canShare; private boolean autoIgniteTNT; private int autoIgniteFuse; @@ -145,6 +146,7 @@ public class ArenaListener this.foodRegen = s.getBoolean("food-regen", false); this.lockFoodLevel = s.getBoolean("lock-food-level", true); this.allowTeleport = s.getBoolean("allow-teleporting", false); + this.monsterTeleport = s.getBoolean("monster-teleporting", false); this.canShare = s.getBoolean("share-items-in-arena", true); this.autoIgniteTNT = s.getBoolean("auto-ignite-tnt", false); this.autoIgniteFuse = s.getInt("auto-ignite-fuse", 80); @@ -893,6 +895,14 @@ public class ArenaListener if (monsters.hasPet(event.getEntity()) && region.contains(event.getTo())) { return; } + + if (isArenaMonster(event.getEntity())) { + if (!monsterTeleport || !region.contains(event.getTo())) { + event.setCancelled(true); + } + return; + } + if (region.contains(event.getFrom()) || region.contains(event.getTo())) { event.setCancelled(true); }