SteamWar/BauSystem2.0
Archiviert
12
0

Fix ScriptEventListener Drop runs LeftClick bug
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-08-08 20:38:37 +02:00
Ursprung 32ab629a81
Commit 700bfc6100

Datei anzeigen

@ -39,7 +39,9 @@ import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@Linked(LinkageType.LISTENER)
public class ScriptEventListener implements Listener {
@ -84,8 +86,13 @@ public class ScriptEventListener implements Listener {
customScriptManager.callEvent(EventType.BreakBlock, event.getPlayer(), event);
}
private Set<Player> ignore = new HashSet<>();
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (ignore.remove(event.getPlayer())) {
return;
}
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
customScriptManager.callEvent(EventType.RightClick, event.getPlayer(), event);
}
@ -124,6 +131,7 @@ public class ScriptEventListener implements Listener {
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
ignore.add(event.getPlayer());
customScriptManager.callEvent(EventType.DropItem, event.getPlayer(), event);
}
}