SteamWar/BauSystem
Archiviert
13
0

Fix RightClickAir and LeftClickAir

Dieser Commit ist enthalten in:
jojo 2020-12-16 10:31:02 +01:00
Ursprung 4a9a317428
Commit 552649f884

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.core.Core;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -32,7 +33,9 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
public class ScriptListener implements Listener {
@ -68,9 +71,19 @@ public class ScriptListener implements Listener {
});
}
private Set<Player> playerSet = new HashSet<>();
@EventHandler(priority = EventPriority.HIGH)
public void onLeftClick(PlayerInteractEvent event) {
if(event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK)
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
playerSet.add(event.getPlayer());
}
return;
}
if (playerSet.remove(event.getPlayer())) {
return;
}
ItemStack item = event.getItem();
if(item == null || isNoBook(item) || item.getItemMeta() == null)