From 2c2340f056186df6ff41cf6be21704c0412348f1 Mon Sep 17 00:00:00 2001 From: Nick D Date: Sat, 16 Nov 2013 14:52:06 +1030 Subject: [PATCH] Option to deny enderpearl completely, Prevents 'glitching' into places. --- src/main/java/com/wimbli/WorldBorder/Config.java | 7 +++++++ src/main/java/com/wimbli/WorldBorder/WBListener.java | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/com/wimbli/WorldBorder/Config.java b/src/main/java/com/wimbli/WorldBorder/Config.java index a2dff6e..9d6b71b 100644 --- a/src/main/java/com/wimbli/WorldBorder/Config.java +++ b/src/main/java/com/wimbli/WorldBorder/Config.java @@ -48,6 +48,7 @@ public class Config private static String dynmapMessage; private static int remountDelayTicks = 0; private static boolean killPlayer = false; + private static boolean denyEnderpearl = false; // for monitoring plugin efficiency // public static long timeUsed = 0; @@ -237,6 +238,10 @@ public class Config public static boolean getIfPlayerKill(){ return killPlayer; } + public static boolean getDenyEnderpearl() + { + return denyEnderpearl; + } public static void showWhooshEffect(Location loc) { if (!whooshEffect()) @@ -496,6 +501,7 @@ public class Config dynmapMessage = cfg.getString("dynmap-border-message", "The border of the world."); LogConfig("Using " + (ShapeName()) + " border, knockback of " + knockBack + " blocks, and timer delay of " + timerTicks + "."); killPlayer = cfg.getBoolean("player-killed-bad-spawn", false); + denyEnderpearl = cfg.getBoolean("deny-enderpearl", false); StartBorderTimer(); @@ -590,6 +596,7 @@ public class Config cfg.set("dynmap-border-enabled", dynmapEnable); cfg.set("dynmap-border-message", dynmapMessage); cfg.set("player-killed-bad-spawn", killPlayer); + cfg.set("deny-enderpearl", denyEnderpearl); cfg.set("worlds", null); Iterator world = borders.entrySet().iterator(); diff --git a/src/main/java/com/wimbli/WorldBorder/WBListener.java b/src/main/java/com/wimbli/WorldBorder/WBListener.java index 4f48564..1f11346 100644 --- a/src/main/java/com/wimbli/WorldBorder/WBListener.java +++ b/src/main/java/com/wimbli/WorldBorder/WBListener.java @@ -22,6 +22,12 @@ public class WBListener implements Listener if (Config.Debug()) Config.Log("Teleport cause: "+event.getCause().toString()); + if(event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL && Config.getDenyEnderpearl()) { + event.getPlayer().sendMessage(Config.Message()); + event.setCancelled(true); + return; + } + Location newLoc = BorderCheckTask.checkPlayer(event.getPlayer(), event.getTo(), true, true); if (newLoc != null) event.setTo(newLoc);