13
0

Test firework
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-03-11 16:43:00 +01:00
Ursprung d83952ae5c
Commit ba7c0d9702

Datei anzeigen

@ -23,31 +23,28 @@ import de.steamwar.lobby.command.ModifyCommand;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class InventoryInteraction extends BasicListener { public class InventoryInteraction extends BasicListener {
@EventHandler(priority = EventPriority.LOW) @EventHandler
public void handlePlayerInteract(PlayerInteractEvent event) { public void handlePlayerInteract(PlayerInteractEvent event) {
ItemStack item = event.getItem(); if(event.getItem() == null)
if(item == null)
return; return;
if ((event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) && item.getType() == Material.FIREWORK_ROCKET) {
item.setAmount(2);
return;
}
if(!ModifyCommand.modifying(event.getPlayer())) if(!ModifyCommand.modifying(event.getPlayer()))
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler
public void handleItemConsume(PlayerItemConsumeEvent event) {
ItemStack item = event.getItem();
if (item.getType() == Material.FIREWORK_ROCKET)
item.setAmount(2);
}
@EventHandler @EventHandler
public void handlePlayerDropItem(PlayerDropItemEvent event) { public void handlePlayerDropItem(PlayerDropItemEvent event) {
event.setCancelled(true); event.setCancelled(true);