Fix ScriptEventListener Drop runs LeftClick bug
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
32ab629a81
Commit
700bfc6100
@ -39,7 +39,9 @@ import org.bukkit.event.entity.EntitySpawnEvent;
|
|||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Linked(LinkageType.LISTENER)
|
@Linked(LinkageType.LISTENER)
|
||||||
public class ScriptEventListener implements Listener {
|
public class ScriptEventListener implements Listener {
|
||||||
@ -84,8 +86,13 @@ public class ScriptEventListener implements Listener {
|
|||||||
customScriptManager.callEvent(EventType.BreakBlock, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.BreakBlock, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Set<Player> ignore = new HashSet<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
|
if (ignore.remove(event.getPlayer())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
customScriptManager.callEvent(EventType.RightClick, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.RightClick, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
@ -124,6 +131,7 @@ public class ScriptEventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
|
ignore.add(event.getPlayer());
|
||||||
customScriptManager.callEvent(EventType.DropItem, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.DropItem, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren