Skip to content

Instantly share code, notes, and snippets.

@whilb
Created April 28, 2014 04:08
Show Gist options
  • Save whilb/11361552 to your computer and use it in GitHub Desktop.
Save whilb/11361552 to your computer and use it in GitHub Desktop.
listen for player move event
@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