use of io.github.wysohn.triggerreactor.bukkit.manager.event.PlayerBlockLocationEvent in project TriggerReactor by wysohn.
the class PlayerLocationManager method onMove.
@EventHandler(priority = EventPriority.HIGHEST)
public void onMove(PlayerMoveEvent e) {
if (e.getTo() == e.getFrom())
return;
Player player = e.getPlayer();
SimpleLocation from = getCurrentBlockLocation(player.getUniqueId());
SimpleLocation to = LocationUtil.convertToSimpleLocation(e.getTo());
PlayerBlockLocationEvent pble = new PlayerBlockLocationEvent(player, from, to);
onMove(new BukkitPlayerBlockLocationEvent(pble));
if (pble.isCancelled()) {
Location loc = LocationUtil.convertToBukkitLocation(from);
loc.setPitch(e.getPlayer().getLocation().getPitch());
loc.setYaw(e.getPlayer().getLocation().getPitch());
e.setFrom(loc);
e.setTo(loc);
}
}
Aggregations