Player Changing world should be nicer for teleports

This commit is contained in:
libraryaddict 2014-10-25 23:38:13 +13:00
parent f060b27be6
commit f6140620c8

View File

@ -277,9 +277,9 @@ public class DisguiseListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onTeleport(final PlayerTeleportEvent event) {
if (DisguiseConfig.isBedPacketsEnabled()) {
Location to = event.getTo();
Location from = event.getFrom();
if (DisguiseConfig.isBedPacketsEnabled()) {
int x1 = (int) Math.floor(to.getX() / 16D) - 17;
int x2 = (int) Math.floor(from.getX() / 16D) - 17;
int z1 = (int) Math.floor(to.getZ() / 16D) - 17;
@ -297,6 +297,12 @@ public class DisguiseListener implements Listener {
});
}
}
if (DisguiseConfig.isUndisguiseOnWorldChange() && to.getWorld() != null && from.getWorld() != null
&& to.getWorld() != from.getWorld()) {
for (Disguise disguise : DisguiseAPI.getDisguises(event.getPlayer())) {
disguise.removeDisguise();
}
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)