mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 19:46:21 +01:00
Added recommended work-around for handling player movement in such a way that it doesn't trigger the movement speed check. Thanks for the help Rigby!
Plugins are advised to no longer teleport players in the PlayerMove event and to use setTo instead, as we now trigger a teleport when setTo is used.
This commit is contained in:
parent
f3d25e647f
commit
b92f54639a
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user