How can i detect player moves (without head moves)?


Trying to detect player moves:
public void MoveEntityEvent(MoveEntityEvent event) {

But when player moves his mouse this events works too
How can i detect moves without head moves?
P.S. Mabe that’s a bad event for this detect?


You use the same event. Just throw out if the players full position does not move.

The code below probably has errors as it is memory typed so use it as a base line

public void onEntityMove(EntityMoveEvent event){
  Location<World> oldLoc = event.getFromTransform().getLocation();
  Location<World> newLoc = event.getTransform().getLocation();
  if((oldLoc.getX() == newLoc.getX()) && (oldLoc .... Etc)){
    //throws out the event
 //continue here like a normal event

If you really want to stop just rotation. The getTransform class has a getRotation() that you could compare as well as the location


Thank you!
This is exactly what I thought, no special tools for this case


You can actually just compare the locations directly. Location is just the x y and z coordinates. Transform is what incorporates rotation.


Yeah sorry. Been working with bukkit lately so my mind set was still in the bukkit workaround mode