Created
April 28, 2014 04:08
-
-
Save whilb/11361552 to your computer and use it in GitHub Desktop.
listen for player move event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EventHandler | |
public void onMove(PlayerMoveEvent event) { | |
Location from = event.getFrom(); | |
Location to = event.getTo(); | |
Location eLoc = remoteEntityThing.getLocation(); | |
int modX = to.getX() - from.getX(); | |
int modY = to.getY() - from.getY(); | |
int modZ = to.getZ() - from.getZ(); | |
Location moveTo = new Location(eLoc.getX() + modX, eLoc.getY() + modY, eLoc.getZ() - modZ); | |
remoteEntityThing.moveToLoc(moveTo); | |
event.setCancelled(true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment