13
0

Fix firework rockets
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-03-25 17:39:47 +01:00
Ursprung 08d1ebfb12
Commit ba0d44c121

Datei anzeigen

@ -35,21 +35,6 @@ import org.bukkit.inventory.ItemStack;
public class InventoryInteraction extends BasicListener {
{
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
Bukkit.getOnlinePlayers().forEach(player -> {
ItemStack itemStack = player.getInventory().getItem(PlayerSpawn.FIREWORK_SLOT);
if (itemStack == null || itemStack.getType() == Material.AIR) {
player.getInventory().setItem(PlayerSpawn.FIREWORK_SLOT, PlayerSpawn.FIREWORK);
return;
}
if (itemStack.getAmount() > 1) {
player.getInventory().setItem(PlayerSpawn.FIREWORK_SLOT, PlayerSpawn.FIREWORK);
}
});
}, 0L, 1L);
}
@EventHandler
public void handlePlayerInteract(PlayerInteractEvent event) {
ItemStack item = event.getItem();
@ -57,7 +42,9 @@ public class InventoryInteraction extends BasicListener {
return;
if(item.getType() == Material.FIREWORK_ROCKET && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
item.setAmount(2);
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> {
event.getPlayer().getInventory().setItem(PlayerSpawn.FIREWORK_SLOT, PlayerSpawn.FIREWORK);
}, 1L);
return;
}