Option to deny enderpearl completely,

Prevents 'glitching' into places.
This commit is contained in:
Nick D 2013-11-16 14:52:06 +10:30
parent 9f45cef34f
commit 2c2340f056
2 changed files with 13 additions and 0 deletions

View File

@ -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();

View File

@ -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);