diff --git a/changelog.md b/changelog.md index 29e28bc..f382c43 100644 --- a/changelog.md +++ b/changelog.md @@ -37,6 +37,7 @@ These changes will (most likely) be included in the next version. - Flaming arrows now ignite TNT blocks in the arena. - Players no longer take fall damage when they leave (or get removed from) an arena while falling. - Players no longer take damage from projectiles shot by pets of other players. +- MobArena no longer nags players with the `mobarena.admin.teleport` permission when they engage in a teleport that would have otherwise been blocked. ## [0.106] - 2021-05-09 ### Added diff --git a/src/main/java/com/garbagemule/MobArena/ArenaListener.java b/src/main/java/com/garbagemule/MobArena/ArenaListener.java index bc70b9a..0c65809 100644 --- a/src/main/java/com/garbagemule/MobArena/ArenaListener.java +++ b/src/main/java/com/garbagemule/MobArena/ArenaListener.java @@ -1291,23 +1291,20 @@ public class ArenaListener if (region.contains(to)) { // Inside -> inside if (!(arena.inArena(p) || arena.inLobby(p))) { - arena.getMessenger().tell(p, Msg.WARP_TO_ARENA); - return TeleportResponse.REJECT; + return reject(p, Msg.WARP_TO_ARENA); } return TeleportResponse.ALLOW; } else { // Inside -> outside if (arena.getAllPlayers().contains(p)) { - arena.getMessenger().tell(p, Msg.WARP_FROM_ARENA); - return TeleportResponse.REJECT; + return reject(p, Msg.WARP_FROM_ARENA); } return TeleportResponse.IDGAF; } } else { if (region.contains(to)) { // Outside -> inside - arena.getMessenger().tell(p, Msg.WARP_TO_ARENA); - return TeleportResponse.REJECT; + return reject(p, Msg.WARP_TO_ARENA); } else { // Outside -> outside return TeleportResponse.IDGAF; @@ -1315,6 +1312,15 @@ public class ArenaListener } } + private TeleportResponse reject(Player p, Msg message) { + if (p.hasPermission("mobarena.admin.teleport")) { + return TeleportResponse.IDGAF; + } + + arena.getMessenger().tell(p, message); + return TeleportResponse.REJECT; + } + public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { Player p = event.getPlayer(); diff --git a/src/main/java/com/garbagemule/MobArena/listeners/MAGlobalListener.java b/src/main/java/com/garbagemule/MobArena/listeners/MAGlobalListener.java index 9d023f5..2e486a1 100644 --- a/src/main/java/com/garbagemule/MobArena/listeners/MAGlobalListener.java +++ b/src/main/java/com/garbagemule/MobArena/listeners/MAGlobalListener.java @@ -369,10 +369,9 @@ public class MAGlobalListener implements Listener /* * If we reach this point, no arena has specifically allowed the * teleport, but one or more arenas may have rejected it, so we - * may have to cancel the event. If the player has the teleport - * override permission, however, we don't cancel. + * may have to cancel the event. */ - if (!allow && !event.getPlayer().hasPermission("mobarena.admin.teleport")) { + if (!allow) { event.setCancelled(true); } }