Dieser Commit ist enthalten in:
Ursprung
65f6789c95
Commit
08d1ebfb12
@ -19,17 +19,37 @@
|
||||
|
||||
package de.steamwar.lobby.listener;
|
||||
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.command.ModifyCommand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
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();
|
||||
|
@ -36,6 +36,12 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class PlayerSpawn extends BasicListener {
|
||||
|
||||
public static final int FIREWORK_SLOT = 3;
|
||||
public static final ItemStack FIREWORK = new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build();
|
||||
public static final int PARTICLE_SLOT = 5;
|
||||
public static final ItemStack PARTICLE = new ItemBuilder(Material.NAME_TAG).setDisplayName("§6Partikel").setUnbreakable(true).removeAllAttributes().build();
|
||||
private static final ItemStack ELYTRA = new ItemBuilder(Material.ELYTRA).setDisplayName("§5Elytra").setUnbreakable(true).removeAllAttributes().build();
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
@ -52,17 +58,14 @@ public class PlayerSpawn extends BasicListener {
|
||||
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> new ImALobbyPacket().send(player), 20);
|
||||
}
|
||||
|
||||
private static final ItemStack ELYTRA = new ItemBuilder(Material.ELYTRA).setDisplayName("§5Elytra").setUnbreakable(true).removeAllAttributes().build();
|
||||
public static final ItemStack PARTICLE = new ItemBuilder(Material.NAME_TAG).setDisplayName("§6Partikel").setUnbreakable(true).removeAllAttributes().build();
|
||||
|
||||
private void giveItems(Player player) {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
||||
inventory.setItem(EquipmentSlot.CHEST, ELYTRA);
|
||||
|
||||
player.getInventory().setItem(3, new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build());
|
||||
player.getInventory().setItem(FIREWORK_SLOT, FIREWORK);
|
||||
|
||||
player.getInventory().setItem(5, PARTICLE);
|
||||
player.getInventory().setItem(PARTICLE_SLOT, PARTICLE);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren