From abdfeda77481ca13ea450c53eb537bfe3465078c Mon Sep 17 00:00:00 2001 From: Brettflan Date: Wed, 12 Mar 2014 04:50:59 -0500 Subject: [PATCH] Workaround fix for players who have a passenger (pet riding their head or whatever) being able to bypass borders. This is due to a CraftBukkit issue (bug really, but whatever) where all teleportation fails silently if the entity attempted to be teleported has a rider/passenger. Normally players can't have anything riding them, but various plugins make that possible for pets or similar, as unwise as that may currently be with the CraftBukkit teleportation problems outlined above. I finally set aside some time to add and test this workaround out using EchoPet to make sure it actually works. --- .../com/wimbli/WorldBorder/BorderCheckTask.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/wimbli/WorldBorder/BorderCheckTask.java b/src/main/java/com/wimbli/WorldBorder/BorderCheckTask.java index 4069848..975ad71 100644 --- a/src/main/java/com/wimbli/WorldBorder/BorderCheckTask.java +++ b/src/main/java/com/wimbli/WorldBorder/BorderCheckTask.java @@ -99,6 +99,19 @@ public class BorderCheckTask implements Runnable } } + // check if player has something (a pet, maybe?) riding them; only possible through odd plugins. + // it can prevent all teleportation of the player completely, so it's very much not good and needs handling + if (player.getPassenger() != null) + { + Entity rider = player.getPassenger(); + player.eject(); + rider.teleport(newLoc, TeleportCause.PLUGIN); + player.sendMessage("Your passenger has been ejected."); + if (Config.Debug()) + Config.logWarn("Player had a passenger riding on them: " + rider.getType()); + } + + // give some particle and sound effects where the player was beyond the border, if "whoosh effect" is enabled Config.showWhooshEffect(loc);