summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 052a2b80..c5b2b9c4 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -139,8 +139,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
server.getPluginManager().callEvent(event);
- from = event.getFrom();
- to = event.isCancelled() ? from : event.getTo();
+ // If the event is cancelled we move the player back to their old location.
+ if (event.isCancelled()) {
+ to = from;
+ }
+
+ /* If a Plugin has changed the To destination then we teleport the Player
+ there to avoid any 'Moved wrongly' or 'Moved too quickly' errors.
+ We only do this if the Event was not cancelled. */
+ if (!to.equals(event.getTo()) && !event.isCancelled()) {
+ ((CraftPlayer) this.player.getBukkitEntity()).teleport(event.getTo());
+ return;
+ }
this.player.locX = to.getX();
this.player.locY = to.getY();