diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 9988ce6..3308f32 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -67,26 +67,8 @@ PARTICLE_WATER_FIRE = §bWasser§7/§cFeuer PARTICLE_MAGIC_ENCHANTING = §5Magie§7/§eZauber PARTICLE_WINGS_EVIL = §5Lila Flügel -PARTICLE_UNLOCKED_BY_WGS_PLACEMENT = §fWarGearSeason 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_WGS = §fWarGearSeason -PARTICLE_UNLOCKED_BY_AIRSHIPEVENT_PLACEMENT = §fAirshipEvent 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_AIRSHIPEVENT = §fAirshipEvent -PARTICLE_UNLOCKED_BY_HELLSBELLS_PLACEMENT = §fHellsBells 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_HELLSBELLS = §fHellsBells -PARTICLE_UNLOCKED_BY_UNDERWATER_PLACEMENT = §fUnderwater 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_UNDERWATER = §fUnderwater -PARTICLE_UNLOCKED_BY_ADVENTWARSHIP_PLACEMENT = §fAdvent-WarShip 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_ADVENTWARSHIP = §fAdvent-WarShip -PARTICLE_UNLOCKED_BY_MWGL_PLACEMENT = §fMiniWarGearLiga 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_MWGL = §fMiniWarGearLiga -PARTICLE_UNLOCKED_BY_ABSTURZ_PLACEMENT = §fAbsturz 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_ABSTURZ = §fAbsturz -PARTICLE_UNLOCKED_BY_UNDERWATERMWG_PLACEMENT = §fUnderwaterMWG 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_UNDERWATERMWG = §fUnderwaterMWG -PARTICLE_UNLOCKED_BY_WGS22_PLACEMENT = §fWarGearSeason 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_WGS22 = §fWarGearSeason -PARTICLE_UNLOCKED_BY_WARGEARCLASH_PLACEMENT = §fWargearClash 1., 2. oder 3. Platz -PARTICLE_UNLOCKED_BY_WARGEARCLASH = §fWargearClash +PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. oder 3. Platz +PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION = §f{0} PARTICLE_EVENT_ENCHANTING = §cVerzaubert PARTICLE_EVENT_CLOUD = §fWolken diff --git a/src/de/steamwar/lobby/particle/EventParticleItem.java b/src/de/steamwar/lobby/particle/EventParticleItem.java new file mode 100644 index 0000000..2c679b9 --- /dev/null +++ b/src/de/steamwar/lobby/particle/EventParticleItem.java @@ -0,0 +1,74 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.particle; + +import de.steamwar.inventory.SWItem; +import de.steamwar.lobby.LobbySystem; +import de.steamwar.sql.Event; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; + +public class EventParticleItem extends ParticleItem { + + public static EventParticleItem participation(Material material, String name, int eventId) { + return new EventParticleItem(material, name, "PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION", eventId); + } + + public static EventParticleItem placement(Material material, String name, int eventId) { + return new EventParticleItem(material, name, "PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT", eventId); + } + + private final String eventName; + + public EventParticleItem(Material material, String name, int eventId) { + this(material, name, null, eventId); + } + + public EventParticleItem(Material material, String name, String unlockedBy, int eventId) { + super(material, name, unlockedBy); + eventName = Event.get(eventId).getEventName(); + } + + public EventParticleItem addAttribute(String attribute) { + super.addAttribute(attribute); + return this; + } + + public SWItem toSWItem(Player player) { + String translatedName = LobbySystem.getMessage().parse(name, player); + List lore = new ArrayList<>(); + lore.add(""); + if (!attributes.isEmpty()) { + lore.add(LobbySystem.getMessage().parse("PARTICLE_ATTRIBUTE", player)); + attributes.forEach(attribute -> lore.add(LobbySystem.getMessage().parse(attribute, player))); + lore.add(""); + } + if (unlockedBy != null) { + lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player)); + lore.add(LobbySystem.getMessage().parse(unlockedBy, player, eventName)); + lore.add(""); + } + lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player)); + return new SWItem(material, translatedName, lore, false, clickType -> {}); + } +} diff --git a/src/de/steamwar/lobby/particle/ParticleItem.java b/src/de/steamwar/lobby/particle/ParticleItem.java index e6638d1..50744d9 100644 --- a/src/de/steamwar/lobby/particle/ParticleItem.java +++ b/src/de/steamwar/lobby/particle/ParticleItem.java @@ -33,10 +33,10 @@ import java.util.Set; @RequiredArgsConstructor public class ParticleItem { - private final Material material; - private final String name; - private final Set attributes = new LinkedHashSet<>(); - private String unlockedBy; + protected final Material material; + protected final String name; + protected final Set attributes = new LinkedHashSet<>(); + protected String unlockedBy; public ParticleItem(Material material, String name, String unlockedBy) { this.material = material; diff --git a/src/de/steamwar/lobby/particle/particles/EventParticleParticipation.java b/src/de/steamwar/lobby/particle/particles/EventParticleParticipation.java index 925c357..83689ac 100644 --- a/src/de/steamwar/lobby/particle/particles/EventParticleParticipation.java +++ b/src/de/steamwar/lobby/particle/particles/EventParticleParticipation.java @@ -20,6 +20,7 @@ package de.steamwar.lobby.particle.particles; import de.steamwar.lobby.particle.BaseParticle; +import de.steamwar.lobby.particle.EventParticleItem; import de.steamwar.lobby.particle.ParticleItem; import de.steamwar.lobby.particle.SimpleParticle; import de.steamwar.lobby.particle.decorator.CircleParticle; @@ -37,15 +38,15 @@ import static org.bukkit.Material.*; @Getter public enum EventParticleParticipation implements ParticleEnum { - WarGearSeason(22, new SimpleParticle(new ParticleItem(BOOK, "PARTICLE_EVENT_ENCHANTING", "PARTICLE_UNLOCKED_BY_WGS"), Particle.ENCHANTMENT_TABLE)), - AirshipEvent(26, new SimpleParticle(new ParticleItem(SNOW_BLOCK, "PARTICLE_EVENT_CLOUD", "PARTICLE_UNLOCKED_BY_AIRSHIPEVENT"), Particle.CLOUD)), - HellsBellsWs(28, new CircleParticle(new SimpleParticle(new ParticleItem(TNT, "PARTICLE_EVENT_SMOKE", "PARTICLE_UNLOCKED_BY_HELLSBELLS"), Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01))), - Underwater(31, new SimpleParticle(new ParticleItem(PRISMARINE_BRICKS, "PARTICLE_EVENT_WATER", "PARTICLE_UNLOCKED_BY_UNDERWATER"), Particle.DRIP_WATER)), - AdventWarShip(32, new ParticleGroup(new ParticleItem(PRISMARINE_WALL, "PARTICLE_EVENT_WATER", "PARTICLE_UNLOCKED_BY_ADVENTWARSHIP_PLACEMENT"), new SimpleParticle(null, Particle.DRIP_WATER), new SimpleParticle(null, Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))), - MiniWarGearLiga(33, new CircleParticle(new SimpleParticle(new ParticleItem(PRISMARINE_SLAB, "PARTICLE_EVENT_WATER", "PARTICLE_UNLOCKED_BY_MWGL"), Particle.WATER_WAKE, 0, 0, 0, 0))), + WarGearSeason(22, new SimpleParticle(EventParticleItem.participation(BOOK, "PARTICLE_EVENT_ENCHANTING", 22), Particle.ENCHANTMENT_TABLE)), + AirshipEvent(26, new SimpleParticle(EventParticleItem.participation(SNOW_BLOCK, "PARTICLE_EVENT_CLOUD", 26), Particle.CLOUD)), + HellsBellsWs(28, new CircleParticle(new SimpleParticle(EventParticleItem.participation(TNT, "PARTICLE_EVENT_SMOKE", 28), Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01))), + Underwater(31, new SimpleParticle(EventParticleItem.participation(PRISMARINE_BRICKS, "PARTICLE_EVENT_WATER", 31), Particle.DRIP_WATER)), + AdventWarShip(32, new ParticleGroup(EventParticleItem.participation(PRISMARINE_WALL, "PARTICLE_EVENT_WATER", 32), new SimpleParticle(null, Particle.DRIP_WATER), new SimpleParticle(null, Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))), + MiniWarGearLiga(33, new CircleParticle(new SimpleParticle(EventParticleItem.participation(PRISMARINE_SLAB, "PARTICLE_EVENT_WATER", 33), Particle.WATER_WAKE, 0, 0, 0, 0))), // Absturz(34, null), - UnderwaterMWG(35, new TickParticle(new LocationParticleMutator(new ParticleGroup(new ParticleItem(BLUE_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", "PARTICLE_UNLOCKED_BY_UNDERWATERMWG"), new SimpleParticle(null, Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new SimpleParticle(null, Particle.WATER_WAKE, 0.3F, 0.1F, 0.3F, 0.01), new LocationParticleMutator(new SimpleParticle(null, Particle.DRIP_WATER, 0.3F, 0.0F, 0.3F, 0.01), location -> location.subtract(0, 0.2, 0))), location -> location.add(0, 2.2, 0)))), - WarGearSeason2022(37, new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(DIAMOND_SWORD, "PARTICLE_EVENT_WINGS", "PARTICLE_UNLOCKED_BY_WGS22"), Particle.DRAGON_BREATH, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.COMPLEX))), + UnderwaterMWG(35, new TickParticle(new LocationParticleMutator(new ParticleGroup(EventParticleItem.participation(BLUE_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", 35), new SimpleParticle(null, Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new SimpleParticle(null, Particle.WATER_WAKE, 0.3F, 0.1F, 0.3F, 0.01), new LocationParticleMutator(new SimpleParticle(null, Particle.DRIP_WATER, 0.3F, 0.0F, 0.3F, 0.01), location -> location.subtract(0, 0.2, 0))), location -> location.add(0, 2.2, 0)))), + WarGearSeason2022(37, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.participation(DIAMOND_SWORD, "PARTICLE_EVENT_WINGS", 37), Particle.DRAGON_BREATH, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.COMPLEX))), // WargearClash(38, null), ; public static EventParticleParticipation[] particles = values(); diff --git a/src/de/steamwar/lobby/particle/particles/EventParticlePlacement.java b/src/de/steamwar/lobby/particle/particles/EventParticlePlacement.java index 73e934c..662db20 100644 --- a/src/de/steamwar/lobby/particle/particles/EventParticlePlacement.java +++ b/src/de/steamwar/lobby/particle/particles/EventParticlePlacement.java @@ -20,7 +20,7 @@ package de.steamwar.lobby.particle.particles; import de.steamwar.lobby.particle.BaseParticle; -import de.steamwar.lobby.particle.ParticleItem; +import de.steamwar.lobby.particle.EventParticleItem; import de.steamwar.lobby.particle.SimpleParticle; import de.steamwar.lobby.particle.decorator.CircleParticle; import de.steamwar.lobby.particle.decorator.CloudParticle; @@ -38,16 +38,16 @@ import static org.bukkit.Material.*; @Getter public enum EventParticlePlacement implements ParticleEnum { - WarGearSeason(22, new int[]{12, 285, 54}, new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(ENCHANTING_TABLE, "PARTICLE_EVENT_ENCHANTING", "PARTICLE_UNLOCKED_BY_WGS_PLACEMENT"), Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), location -> location.add(0, 1.1, 0))))), - AirshipEvent(26, new int[]{205, 9, 54, 120, 292}, new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(SNOWBALL, "PARTICLE_EVENT_CLOUD", "PARTICLE_UNLOCKED_BY_AIRSHIPEVENT_PLACEMENT"), Particle.CLOUD, 0, 0, 0, 0.01), location -> location.add(0, 2.2, 0)))), - HellsBellsWs(28, new int[]{205, 9, 11}, new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(TNT_MINECART, "PARTICLE_EVENT_SMOKE", "PARTICLE_UNLOCKED_BY_HELLSBELLS_PLACEMENT"), Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01), location -> location.add(0, 2.2, 0))))), - Underwater(31, new int[]{9, 210, 520}, new CloudParticle(new SimpleParticle(new ParticleItem(PRISMARINE_SHARD, "PARTICLE_EVENT_WATER", "PARTICLE_UNLOCKED_BY_UNDERWATER_PLACEMENT"), Particle.DRIP_WATER))), - AdventWarShip(32, new int[]{9, 205, 210}, new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleGroup(new ParticleItem(PRISMARINE_CRYSTALS, "PARTICLE_EVENT_WATER", "PARTICLE_UNLOCKED_BY_ADVENTWARSHIP"), new SimpleParticle(null, Particle.DRIP_WATER), new SimpleParticle(null, Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))), location -> location.add(0, 1.1, 0)))), - MiniWarGearLiga(33, new int[]{9, 34, 205}, new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(IRON_SWORD, "PARTICLE_EVENT_WINGS", "PARTICLE_UNLOCKED_BY_MWGL_PLACEMENT"), Particle.WATER_WAKE, 0, 0, 0, 0, 1), 0.05, WingParticle.WingDesign.SWORD))), - Absturz(34, new int[]{210, 205, 527, 286}, new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(FEATHER, "PARTICLE_EVENT_WINGS", "PARTICLE_UNLOCKED_BY_ABSTURZ_PLACEMENT"), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SIMPLE))), - UnderwaterMWG(35, new int[]{9, 210}, new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(CYAN_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", "PARTICLE_UNLOCKED_BY_UNDERWATERMWG_PLACEMENT"), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SW))), - WarGearSeason2022(37, new int[]{}, new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(DIAMOND_HELMET, "PARTICLE_EVENT_WGS", "PARTICLE_UNLOCKED_BY_WGS22_PLACEMENT"), Particle.FIREWORKS_SPARK, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.WGS))), - WargearClash(38, new int[]{210, 158, 167, 286}, new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(GOLDEN_SWORD, "PARTICLE_EVENT_WARGEARCLASH", "PARTICLE_UNLOCKED_BY_WARGEARCLASH_PLACEMENT"), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.1, WingParticle.WingDesign.SWORD_CROSSED))), + WarGearSeason(22, new int[]{12, 285, 54}, new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(ENCHANTING_TABLE, "PARTICLE_EVENT_ENCHANTING", 22), Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), location -> location.add(0, 1.1, 0))))), + AirshipEvent(26, new int[]{205, 9, 54, 120, 292}, new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(SNOWBALL, "PARTICLE_EVENT_CLOUD", 26), Particle.CLOUD, 0, 0, 0, 0.01), location -> location.add(0, 2.2, 0)))), + HellsBellsWs(28, new int[]{205, 9, 11}, new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(TNT_MINECART, "PARTICLE_EVENT_SMOKE", 28), Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01), location -> location.add(0, 2.2, 0))))), + Underwater(31, new int[]{9, 210, 520}, new CloudParticle(new SimpleParticle(EventParticleItem.placement(PRISMARINE_SHARD, "PARTICLE_EVENT_WATER", 31), Particle.DRIP_WATER))), + AdventWarShip(32, new int[]{9, 205, 210}, new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleGroup(EventParticleItem.placement(PRISMARINE_CRYSTALS, "PARTICLE_EVENT_WATER", 32), new SimpleParticle(null, Particle.DRIP_WATER), new SimpleParticle(null, Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))), location -> location.add(0, 1.1, 0)))), + MiniWarGearLiga(33, new int[]{9, 34, 205}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(IRON_SWORD, "PARTICLE_EVENT_WINGS", 33), Particle.WATER_WAKE, 0, 0, 0, 0, 1), 0.05, WingParticle.WingDesign.SWORD))), + Absturz(34, new int[]{210, 205, 527, 286}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(FEATHER, "PARTICLE_EVENT_WINGS", 34), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SIMPLE))), + UnderwaterMWG(35, new int[]{9, 210}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(CYAN_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", 35), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SW))), + WarGearSeason2022(37, new int[]{}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(DIAMOND_HELMET, "PARTICLE_EVENT_WGS", 37), Particle.FIREWORKS_SPARK, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.WGS))), + WargearClash(38, new int[]{210, 158, 167, 286}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(GOLDEN_SWORD, "PARTICLE_EVENT_WARGEARCLASH", 38), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.1, WingParticle.WingDesign.SWORD_CROSSED))), ; public static EventParticlePlacement[] particles = values();