New command /wb remount <amount>, which determines the delay in server ticks before remounting a player to their vehicle after they're knocked back from the border. Requires new permission "worldborder.remount". The default value of 0 disables this feature, leaving the player dismounted beside their vehicle after knockback. This value should not be set to a value lower than 10 (the former default value) on a public server as that would lead to client glitches. Even the former default value of 10 has been reported to rarely glitch on some servers, thus remounting now defaulting to disabled.

Working around Minecraft and Bukkit client/server glitches when teleporting an entity which has a passenger or is a passenger is the whole reason for this "feature". The need was introduced a few Minecraft versions back when this well and truly broke; hopefully they will fix the underlying problems eventually.
This commit is contained in:
Brettflan 2013-07-07 02:51:24 -05:00
parent 5c23d072f1
commit 1eb7e0da10
4 changed files with 67 additions and 4 deletions

View File

@ -89,8 +89,12 @@ public class BorderCheckTask implements Runnable
ride.setVelocity(new Vector(0, 0, 0));
ride.teleport(rideLoc);
}
setPassengerDelayed(ride, player, player.getName(), 10);
handlingVehicle = true;
if (Config.RemountTicks() > 0)
{
setPassengerDelayed(ride, player, player.getName(), Config.RemountTicks());
handlingVehicle = true;
}
}
}

View File

@ -44,6 +44,7 @@ public class Config
private static boolean portalRedirection = true;
private static boolean dynmapEnable = true;
private static String dynmapMessage;
private static int remountDelayTicks = 0;
// for monitoring plugin efficiency
// public static long timeUsed = 0;
@ -267,6 +268,23 @@ public class Config
return timerTicks;
}
public static void setRemountTicks(int ticks)
{
remountDelayTicks = ticks;
if (remountDelayTicks == 0)
Log("Remount delay set to 0. Players will be left dismounted when knocked back from the border while on a vehicle.");
else
Log("Remount delay set to " + remountDelayTicks + " tick(s). That is roughly " + (remountDelayTicks * 50) + "ms / " + (((double)remountDelayTicks * 50.0) / 1000.0) + " seconds.");
if (ticks < 10)
LogWarn("setting the remount delay to less than 10 (and greater than 0) is not recommended. This can lead to nasty client glitches.");
save(true);
}
public static int RemountTicks()
{
return remountDelayTicks;
}
public static void setDynmapBorderEnabled(boolean enable)
{
@ -437,6 +455,7 @@ public class Config
portalRedirection = cfg.getBoolean("portal-redirection", true);
knockBack = cfg.getDouble("knock-back-dist", 3.0);
timerTicks = cfg.getInt("timer-delay-ticks", 5);
remountDelayTicks = cfg.getInt("remount-delay-ticks", 0);
dynmapEnable = cfg.getBoolean("dynmap-border-enabled", true);
dynmapMessage = cfg.getString("dynmap-border-message", "The border of the world.");
LogConfig("Using " + (ShapeName()) + " border, knockback of " + knockBack + " blocks, and timer delay of " + timerTicks + ".");
@ -521,6 +540,7 @@ public class Config
cfg.set("portal-redirection", portalRedirection);
cfg.set("knock-back-dist", knockBack);
cfg.set("timer-delay-ticks", timerTicks);
cfg.set("remount-delay-ticks", remountDelayTicks);
cfg.set("dynmap-border-enabled", dynmapEnable);
cfg.set("dynmap-border-message", dynmapMessage);

View File

@ -679,6 +679,39 @@ public class WBCommand implements CommandExecutor
cmdTrim(sender, player, world, confirm, cancel, pause, pad, frequency);
}
// "remount" command from player or console
else if (split.length == 2 && split[0].equalsIgnoreCase("remount"))
{
if (!Config.HasPermission(player, "remount")) return true;
int delay = 0;
try
{
delay = Integer.parseInt(split[1]);
if (delay < 0)
throw new NumberFormatException();
}
catch(NumberFormatException ex)
{
sender.sendMessage(clrErr + "The remount delay must be an integer of 0 or higher. Setting to 0 will disable remounting.");
return true;
}
Config.setRemountTicks(delay);
if (player != null)
{
if (delay == 0)
sender.sendMessage("Remount delay set to 0. Players will be left dismounted when knocked back from the border while on a vehicle.");
else
{
sender.sendMessage("Remount delay set to " + delay + " tick(s). That is roughly " + (delay * 50) + "ms / " + (((double)delay * 50.0) / 1000.0) + " seconds. Setting to 0 would disable remounting.");
if (delay < 10)
sender.sendMessage(clrErr + "WARNING:" + clrDesc + " setting this to less than 10 (and greater than 0) is not recommended. This can lead to nasty client glitches.");
}
}
}
// "dynmap" command from player or console
else if (split.length == 2 && split[0].equalsIgnoreCase("dynmap"))
{
@ -801,11 +834,11 @@ 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.");
sender.sendMessage(cmd+" delay " + clrReq + "<amount>" + clrDesc + " - time between border checks.");
sender.sendMessage(cmd+" remount " + clrReq + "<amount>" + clrDesc + " - player remount delay after knockback.");
sender.sendMessage(cmd+" dynmap " + clrReq + "<on|off>" + clrDesc + " - turn DynMap border display on or off.");
sender.sendMessage(cmd+" dynmapmsg " + clrReq + "<text>" + clrDesc + " - DynMap border labels will show this.");
if (page == 3)
@ -813,6 +846,7 @@ public class WBCommand implements CommandExecutor
}
if (page == 0 || page == 4)
{
sender.sendMessage(cmd+" portal " + clrReq + "<on|off>" + clrDesc + " - turn portal redirection on or off.");
sender.sendMessage(cmd+" reload" + clrDesc + " - re-load data from config.yml.");
sender.sendMessage(cmd+" debug " + clrReq + "<on|off>" + clrDesc + " - turn console debug output on or off.");
if (page == 4)

View File

@ -1,7 +1,7 @@
name: WorldBorder
author: Brettflan
description: Efficient, feature-rich plugin for limiting the size of your worlds.
version: 1.7.3
version: 1.7.3_dev
main: com.wimbli.WorldBorder.WorldBorder
softdepend:
- dynmap
@ -32,6 +32,7 @@ commands:
/<command> [world] fill [freq] [pad] - generate world out to border.
/<command> [world] trim [freq] [pad] - trim world outside of border.
/<command> bypass [player] [on/off] - let player go beyond border.
/<command> remount <amount> - delay before remounting after knockback.
/<command> dynmap <on/off> - turn DynMap border display on or off.
/<command> dynmapmsg <text> - DynMap border labels will show this.
/<command> debug <on/off> - turn debug mode on or off.
@ -60,6 +61,7 @@ permissions:
worldborder.bypass: true
worldborder.wrap: true
worldborder.portal: true
worldborder.remount: true
worldborder.set:
description: Can set borders for any world
default: op
@ -114,6 +116,9 @@ permissions:
worldborder.portal:
description: Can enable/disable portal redirection to be inside border
default: op
worldborder.remount:
description: Can set the delay before remounting a player to their vehicle after knockback
default: op
worldborder.dynmap:
description: Can enable/disable DynMap border display integration
default: op