Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Remove PlayerMoveEvent listener and deprecate MovableTool (#2083)
Remove PlayerMoveEventListener and deprecate MovableTool
Dieser Commit ist enthalten in:
Ursprung
f9d6b127e6
Commit
321a39f121
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren