diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index 0ff37f0..fd6ab8e 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -3,64 +3,71 @@ package de.steamwar.lobby.inventories; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.lobby.utils.LobbyPlayer; -import org.bukkit.Effect; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.UserGroup; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; +import java.util.regex.MatchResult; public class ParticleInventory { private ParticleInventory() {} - public static void openParticleInventory(Player player) { + private static SWInventory createInventory(Player player) { LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); - - SWInventory swInventory = new SWInventory(player, 9 * 1, "§6Partikel"); + UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup(); List lore = new ArrayList<>(); lore.add("§aKlicken zum Auswählen"); - SWItem smoke = new SWItem(Material.COBWEB, "§7Smoke", lore, false, clickType -> { - lobbyPlayer.setParticle(Particle.SMOKE_NORMAL); + SWInventory swInventory; + if (userGroup == UserGroup.Member) { + swInventory = new SWInventory(player, 9*5, "§6Partikel"); + } else { + swInventory = new SWInventory(player, 9*6, "§6Partikel"); + } + + add(swInventory, Material.COBWEB, "§7Smoke", lore, Particle.SMOKE_NORMAL, 11, player, lobbyPlayer); + add(swInventory, Material.LAVA_BUCKET, "§cFeuer", lore, Particle.DRIP_LAVA, 12, player, lobbyPlayer); + add(swInventory, Material.RED_DYE, "§cHerzen", lore, Particle.HEART, 13, player, lobbyPlayer); + add(swInventory, Material.WATER_BUCKET, "§bWasser", lore, Particle.DRIP_WATER, 14, player, lobbyPlayer); + add(swInventory, Material.NOTE_BLOCK, "§eNoten", lore, Particle.NOTE, 15, player, lobbyPlayer); + + add(swInventory, Material.GLASS_BOTTLE, "§5Effekt", lore, Particle.SPELL, 20, player, lobbyPlayer); + add(swInventory, Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 21, player, lobbyPlayer); + add(swInventory, Material.APPLE, "§8Item", lore, Particle.ITEM_CRACK, 22, player, lobbyPlayer); + add(swInventory, Material.INK_SAC, "§8Tintenfisch", lore, Particle.SQUID_INK, 23, player, lobbyPlayer); + add(swInventory, Material.SLIME_BALL, "§aSchleim", lore, Particle.SLIME, 24, player, lobbyPlayer); + + if (userGroup == UserGroup.Member) { + add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 31, player, lobbyPlayer); + } else { + add(swInventory, Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH, 29, player, lobbyPlayer); + add(swInventory, Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE, 30, player, lobbyPlayer); + add(swInventory, Material.TUBE_CORAL_FAN, "§bLuftblasen", lore, Particle.BUBBLE_COLUMN_UP, 31, player, lobbyPlayer); + add(swInventory, Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 32, player, lobbyPlayer); + add(swInventory, Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 33, player, lobbyPlayer); + + add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 40, player, lobbyPlayer); + } + + return swInventory; + } + + private static void add(SWInventory swInventory, Material material, String name, List lore, Particle particle, int slot, Player player, LobbyPlayer lobbyPlayer) { + SWItem swItem = new SWItem(material, name, lore, false, clickType -> { + lobbyPlayer.setParticle(particle); player.closeInventory(); }); + swInventory.setItem(slot, swItem); + } - SWItem fire = new SWItem(Material.LAVA_BUCKET, "§cFeuer", lore, false, clickType -> { - lobbyPlayer.setParticle(Particle.DRIP_LAVA); - player.closeInventory(); - }); - - SWItem heart = new SWItem(Material.RED_DYE, "§cHerzen", lore, false, clickType -> { - lobbyPlayer.setParticle(Particle.HEART); - player.closeInventory(); - }); - - SWItem water = new SWItem(Material.WATER_BUCKET, "§bWasser", lore, false, clickType -> { - lobbyPlayer.setParticle(Particle.DRIP_WATER); - player.closeInventory(); - }); - - SWItem note = new SWItem(Material.NOTE_BLOCK, "§eNoten", lore, false, clickType -> { - lobbyPlayer.setParticle(Particle.NOTE); - player.closeInventory(); - }); - - SWItem reset = new SWItem(Material.BARRIER, "§8Keine Partikel", lore, false, clickType -> { - lobbyPlayer.setParticle(null); - player.closeInventory(); - }); - - swInventory.setItem(1, smoke); - swInventory.setItem(2, fire); - swInventory.setItem(3, heart); - swInventory.setItem(4, water); - swInventory.setItem(5, note); - swInventory.setItem(8, reset); - - swInventory.open(); + public static void openParticleInventory(Player player) { + createInventory(player).open(); }