/FileExtraction/Java_unseen/zigazajc007_Passky/src/main/java/com/rabbitcomapny/listeners/PlayerMoveListener.java
package com.rabbitcomapny.listeners;

import com.rabbitcomapny.Passky;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;

public class PlayerMoveListener implements Listener {

	private final Passky passky;

	public PlayerMoveListener(Passky plugin) {
		passky = plugin;

		Bukkit.getPluginManager().registerEvents(this, plugin);
	}

	@EventHandler
	public void onPlayerMove(PlayerMoveEvent e) {
		if (e.getTo() != null && !Passky.isLoggedIn.getOrDefault(e.getPlayer().getUniqueId(), false)) {
			if (e.getFrom().getBlockX() != e.getTo().getBlockX() || e.getFrom().getBlockY() != e.getTo().getBlockY() || e.getFrom().getBlockZ() != e.getTo().getBlockZ()) {
				e.setCancelled(true);
			}
		}
	}

}
