diff --git a/src/com/wimbli/WorldBorder/Config.java b/src/com/wimbli/WorldBorder/Config.java index 42432fd..28e900a 100644 --- a/src/com/wimbli/WorldBorder/Config.java +++ b/src/com/wimbli/WorldBorder/Config.java @@ -38,6 +38,7 @@ public class Config private static double knockBack = 3.0; private static int timerTicks = 4; private static boolean whooshEffect = false; + private static boolean portalRedirection = true; private static boolean dynmapEnable = true; private static String dynmapMessage; @@ -195,7 +196,7 @@ public class Config public static void setWhooshEffect(boolean enable) { whooshEffect = enable; - Log("\"Whoosh\" knockback effect " + (whooshEffect ? "enabled" : "disabled") + "."); + Log("\"Whoosh\" knockback effect " + (enable ? "enabled" : "disabled") + "."); save(true); } @@ -204,6 +205,18 @@ public class Config return whooshEffect; } + public static void setPortalRedirection(boolean enable) + { + portalRedirection = enable; + Log("Portal redirection " + (enable ? "enabled" : "disabled") + "."); + save(true); + } + + public static boolean portalRedirection() + { + return portalRedirection; + } + public static void setKnockBack(double numBlocks) { knockBack = numBlocks; @@ -396,6 +409,7 @@ public class Config shapeRound = cfg.getBoolean("round-border", true); DEBUG = cfg.getBoolean("debug-mode", false); whooshEffect = cfg.getBoolean("whoosh-effect", false); + portalRedirection = cfg.getBoolean("portal-redirection", true); knockBack = cfg.getDouble("knock-back-dist", 3.0); timerTicks = cfg.getInt("timer-delay-ticks", 5); dynmapEnable = cfg.getBoolean("dynmap-border-enabled", true); @@ -479,6 +493,7 @@ public class Config cfg.set("round-border", shapeRound); cfg.set("debug-mode", DEBUG); cfg.set("whoosh-effect", whooshEffect); + cfg.set("portal-redirection", portalRedirection); cfg.set("knock-back-dist", knockBack); cfg.set("timer-delay-ticks", timerTicks); cfg.set("dynmap-border-enabled", dynmapEnable); diff --git a/src/com/wimbli/WorldBorder/WBCommand.java b/src/com/wimbli/WorldBorder/WBCommand.java index 8689100..dd58d29 100644 --- a/src/com/wimbli/WorldBorder/WBCommand.java +++ b/src/com/wimbli/WorldBorder/WBCommand.java @@ -404,10 +404,10 @@ public class WBCommand implements CommandExecutor Config.setWhooshEffect(strAsBool(split[1])); if (player != null) + { Config.Log((Config.whooshEffect() ? "Enabling" : "Disabling") + " \"whoosh\" knockback effect at the command of player \"" + player.getName() + "\"."); - - if (player != null) sender.sendMessage("\"Whoosh\" knockback effect " + enabledColored(Config.whooshEffect()) + "."); + } } // "knockback" command from player or console @@ -557,6 +557,20 @@ public class WBCommand implements CommandExecutor sender.sendMessage("Border for world \"" + world + "\" is now set to " + (wrap ? "" : "not ") + "wrap around."); } + // "portal" command from player or console + else if (split.length == 2 && split[0].equalsIgnoreCase("portal")) + { + if (!Config.HasPermission(player, "portal")) return true; + + Config.setPortalRedirection(strAsBool(split[1])); + + if (player != null) + { + Config.Log((Config.portalRedirection() ? "Enabling" : "Disabling") + " portal redirection at the command of player \"" + player.getName() + "\"."); + sender.sendMessage("Portal redirection " + enabledColored(Config.portalRedirection()) + "."); + } + } + // "fill" command from player or console, world specified else if (split.length >= 2 && split[1].equalsIgnoreCase("fill")) { @@ -787,6 +801,7 @@ public class WBCommand implements CommandExecutor if (page == 0 || page == 3) { sender.sendMessage(cmd+" whoosh " + clrReq + "" + clrDesc + " - turn knockback effect on or off."); + sender.sendMessage(cmd+" portal " + clrReq + "" + clrDesc + " - turn portal redirection on or off."); sender.sendMessage(cmd+" getmsg" + clrDesc + " - display border message."); sender.sendMessage(cmd+" setmsg " + clrReq + "" + clrDesc + " - set border message."); sender.sendMessage(cmd+" knockback " + clrReq + "" + clrDesc + " - how far to move the player back."); diff --git a/src/com/wimbli/WorldBorder/WBListener.java b/src/com/wimbli/WorldBorder/WBListener.java index e785e69..702fddf 100644 --- a/src/com/wimbli/WorldBorder/WBListener.java +++ b/src/com/wimbli/WorldBorder/WBListener.java @@ -26,8 +26,8 @@ public class WBListener implements Listener @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerPortal(PlayerPortalEvent event) { - // if knockback is set to 0, simply return - if (Config.KnockBack() == 0.0) + // if knockback is set to 0, or portal redirection is disabled, simply return + if (Config.KnockBack() == 0.0 || !Config.portalRedirection()) return; Location newLoc = BorderCheckTask.checkPlayer(event.getPlayer(), event.getTo(), true, false); diff --git a/src/plugin.yml b/src/plugin.yml index eb7f6e5..8441320 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -24,6 +24,7 @@ commands: / setmsg - set border message. / knockback - how far to move the player back. / whoosh - turn knockback effect on or off. + / portal - turn portal redirection on or off. / delay - time between border checks. / wshape [world] - override shape. / wshape [world] - same as above values. @@ -58,6 +59,7 @@ permissions: worldborder.dynmapmsg: true worldborder.bypass: true worldborder.wrap: true + worldborder.portal: true worldborder.set: description: Can set borders for any world default: op @@ -109,6 +111,9 @@ permissions: worldborder.whoosh: description: Can enable/disable "whoosh" knockback effect default: op + worldborder.portal: + description: Can enable/disable portal redirection to be inside border + default: op worldborder.dynmap: description: Can enable/disable DynMap border display integration default: op