I've got some code for an event handler for the PlayerMoveEvent that checks if a player has moved to the next block over only using getFrom and getTo but through my debug messages, I have found that it doesn't work. Here is my code:
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
// Check if he moved to another block
if (event.getFrom().getBlock() != event.getTo().getBlock()) {
event.getPlayer().sendMessage(ChatColor.BLUE + "debug: YOU MOVED!");
I know it's not working because I get spammed when I move around inside the same block, or even look around for that matter because it also triggers the player move event