Teleportation needs to be scheduled in sync

- Revert removal of sync scheduled task for teleportation
- Add back listener properties from 5d6f3e1 since they don't interfere
This commit is contained in:
ljacqu
2016-08-04 19:08:05 +02:00
parent 306160e675
commit 8002ef45fd
3 changed files with 21 additions and 6 deletions
@@ -158,10 +158,15 @@ public class TeleportationService implements Reloadable {
* @param event the event to emit and according to which to teleport
*/
private void performTeleportation(final Player player, final AbstractTeleportEvent event) {
bukkitService.callEvent(event);
if (player.isOnline() && isEventValid(event)) {
player.teleport(event.getTo());
}
bukkitService.scheduleSyncDelayedTask(new Runnable() {
@Override
public void run() {
bukkitService.callEvent(event);
if (player.isOnline() && isEventValid(event)) {
player.teleport(event.getTo());
}
}
});
}
private static boolean isEventValid(AbstractTeleportEvent event) {