mirror of
https://github.com/Brettflan/WorldBorder.git
synced 2024-11-22 18:16:24 +01:00
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.
This commit is contained in:
parent
b8735aded0
commit
abdfeda774
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user