New command /wb portal <on/off>, which will allow you to disable WorldBorder's portal redirection method that is used to force portal targets to be inside your border. Requires new permission "worldborder.portal". This command has been added due to reported incompatibility with the Multiverse plugin somehow preventing that plugin from creating new portals. I see no way it should somehow be incompatible, particularly on WorldBorder's end which simply changes the target location of player Portal travel events, but there you go.

This commit is contained in:
Brettflan 2013-04-14 05:18:07 -05:00
parent c83b49090b
commit 7757a506d0
4 changed files with 40 additions and 5 deletions

View File

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

View File

@ -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 + "<on|off>" + clrDesc + " - turn knockback effect on or off.");
sender.sendMessage(cmd+" portal " + clrReq + "<on|off>" + clrDesc + " - turn portal redirection on or off.");
sender.sendMessage(cmd+" getmsg" + clrDesc + " - display border message.");
sender.sendMessage(cmd+" setmsg " + clrReq + "<text>" + clrDesc + " - set border message.");
sender.sendMessage(cmd+" knockback " + clrReq + "<distance>" + clrDesc + " - how far to move the player back.");

View File

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

View File

@ -24,6 +24,7 @@ commands:
/<command> setmsg <text> - set border message.
/<command> knockback <distance> - how far to move the player back.
/<command> whoosh <on/off> - turn knockback effect on or off.
/<command> portal <on/off> - turn portal redirection on or off.
/<command> delay <amount> - time between border checks.
/<command> wshape [world] <elliptic|rectangular|default> - override shape.
/<command> wshape [world] <round|square|default> - 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