From 3eb9c2fa6c78f07cc4b3752211973e9cac103549 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 13:18:39 +0200 Subject: [PATCH 1/9] Add EventParticle --- .../lobby/inventories/EventParticle.java | 49 +++++++++++++++++++ .../lobby/inventories/ParticleInventory.java | 36 ++++++++++++-- 2 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 src/de/steamwar/lobby/inventories/EventParticle.java diff --git a/src/de/steamwar/lobby/inventories/EventParticle.java b/src/de/steamwar/lobby/inventories/EventParticle.java new file mode 100644 index 0000000..19cbb67 --- /dev/null +++ b/src/de/steamwar/lobby/inventories/EventParticle.java @@ -0,0 +1,49 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * / + */ + +package de.steamwar.lobby.inventories; + + +import de.steamwar.lobby.particle.CloudParticle; +import de.steamwar.lobby.particle.SimpleParticle; +import de.steamwar.lobby.particle.SpecialParticle; +import org.bukkit.Material; +import org.bukkit.Particle; + +public enum EventParticle { + + Underwater("Underwater", new int[0], 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) { + this.event = event; + this.placementTeams = placementTeams; + this.placementParticle = placementParticle; + this.participationParticles = participationParticles; + + } + + public final String 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 569bad6..2fc2c40 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -23,13 +23,16 @@ import de.steamwar.inventory.SWInventory; 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 org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Player; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class ParticleInventory { @@ -120,19 +123,35 @@ public class ParticleInventory { SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); UserGroup userGroup = steamwarUser.getUserGroup(); - SWListInv particleSWListInv; + List> particleList; if (userGroup == UserGroup.Member) { if (steamwarUser.getTeam() != 0) { - particleSWListInv = new SWListInv<>(player, "§6Partikel", false, TEAM_PARTICLES_ENTRIES, (clickType, particle) -> lobbyPlayer.setParticle(particle)); + particleList = new ArrayList<>(TEAM_PARTICLES_ENTRIES); } else { if (TEAM_PARTICLES.contains(lobbyPlayer.getParticle())) { lobbyPlayer.setParticle(null); } - particleSWListInv = new SWListInv<>(player, "§6Partikel", false, PLAYER_PARTICLES_ENTRIES, (clickType, particle) -> lobbyPlayer.setParticle(particle)); + particleList = new ArrayList<>(PLAYER_PARTICLES_ENTRIES); } } else { - particleSWListInv = new SWListInv<>(player, "§6Partikel", false, SERVERTEAM_PARTICLES_ENTRIES, (clickType, particle) -> lobbyPlayer.setParticle(particle)); + particleList = new ArrayList<>(SERVERTEAM_PARTICLES_ENTRIES); } + + if (steamwarUser.getTeam() != 0 && !userGroup.isTeamGroup()) { + for (EventParticle eventParticle : EventParticle.eventParticles) { + if (contains(eventParticle.placementTeams, steamwarUser.getTeam())) { + particleList.add(new SWListInv.SWListEntry<>(eventParticle.placementParticle.getItem(), eventParticle.placementParticle)); + } + } + // TODO: Team team = Team.get(steamwarUser.getTeam()); participation fehlt!, wofür 'TeamTeilnahme' im SpigotCore fehlt. + } else if (userGroup.isTeamGroup()) { + for (EventParticle eventParticle : EventParticle.eventParticles) { + particleList.add(new SWListInv.SWListEntry<>(eventParticle.placementParticle.getItem(), eventParticle.placementParticle)); + particleList.add(new SWListInv.SWListEntry<>(eventParticle.participationParticles.getItem(), eventParticle.participationParticles)); + } + } + + SWListInv particleSWListInv = new SWListInv<>(player, "§6Partikel", false, particleList, (clickType, particle) -> lobbyPlayer.setParticle(particle)); particleSWListInv.setItem(49, Material.BARRIER, "§8Keine Partikel", new ArrayList<>(), false, clickType -> { lobbyPlayer.setParticle(null); }); @@ -140,11 +159,18 @@ public class ParticleInventory { return particleSWListInv; } + private static boolean contains(int[] ints, int element) { + for (int i : ints) { + if (i == element) return true; + } + return false; + } + public static void openParticleInventory(Player player) { createInventory(player).open(); } - private static List loreBuilder(String[] attribute, String unlocked) { + public static List loreBuilder(String[] attribute, String unlocked) { List lore = new ArrayList<>(); lore.add(""); if (attribute != null && attribute.length > 0) { From a1b386196d09df1541f3d02763823c21315d473a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 14:17:49 +0200 Subject: [PATCH 2/9] Add two more events --- src/de/steamwar/lobby/inventories/EventParticle.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/lobby/inventories/EventParticle.java b/src/de/steamwar/lobby/inventories/EventParticle.java index 19cbb67..1302528 100644 --- a/src/de/steamwar/lobby/inventories/EventParticle.java +++ b/src/de/steamwar/lobby/inventories/EventParticle.java @@ -21,15 +21,14 @@ package de.steamwar.lobby.inventories; - -import de.steamwar.lobby.particle.CloudParticle; -import de.steamwar.lobby.particle.SimpleParticle; -import de.steamwar.lobby.particle.SpecialParticle; +import de.steamwar.lobby.particle.*; import org.bukkit.Material; 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)), + 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[0], 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(); From d2c6d4d766d3f04fc424bbfd2de418d547008e36 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 15:22:26 +0200 Subject: [PATCH 3/9] Update ParticleInventory --- .../lobby/inventories/ParticleInventory.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index 2fc2c40..63d6dfe 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -20,6 +20,7 @@ package de.steamwar.lobby.inventories; import de.steamwar.inventory.SWInventory; +import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; import de.steamwar.lobby.particle.*; import de.steamwar.lobby.utils.LobbyPlayer; @@ -137,17 +138,25 @@ public class ParticleInventory { particleList = new ArrayList<>(SERVERTEAM_PARTICLES_ENTRIES); } - if (steamwarUser.getTeam() != 0 && !userGroup.isTeamGroup()) { - for (EventParticle eventParticle : EventParticle.eventParticles) { - if (contains(eventParticle.placementTeams, steamwarUser.getTeam())) { - particleList.add(new SWListInv.SWListEntry<>(eventParticle.placementParticle.getItem(), eventParticle.placementParticle)); - } - } - // TODO: Team team = Team.get(steamwarUser.getTeam()); participation fehlt!, wofür 'TeamTeilnahme' im SpigotCore fehlt. - } else if (userGroup.isTeamGroup()) { - for (EventParticle eventParticle : EventParticle.eventParticles) { + for (EventParticle eventParticle : EventParticle.eventParticles) { + boolean clickablePlacement = userGroup.isTeamGroup(); + clickablePlacement |= (steamwarUser.getTeam() != 0 && contains(eventParticle.placementTeams, steamwarUser.getTeam())); + if (clickablePlacement) { particleList.add(new SWListInv.SWListEntry<>(eventParticle.placementParticle.getItem(), eventParticle.placementParticle)); + } else { + SWItem swItem = eventParticle.placementParticle.getItem(); + swItem.setName(swItem.getItemMeta().getDisplayName() + " §8- §c§lGesperrt"); + 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) { particleList.add(new SWListInv.SWListEntry<>(eventParticle.participationParticles.getItem(), eventParticle.participationParticles)); + } else { + SWItem swItem = eventParticle.participationParticles.getItem(); + swItem.setName(swItem.getItemMeta().getDisplayName() + " §8- §c§lGesperrt"); + particleList.add(new SWListInv.SWListEntry<>(swItem, null)); } } From 68a0837f7ce38f02cd62127891715dce57b556ba Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 15:45:51 +0200 Subject: [PATCH 4/9] Update EventParticle --- src/de/steamwar/lobby/inventories/EventParticle.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/lobby/inventories/EventParticle.java b/src/de/steamwar/lobby/inventories/EventParticle.java index 1302528..7911eab 100644 --- a/src/de/steamwar/lobby/inventories/EventParticle.java +++ b/src/de/steamwar/lobby/inventories/EventParticle.java @@ -28,6 +28,7 @@ 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[0], 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)); From ce818d6821e81e04da8b291cf98fd6aad7f46f6e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 17:22:57 +0200 Subject: [PATCH 5/9] Fix ParticleInventory --- src/de/steamwar/lobby/inventories/ParticleInventory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index 63d6dfe..aa451f7 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -160,7 +160,10 @@ public class ParticleInventory { } } - SWListInv particleSWListInv = new SWListInv<>(player, "§6Partikel", false, particleList, (clickType, particle) -> lobbyPlayer.setParticle(particle)); + SWListInv particleSWListInv = new SWListInv<>(player, "§6Partikel", false, particleList, (clickType, particle) -> { + if (particle == null) return; + lobbyPlayer.setParticle(particle); + }); particleSWListInv.setItem(49, Material.BARRIER, "§8Keine Partikel", new ArrayList<>(), false, clickType -> { lobbyPlayer.setParticle(null); }); From 0e4b567746062c98047a9c45f39dfc3ffa5543aa Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 18:06:14 +0200 Subject: [PATCH 6/9] Fix ParticleInventory --- src/de/steamwar/lobby/inventories/EventParticle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/inventories/EventParticle.java b/src/de/steamwar/lobby/inventories/EventParticle.java index 7911eab..e4bf7e6 100644 --- a/src/de/steamwar/lobby/inventories/EventParticle.java +++ b/src/de/steamwar/lobby/inventories/EventParticle.java @@ -30,7 +30,7 @@ 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[0], 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)); + 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)); public static EventParticle[] eventParticles = values(); From 1f79a70cd1a57f7e5d10bc5c0262957e3f569068 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 18:18:26 +0200 Subject: [PATCH 7/9] Fix TeamTeilnahme --- .../steamwar/lobby/inventories/EventParticle.java | 12 ++++++------ .../lobby/inventories/ParticleInventory.java | 15 +++++---------- 2 files changed, 11 insertions(+), 16 deletions(-) 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(); From 6b70d6b2b0776a8a90553e90551f13ea731432ad Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 18:28:40 +0200 Subject: [PATCH 8/9] Fix EventParticle --- src/de/steamwar/lobby/inventories/EventParticle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/inventories/EventParticle.java b/src/de/steamwar/lobby/inventories/EventParticle.java index 01e51f8..63dd9f2 100644 --- a/src/de/steamwar/lobby/inventories/EventParticle.java +++ b/src/de/steamwar/lobby/inventories/EventParticle.java @@ -29,7 +29,7 @@ public enum EventParticle { 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)), + HellsBellsWs(28, new int[]{205, 9, 11}, new CloudCircleParticle(Material.TNT_MINECART, "§7Smoke", ParticleInventory.loreBuilder(new String[]{"Wolke", "Ring"}, "HellsBells Event 1., 2. oder 3. Platz"), Particle.CAMPFIRE_COSY_SMOKE, location -> location.add(0, 2.2, 0)), new CircleParticle(Material.TNT, "§8Smoke", ParticleInventory.loreBuilder(new String[]{"Ring"}, "HellsBells Event"), Particle.CAMPFIRE_COSY_SMOKE, null, location -> location, 0, 0, 0, 0.01)), 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(); From cbd795934107818d3e1522d60c2de52526c8baaa Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Oct 2021 19:12:48 +0200 Subject: [PATCH 9/9] Fix EventParticle --- src/de/steamwar/lobby/inventories/ParticleInventory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index 6d06113..eff8dc3 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -146,7 +146,7 @@ public class ParticleInventory { particleList.add(new SWListInv.SWListEntry<>(swItem, null)); } - if (userGroup.isTeamGroup() || events.contains(eventParticle.event)) { + if (eventParticle.placementTeams.length != 0 && (userGroup.isTeamGroup() || events.contains(eventParticle.event))) { particleList.add(new SWListInv.SWListEntry<>(eventParticle.participationParticles.getItem(), eventParticle.participationParticles)); } else { SWItem swItem = eventParticle.participationParticles.getItem();