diff --git a/src/de/steamwar/lobby/inventories/EventParticle.java b/src/de/steamwar/lobby/inventories/EventParticle.java index e4bf7e6..01e51f8 100644 --- a/src/de/steamwar/lobby/inventories/EventParticle.java +++ b/src/de/steamwar/lobby/inventories/EventParticle.java @@ -27,14 +27,14 @@ import org.bukkit.Particle; public enum EventParticle { - WarGearSeason("WarGearSeason", new int[]{12, 285, 54}, new CloudCircleParticle(Material.ENCHANTING_TABLE, "§cVerzaubert", ParticleInventory.loreBuilder(new String[]{"Wolke", "Ring"}, "WarGearSeason Event 1., 2. oder 3. Platz"), Particle.ENCHANTMENT_TABLE, location -> location.add(0, 1.1, 0)), new SimpleParticle(Material.BOOK, "§5Verzaubert", ParticleInventory.loreBuilder(new String[0], "WarGearSeason Event"), Particle.ENCHANTMENT_TABLE)), - AirshipEvent("AirshipEvent", new int[]{205, 9, 54, 120, 292}, new CircleParticle(Material.SNOWBALL, "§fCloud", ParticleInventory.loreBuilder(new String[]{"Ring"}, "AirshipEvent Event 1., 2. oder 3. Platz"), Particle.CLOUD, null, location -> location.add(0, 2.2, 0)), new SimpleParticle(Material.SNOW_BLOCK, "§fCloud", ParticleInventory.loreBuilder(new String[0], "AirshipEvent Event"), Particle.CLOUD)), - HellsBellsWs("HellsBells-WS", new int[]{205, 9, 11}, new CircleParticle(Material.TNT_MINECART, "§8Explosion", ParticleInventory.loreBuilder(new String[]{"Ring"}, "HellsBells Event 1., 2. oder 3. Platz"), Particle.EXPLOSION_NORMAL, null, location -> location.add(0, 2.2, 0)), new SimpleParticle(Material.TNT, "§8Explosion", ParticleInventory.loreBuilder(new String[0], "HellsBells Event"), Particle.EXPLOSION_NORMAL)), - Underwater("Underwater", new int[]{9, 210, 520}, new CloudParticle(Material.PRISMARINE_CRYSTALS, "§bWasser", ParticleInventory.loreBuilder(new String[]{"Wolke"}, "Underwater Event 1., 2. oder 3. Platz"), Particle.DRIP_WATER), new SimpleParticle(Material.PRISMARINE_BRICKS, "§bWasser", ParticleInventory.loreBuilder(new String[0], "Underwater Event"), Particle.DRIP_WATER)); + WarGearSeason(22, new int[]{12, 285, 54}, new CloudCircleParticle(Material.ENCHANTING_TABLE, "§cVerzaubert", ParticleInventory.loreBuilder(new String[]{"Wolke", "Ring"}, "WarGearSeason Event 1., 2. oder 3. Platz"), Particle.ENCHANTMENT_TABLE, location -> location.add(0, 1.1, 0)), new SimpleParticle(Material.BOOK, "§5Verzaubert", ParticleInventory.loreBuilder(new String[0], "WarGearSeason Event"), Particle.ENCHANTMENT_TABLE)), + AirshipEvent(26, new int[]{205, 9, 54, 120, 292}, new CircleParticle(Material.SNOWBALL, "§fCloud", ParticleInventory.loreBuilder(new String[]{"Ring"}, "AirshipEvent Event 1., 2. oder 3. Platz"), Particle.CLOUD, null, location -> location.add(0, 2.2, 0)), new SimpleParticle(Material.SNOW_BLOCK, "§fCloud", ParticleInventory.loreBuilder(new String[0], "AirshipEvent Event"), Particle.CLOUD)), + HellsBellsWs(28, new int[]{205, 9, 11}, new CircleParticle(Material.TNT_MINECART, "§8Explosion", ParticleInventory.loreBuilder(new String[]{"Ring"}, "HellsBells Event 1., 2. oder 3. Platz"), Particle.EXPLOSION_NORMAL, null, location -> location.add(0, 2.2, 0)), new SimpleParticle(Material.TNT, "§8Explosion", ParticleInventory.loreBuilder(new String[0], "HellsBells Event"), Particle.EXPLOSION_NORMAL)), + Underwater(31, new int[]{9, 210, 520}, new CloudParticle(Material.PRISMARINE_CRYSTALS, "§bWasser", ParticleInventory.loreBuilder(new String[]{"Wolke"}, "Underwater Event 1., 2. oder 3. Platz"), Particle.DRIP_WATER), new SimpleParticle(Material.PRISMARINE_BRICKS, "§bWasser", ParticleInventory.loreBuilder(new String[0], "Underwater Event"), Particle.DRIP_WATER)); public static EventParticle[] eventParticles = values(); - EventParticle(String event, int[] placementTeams, SpecialParticle placementParticle, SpecialParticle participationParticles) { + EventParticle(int event, int[] placementTeams, SpecialParticle placementParticle, SpecialParticle participationParticles) { this.event = event; this.placementTeams = placementTeams; this.placementParticle = placementParticle; @@ -42,7 +42,7 @@ public enum EventParticle { } - public final String event; + public final int event; public final int[] placementTeams; public final SpecialParticle placementParticle; public final SpecialParticle participationParticles; diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index aa451f7..6d06113 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -24,17 +24,13 @@ import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; import de.steamwar.lobby.particle.*; import de.steamwar.lobby.utils.LobbyPlayer; -import de.steamwar.sql.Event; -import de.steamwar.sql.SteamwarUser; -import de.steamwar.sql.Team; -import de.steamwar.sql.UserGroup; +import de.steamwar.sql.*; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Player; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; public class ParticleInventory { @@ -138,6 +134,7 @@ public class ParticleInventory { particleList = new ArrayList<>(SERVERTEAM_PARTICLES_ENTRIES); } + Set events = steamwarUser.getTeam() == 0 ? new HashSet<>() : TeamTeilnahme.getEvents(steamwarUser.getTeam()).stream().map(Event::getEventID).collect(Collectors.toSet()); for (EventParticle eventParticle : EventParticle.eventParticles) { boolean clickablePlacement = userGroup.isTeamGroup(); clickablePlacement |= (steamwarUser.getTeam() != 0 && contains(eventParticle.placementTeams, steamwarUser.getTeam())); @@ -149,9 +146,7 @@ public class ParticleInventory { particleList.add(new SWListInv.SWListEntry<>(swItem, null)); } - boolean clickableParticipation = userGroup.isTeamGroup(); - // TODO: Team team = Team.get(steamwarUser.getTeam()); participation fehlt!, wofür 'TeamTeilnahme' im SpigotCore fehlt. - if (clickableParticipation) { + if (userGroup.isTeamGroup() || events.contains(eventParticle.event)) { particleList.add(new SWListInv.SWListEntry<>(eventParticle.participationParticles.getItem(), eventParticle.participationParticles)); } else { SWItem swItem = eventParticle.participationParticles.getItem();