Dieser Commit ist enthalten in:
Ursprung
08d1ebfb12
Commit
ba0d44c121
@ -35,21 +35,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class InventoryInteraction extends BasicListener {
|
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
|
@EventHandler
|
||||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||||
ItemStack item = event.getItem();
|
ItemStack item = event.getItem();
|
||||||
@ -57,7 +42,9 @@ public class InventoryInteraction extends BasicListener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(item.getType() == Material.FIREWORK_ROCKET && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren