Skip to content
Permalink
Browse files

Only undo enderperl teleport events, and set a proper cause.

  • Loading branch information...
bmhm committed Apr 5, 2016
1 parent a7c2dd5 commit 89cffca36499eeb526545b056d65775a0816ee3d
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/main/java/de/bmarwell/bukkit/listener/PlayerTeleportListener.java
@@ -16,6 +16,7 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;

/**
* React on player teleport events.
@@ -31,12 +32,15 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
return;
}

// Undo all teleports manually.
// If this is not an ender teleport, don't bother.
if (!TeleportCause.ENDER_PEARL.equals(event.getCause())) {
return;
}

Player teleportedPlayer = event.getPlayer();
Location origin = event.getFrom();
event.getCause();

boolean teleportSuccess = teleportedPlayer.teleport(origin);
boolean teleportSuccess = teleportedPlayer.teleport(origin, TeleportCause.PLUGIN);
// TODO: log teleportSuccess;
}

0 comments on commit 89cffca

Please sign in to comment.
You can’t perform that action at this time.