Remove PlayerMoveEvent listener and deprecate MovableTool (#2083)

Remove PlayerMoveEventListener and deprecate MovableTool
This commit is contained in:
Hannes Greule 2023-02-07 23:07:57 +01:00 committed by GitHub
parent f9d6b127e6
commit 321a39f121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 21 deletions

View File

@ -1,6 +1,5 @@
package com.fastasyncworldedit.bukkit.listener;
import com.fastasyncworldedit.core.command.tool.MovableTool;
import com.fastasyncworldedit.core.command.tool.ResettableTool;
import com.fastasyncworldedit.core.command.tool.scroll.ScrollTool;
import com.sk89q.worldedit.LocalSession;
@ -8,7 +7,6 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.command.tool.Tool;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -16,7 +14,6 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.Plugin;
public class BrushListener implements Listener {
@ -49,24 +46,6 @@ public class BrushListener implements Listener {
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) {
Location from = event.getFrom();
Location to = event.getTo();
if ((from.getYaw() != to.getYaw() && from.getPitch() != to.getPitch()) || from.getBlockX() != to.getBlockX() || from.getBlockZ() != to
.getBlockZ() || from.getBlockY() != to.getBlockY()) {
Player bukkitPlayer = event.getPlayer();
com.sk89q.worldedit.entity.Player player = BukkitAdapter.adapt(bukkitPlayer);
LocalSession session = player.getSession();
Tool tool = session.getTool(player);
if (tool != null) {
if (tool instanceof MovableTool) {
((MovableTool) tool).move(player);
}
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerInteract(final PlayerInteractEvent event) {
Player bukkitPlayer = event.getPlayer();

View File

@ -2,8 +2,16 @@ package com.fastasyncworldedit.core.command.tool;
import com.sk89q.worldedit.entity.Player;
/**
* @deprecated This interface has no functionality anymore
*/
@Deprecated(forRemoval = true, since = "TODO")
public interface MovableTool {
/**
* @deprecated This interface has no functionality anymore
*/
@Deprecated(forRemoval = true, since = "TODO")
boolean move(Player player);
}