diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index e4236b8..4b3918e 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -18,7 +18,6 @@ PORTAL_NO_WORLDEDIT_SELECTION = §cNo WorldEdit selection # Particle PARTICLE_INVENTORY = §6Particle PARTICLE_DESELECT = §8No particle -PARTICLE_LOCKED = {0} §8- §c§lLocked PARTICLE_UNLOCKED_BY = §eUnlocked by PARTICLE_UNLOCKED_BY_TEAM = §fJoin a team @@ -40,6 +39,7 @@ PARTICLE_ATTRIBUTE_WING = §8-§f Wings PARTICLE_ATTRIBUTE = §eAttributes§7: PARTICLE_SELECT = §eClick to select +PARTICLE_LOCKED = §c§lLocked PARTICLE_SNEEZE = §aSneeze PARTICLE_SMOKE = §7Smoke diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index 357a0af..a28262e 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -18,7 +18,6 @@ PORTAL_NO_WORLDEDIT_SELECTION = §cKeine WorldEdit Selection # Particle PARTICLE_INVENTORY = §6Partikel PARTICLE_DESELECT = §8Keine Partikel -PARTICLE_LOCKED = {0} §8- §c§lGesperrt PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch PARTICLE_UNLOCKED_BY_TEAM = §fTeambeitritt @@ -40,6 +39,7 @@ PARTICLE_ATTRIBUTE_WING = §8-§f Flügel PARTICLE_ATTRIBUTE = §eAttribute§7: PARTICLE_SELECT = §eZum Auswählen klicken +PARTICLE_LOCKED = §c§lGesperrt PARTICLE_SNEEZE = §aSneeze PARTICLE_SMOKE = §7Rauch diff --git a/src/de/steamwar/lobby/otherparticle/ParticleData.java b/src/de/steamwar/lobby/otherparticle/ParticleData.java index b443250..8a70c08 100644 --- a/src/de/steamwar/lobby/otherparticle/ParticleData.java +++ b/src/de/steamwar/lobby/otherparticle/ParticleData.java @@ -2,6 +2,9 @@ package de.steamwar.lobby.otherparticle; import de.steamwar.inventory.SWItem; import de.steamwar.lobby.LobbySystem; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.UserGroup; +import lombok.Getter; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -15,7 +18,11 @@ public class ParticleData { private final Material material; private final String name; private final Set attributes = new LinkedHashSet<>(); + + @Getter private final ParticleRequirement requirement; + + @Getter private final ParticleElement particleElement; public ParticleData(Material material, String name, ParticleElement particleElement) { @@ -23,6 +30,7 @@ public class ParticleData { this.name = name; this.requirement = ParticleRequirement.NO_REQUIRMENT; this.particleElement = particleElement; + particleElement.aggregateAttributes(this); } public ParticleData(Material material, String name, ParticleRequirement requirement, ParticleElement particleElement) { @@ -30,6 +38,7 @@ public class ParticleData { this.name = name; this.requirement = requirement; this.particleElement = particleElement; + particleElement.aggregateAttributes(this); } public ParticleData add(String attribute) { @@ -37,7 +46,7 @@ public class ParticleData { return this; } - public SWItem toSWItem(Player player) { + public SWItem toSWItem(Player player, SteamwarUser user, Set eventTeilnahme, String eggHuntConfig) { String translatedName = LobbySystem.getMessage().parse(name, player); List lore = new ArrayList<>(); lore.add(""); @@ -46,13 +55,21 @@ public class ParticleData { attributes.forEach(attribute -> lore.add(LobbySystem.getMessage().parse(attribute, player))); lore.add(""); } + + boolean selectable = requirement.getRequirement().test(user, eventTeilnahme, eggHuntConfig); + selectable |= user.getUserGroup() != UserGroup.Member; + String unlockedBy = requirement.getRequirementName(player); if (unlockedBy != null) { lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player)); lore.add(unlockedBy); lore.add(""); } - lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player)); + if (selectable) { + lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player)); + } else { + lore.add(LobbySystem.getMessage().parse("PARTICLE_LOCKED", player)); + } return new SWItem(material, translatedName, lore, false, clickType -> {}); } } diff --git a/src/de/steamwar/lobby/otherparticle/ParticleInventory.java b/src/de/steamwar/lobby/otherparticle/ParticleInventory.java new file mode 100644 index 0000000..252a140 --- /dev/null +++ b/src/de/steamwar/lobby/otherparticle/ParticleInventory.java @@ -0,0 +1,97 @@ +package de.steamwar.lobby.otherparticle; + +import de.steamwar.inventory.SWItem; +import de.steamwar.inventory.SWListInv; +import de.steamwar.lobby.LobbySystem; +import de.steamwar.lobby.otherparticle.particles.*; +import de.steamwar.lobby.otherparticle.particles.custom.CustomEasterParticle; +import de.steamwar.lobby.otherparticle.particles.custom.CustomPlayerParticle; +import de.steamwar.lobby.otherparticle.particles.custom.CustomTeamParticle; +import de.steamwar.lobby.special.easter.EggHunt; +import de.steamwar.lobby.util.LobbyPlayer; +import de.steamwar.sql.*; +import lombok.experimental.UtilityClass; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +@UtilityClass +public class ParticleInventory { + + private final Class[] PARTICLES = { + PlayerParticle.class, + CustomPlayerParticle.class, + TeamParticle.class, + CustomTeamParticle.class, + ServerTeamParticle.class, + EventParticle.class, + EventParticlePlacement.class, + EventParticleParticipation.class, + EasterParticle.class, + CustomEasterParticle.class, + }; + + public String convertToString(ParticleEnum particleEnum) { + return particleEnum.getClass().getSimpleName() + "@" + ((Enum)particleEnum).name(); + } + + public ParticleEnum convertFromString(String string) { + String[] split = string.split("@"); + Class clazz = null; + for (Class aClass : PARTICLES) { + if (aClass.getSimpleName().equals(split[0])) { + clazz = aClass; + break; + } + } + if (clazz != null) { + try { + return (ParticleEnum) Enum.valueOf((Class) clazz, split[1]); + } catch (Exception e) { + return null; + } + } + // TODO: Add conversion from last version + return null; + } + + public void openInventory(Player player) { + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Set events = user.getTeam() == 0 ? new HashSet<>() : TeamTeilnahme.getEvents(user.getTeam()).stream().map(Event::getEventID).collect(Collectors.toSet()); + String eggHuntConfig = UserConfig.getConfig(user.getId(), EggHunt.EGG_HUNT_CONFIG_KEY); + + List> particleList = new ArrayList<>(); + for (Class clazz : PARTICLES) { + addParticles(particleList, (ParticleEnum[]) clazz.getEnumConstants(), player, user, events, eggHuntConfig); + } + + SWListInv particleSWListInv = new SWListInv<>(player, LobbySystem.getMessage().parse("PARTICLE_INVENTORY", player), false, particleList, (clickType, particle) -> { + if (particle == null) return; + // lobbyPlayer.setParticle(particle); // TODO: Update this + player.closeInventory(); + }); + particleSWListInv.setItem(49, Material.BARRIER, LobbySystem.getMessage().parse("PARTICLE_DESELECT", player), new ArrayList<>(), false, clickType -> { + lobbyPlayer.setParticle(null); + }); + particleSWListInv.open(); + } + + private void addParticles(List> particleList, ParticleEnum[] particleEnums, Player player, SteamwarUser user, Set events, String eggHuntConfig) { + for (ParticleEnum particle : particleEnums) { + ParticleData particleData = particle.getParticle(); + SWItem swItem = particleData.toSWItem(player, user, events, eggHuntConfig); + if (particleData.getRequirement().test(user, events, eggHuntConfig) || user.getUserGroup() != UserGroup.Member) { + particleList.add(new SWListInv.SWListEntry<>(swItem, particle)); + } else { + particleList.add(new SWListInv.SWListEntry<>(swItem, null)); + } + } + } +} diff --git a/src/de/steamwar/lobby/otherparticle/ParticleRequirement.java b/src/de/steamwar/lobby/otherparticle/ParticleRequirement.java index b911693..71f404d 100644 --- a/src/de/steamwar/lobby/otherparticle/ParticleRequirement.java +++ b/src/de/steamwar/lobby/otherparticle/ParticleRequirement.java @@ -6,7 +6,6 @@ import de.steamwar.lobby.special.easter.EggHunt; import de.steamwar.sql.Event; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.Team; -import de.steamwar.sql.UserGroup; import org.bukkit.entity.Player; import java.util.HashSet; @@ -19,7 +18,7 @@ import java.util.stream.Collectors; public interface ParticleRequirement { String getRequirementName(Player player); - ParticleRequirementPredicate getRequirement(); + boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig); ParticleRequirement NO_REQUIRMENT = new ParticleRequirement() { @Override @@ -28,8 +27,8 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (player, eventTeilname, eggHuntConfig) -> true; + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + return true; } }; ParticleRequirement HAS_TEAM = new ParticleRequirement() { @@ -39,8 +38,8 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (steamwarUser, eventTeilname, eggHuntConfig) -> steamwarUser.getTeam() != 0 || steamwarUser.getUserGroup() != UserGroup.Member; + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + return user.getTeam() != 0; } }; ParticleRequirement EVENT_PARTICIPATION = new ParticleRequirement() { @@ -50,8 +49,8 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (steamwarUser, eventTeilname, eggHuntConfig) -> !eventTeilname.isEmpty(); + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + return !eventTeilname.isEmpty(); } }; ParticleRequirement SERVER_TEAM = new ParticleRequirement() { @@ -61,8 +60,8 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (steamwarUser, eventTeilname, eggHuntConfig) -> false; + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + return false; } }; ParticleRequirement EGG_HUNT_EASY = _easterEggHuntDifficulty(EggDifficulty.EASY); @@ -77,17 +76,15 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (user, eventTeilname, eggHuntConfig) -> { - if (eggHuntConfig == null) return false; - int count = 0; - for (int i = 0; i < eggHuntConfig.length(); i++) { - if (eggHuntConfig.charAt(i) == '1') { - count++; - } + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + if (eggHuntConfig == null) return false; + int count = 0; + for (int i = 0; i < eggHuntConfig.length(); i++) { + if (eggHuntConfig.charAt(i) == '1') { + count++; } - return count >= EggHunt.getEggList().size() / 2; - }; + } + return count >= EggHunt.getEggList().size() / 2; } }; @@ -101,8 +98,8 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (steamwarUser, eventTeilname, eggHuntConfig) -> steamwarUser.getTeam() == teamId; + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + return user.getTeam() == teamId; } }; } @@ -116,8 +113,8 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (steamwarUser, eventTeilname, eggHuntConfig) -> eventTeilname.contains(eventId); + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + return eventTeilname.contains(eventId); } }; } @@ -133,11 +130,9 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (steamwarUser, eventTeilname, eggHuntConfig) -> { - if (!eventTeilname.contains(eventId)) return false; - return teams.contains(steamwarUser.getTeam()); - }; + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + if (!eventTeilname.contains(eventId)) return false; + return teams.contains(user.getTeam()); } }; } @@ -164,11 +159,9 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (steamwarUser, integers, eggHuntConfig) -> { - if (eggHuntConfig == null) return false; - return eggs.stream().allMatch(id -> eggHuntConfig.length() >= id && eggHuntConfig.charAt(id) == '1'); - }; + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + if (eggHuntConfig == null) return false; + return eggs.stream().allMatch(id -> eggHuntConfig.length() >= id && eggHuntConfig.charAt(id) == '1'); } }; } @@ -182,8 +175,8 @@ public interface ParticleRequirement { } @Override - public ParticleRequirementPredicate getRequirement() { - return (steamwarUser, integers, eggHuntConfig) -> steamwarUser.getId() == userId; + public boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig) { + return user.getId() == userId; } }; } diff --git a/src/de/steamwar/lobby/otherparticle/elements/SimpleParticle.java b/src/de/steamwar/lobby/otherparticle/elements/SimpleParticle.java index 27164a2..d8e1204 100644 --- a/src/de/steamwar/lobby/otherparticle/elements/SimpleParticle.java +++ b/src/de/steamwar/lobby/otherparticle/elements/SimpleParticle.java @@ -12,7 +12,7 @@ public class SimpleParticle implements ParticleElement { private float vx; private float vy; private float vz; - private double time = 0.01; + private double time = 1; private int count = 5; public SimpleParticle(Particle particle) { diff --git a/src/de/steamwar/lobby/otherparticle/particles/EasterParticle.java b/src/de/steamwar/lobby/otherparticle/particles/EasterParticle.java index c5291e7..6ea1ca4 100644 --- a/src/de/steamwar/lobby/otherparticle/particles/EasterParticle.java +++ b/src/de/steamwar/lobby/otherparticle/particles/EasterParticle.java @@ -3,6 +3,7 @@ package de.steamwar.lobby.otherparticle.particles; import de.steamwar.lobby.otherparticle.ParticleData; import de.steamwar.lobby.otherparticle.ParticleEnum; import de.steamwar.lobby.otherparticle.ParticleRequirement; +import de.steamwar.lobby.otherparticle.elements.Always; import de.steamwar.lobby.otherparticle.elements.LocationMutator; import de.steamwar.lobby.otherparticle.elements.SimpleParticle; import lombok.AllArgsConstructor; @@ -14,7 +15,7 @@ import org.bukkit.Particle; public enum EasterParticle implements ParticleEnum { EGG_HUNT_EASY(new ParticleData(Material.LIME_CONCRETE_POWDER, "PARTICLE_EGG_HUNT_EASY", ParticleRequirement.EGG_HUNT_EASY, - new LocationMutator(new SimpleParticle(Particle.FALLING_SPORE_BLOSSOM), 0, 2.2, 0)) + new Always(new LocationMutator(new SimpleParticle(Particle.FALLING_SPORE_BLOSSOM, 0.2F, 0.1f, 0.2F, 1, 5), 0, 2.2, 0))) ), EGG_HUNT_MEDIUM(new ParticleData(Material.YELLOW_CONCRETE_POWDER, "PARTICLE_EGG_HUNT_MEDIUM", ParticleRequirement.EGG_HUNT_MEDIUM, new SimpleParticle(Particle.FALLING_SPORE_BLOSSOM)) diff --git a/src/de/steamwar/lobby/otherparticle/particles/ServerTeamParticle.java b/src/de/steamwar/lobby/otherparticle/particles/ServerTeamParticle.java new file mode 100644 index 0000000..ada98bf --- /dev/null +++ b/src/de/steamwar/lobby/otherparticle/particles/ServerTeamParticle.java @@ -0,0 +1,99 @@ +package de.steamwar.lobby.otherparticle.particles; + +import de.steamwar.lobby.otherparticle.ParticleData; +import de.steamwar.lobby.otherparticle.ParticleEnum; +import de.steamwar.lobby.otherparticle.ParticleRequirement; +import de.steamwar.lobby.otherparticle.WingDesign; +import de.steamwar.lobby.otherparticle.elements.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.bukkit.Material; +import org.bukkit.Particle; + +@AllArgsConstructor +public enum ServerTeamParticle implements ParticleEnum { + + WITCH(new ParticleData(Material.EXPERIENCE_BOTTLE, "PARTICLE_WITCH", ParticleRequirement.SERVER_TEAM, + new SimpleParticle(Particle.SPELL_WITCH)) + ), + ENCHANTING(new ParticleData(Material.ENCHANTING_TABLE, "PARTICLE_ENCHANTING", ParticleRequirement.SERVER_TEAM, + new SimpleParticle(Particle.ENCHANTMENT_TABLE)) + ), + HAPPY(new ParticleData(Material.EMERALD_BLOCK, "PARTICLE_HAPPY", ParticleRequirement.SERVER_TEAM, + new SimpleParticle(Particle.HEART, 0.2F, 0.2F, 0.2F, 0.01)) + ), + FLAME(new ParticleData(Material.FLINT_AND_STEEL, "PARTICLE_FLAME", ParticleRequirement.SERVER_TEAM, + new SimpleParticle(Particle.FLAME, 0, 0.2F, 0, 0.01)) + ), + END_ROD(new ParticleData(Material.END_ROD, "PARTICLE_END_ROD", ParticleRequirement.SERVER_TEAM, + new SimpleParticle(Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01)) + ), + CLOUD(new ParticleData(Material.WHITE_WOOL, "PARTICLE_CLOUD", ParticleRequirement.SERVER_TEAM, + new Cloud(new SimpleParticle(Particle.CLOUD))) + ), + TOTEM(new ParticleData(Material.TOTEM_OF_UNDYING, "PARTICLE_TOTEM", ParticleRequirement.SERVER_TEAM, + new Cloud(new SimpleParticle(Particle.TOTEM, 0.2F, 0.2F, 0.2F, 0.01))) + ), + ENCHANTING_CLOUD(new ParticleData(Material.WHITE_DYE, "PARTICLE_ENCHANTING", ParticleRequirement.SERVER_TEAM, + new Cloud(new SimpleParticle(Particle.ENCHANTMENT_TABLE))) + ), + FLAME_CLOUD(new ParticleData(Material.FIRE_CORAL_BLOCK, "PARTICLE_FLAME", ParticleRequirement.SERVER_TEAM, + new Cloud(new SimpleParticle(Particle.FLAME))) + ), + SNEEZE_CLOUD(new ParticleData(Material.LIME_SHULKER_BOX, "PARTICLE_SNEEZE", ParticleRequirement.SERVER_TEAM, + new Cloud(new SimpleParticle(Particle.SNEEZE))) + ), + SLIME_CLOUD(new ParticleData(Material.GREEN_SHULKER_BOX, "PARTICLE_SLIME", ParticleRequirement.SERVER_TEAM, + new Cloud(new SimpleParticle(Particle.SLIME))) + ), + SMOKE_CLOUD(new ParticleData(Material.DEAD_BRAIN_CORAL_BLOCK, "PARTICLE_SMOKE", ParticleRequirement.SERVER_TEAM, + new Cloud(new SimpleParticle(Particle.CAMPFIRE_COSY_SMOKE, 0.2F, 0.2F, 0.2F, 0.01))) + ), + TOWN_CLOUD(new ParticleData(Material.FIREWORK_STAR, "PARTICLE_TOWN", ParticleRequirement.SERVER_TEAM, + new Cloud(new SimpleParticle(Particle.TOWN_AURA))) + ), + FLAME_CIRCLE(new ParticleData(Material.MAGMA_BLOCK, "PARTICLE_FLAME", ParticleRequirement.SERVER_TEAM, + new Circle(new LocationMutator(new SimpleParticle(Particle.FLAME, 0, 0, 0, 0.01), 0, 1.1, 0))) + ), + ENCHANTING_CIRCLE(new ParticleData(Material.WHITE_DYE, "PARTICLE_ENCHANTING_CIRCLE", ParticleRequirement.SERVER_TEAM, + new Circle(new LocationMutator(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0.2F, 0.2F, 0.2F, 0.01), 0, 1.1, 0))) + ), + NOTES_CIRCLE(new ParticleData(Material.NOTE_BLOCK, "PARTICLE_NOTES", ParticleRequirement.SERVER_TEAM, + new Circle(new LocationMutator(new SimpleParticle(Particle.NOTE, 0, 0, 0, 0.01), 0, 2.2, 0))) + ), + WATER_FIRE(new ParticleData(Material.GUARDIAN_SPAWN_EGG, "PARTICLE_WATER_FIRE", ParticleRequirement.SERVER_TEAM, + new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.DRIP_WATER, 0, 0, 0, 0.01), new SimpleParticle(Particle.DRIP_LAVA, 0, 0, 0, 0.01)), 0, 1.1, 0)) + ), + WATER_FIRE_ALWAYS(new ParticleData(Material.GUARDIAN_SPAWN_EGG, "PARTICLE_WATER_FIRE", ParticleRequirement.SERVER_TEAM, + new Always(new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.DRIP_WATER, 0, 0, 0, 0.01), new SimpleParticle(Particle.DRIP_LAVA, 0, 0, 0, 0.01)), 0, 1.1, 0))) + ), + MAGIC_ENCHANTING(new ParticleData(Material.DIAMOND_SWORD, "PARTICLE_MAGIC_ENCHANTING", ParticleRequirement.SERVER_TEAM, + new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01), new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01)), 0, 1.1, 0)) + ), + MAGIC_ENCHANTING_ALWAYS(new ParticleData(Material.WOODEN_SWORD, "PARTICLE_MAGIC_ENCHANTING", ParticleRequirement.SERVER_TEAM, + new Always(new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01), new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01)), 0, 1.1, 0))) + ), + MAGIC_CLOUD_CIRCLE(new ParticleData(Material.GLOWSTONE_DUST, "PARTICLE_MAGIC", ParticleRequirement.SERVER_TEAM, + new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01), 0, 1.1, 0)))) + ), + FLAME_CLOUD_CIRCLE(new ParticleData(Material.FIRE_CORAL, "PARTICLE_FLAME", ParticleRequirement.SERVER_TEAM, + new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.FLAME, 0, 0, 0, 0.01), 0, 1.1, 0)))) + ), + FIREWORK_CLOUD_CIRCLE(new ParticleData(Material.FIREWORK_ROCKET, "PARTICLE_FIREWORK", ParticleRequirement.SERVER_TEAM, + new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.FIREWORKS_SPARK, 0, 0, 0, 0.01), 0, 1.1, 0)))) + ), + WATER_CLOUD_CIRCLE(new ParticleData(Material.CYAN_DYE, "PARTICLE_WATER_FIRE", ParticleRequirement.SERVER_TEAM, + new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.WATER_WAKE, 0, 0, 0, 0.01), 0, 1.1, 0)))) + ), + ENCHANTING_DOUBLE_CIRCLE(new ParticleData(Material.BUBBLE_CORAL_BLOCK, "PARTICLE_ENCHANTING", ParticleRequirement.SERVER_TEAM, + new Always(new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01)), 0, 2.2, 0))) + ), + EVIL_WINGS(new ParticleData(Material.PURPUR_SLAB, "PARTICLE_WINGS_EVIL", ParticleRequirement.SERVER_TEAM, + new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.SPELL_WITCH, 0, 0, 0, 0, 1), 0.15, WingDesign.SIMPLE)), 20))) + ), + ; + public static ParticleEnum[] particles = values(); + + @Getter + private ParticleData particle; +} diff --git a/src/de/steamwar/lobby/otherparticle/particles/custom/CustomEasterParticle.java b/src/de/steamwar/lobby/otherparticle/particles/custom/CustomEasterParticle.java index 6b086ea..274b7db 100644 --- a/src/de/steamwar/lobby/otherparticle/particles/custom/CustomEasterParticle.java +++ b/src/de/steamwar/lobby/otherparticle/particles/custom/CustomEasterParticle.java @@ -1,4 +1,16 @@ package de.steamwar.lobby.otherparticle.particles.custom; -public enum CustomEasterParticle { +import de.steamwar.lobby.otherparticle.ParticleData; +import de.steamwar.lobby.otherparticle.ParticleEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +public enum CustomEasterParticle implements ParticleEnum { + + ; + public static ParticleEnum[] particles = values(); + + @Getter + private ParticleData particle; } diff --git a/src/de/steamwar/lobby/otherparticle/particles/custom/CustomPlayerParticle.java b/src/de/steamwar/lobby/otherparticle/particles/custom/CustomPlayerParticle.java new file mode 100644 index 0000000..29cc9a5 --- /dev/null +++ b/src/de/steamwar/lobby/otherparticle/particles/custom/CustomPlayerParticle.java @@ -0,0 +1,16 @@ +package de.steamwar.lobby.otherparticle.particles.custom; + +import de.steamwar.lobby.otherparticle.ParticleData; +import de.steamwar.lobby.otherparticle.ParticleEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +public enum CustomPlayerParticle implements ParticleEnum { + + ; + public static ParticleEnum[] particles = values(); + + @Getter + private ParticleData particle; +} diff --git a/src/de/steamwar/lobby/special/easter/EggClickListener.java b/src/de/steamwar/lobby/special/easter/EggClickListener.java index e9503c8..5b25c44 100644 --- a/src/de/steamwar/lobby/special/easter/EggClickListener.java +++ b/src/de/steamwar/lobby/special/easter/EggClickListener.java @@ -37,7 +37,7 @@ public class EggClickListener extends BasicListener { return; } Player player = event.getPlayer(); - String found = UserConfig.getConfig(player.getUniqueId(), "egghunt"); + String found = UserConfig.getConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY); if (found == null) { found = ""; } @@ -59,6 +59,6 @@ public class EggClickListener extends BasicListener { player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 0.25f, 1.0f); builder.setCharAt(index, '1'); - UserConfig.updatePlayerConfig(player.getUniqueId(), "egghunt", builder.toString()); + UserConfig.updatePlayerConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY, builder.toString()); } } diff --git a/src/de/steamwar/lobby/special/easter/EggHunt.java b/src/de/steamwar/lobby/special/easter/EggHunt.java index 6da2942..ad721df 100644 --- a/src/de/steamwar/lobby/special/easter/EggHunt.java +++ b/src/de/steamwar/lobby/special/easter/EggHunt.java @@ -13,6 +13,8 @@ public class EggHunt { private static List eggList = new ArrayList<>(); + public static final String EGG_HUNT_CONFIG_KEY = "egghunt2022"; + public static void init() { } diff --git a/src/de/steamwar/lobby/special/easter/EggHuntCommand.java b/src/de/steamwar/lobby/special/easter/EggHuntCommand.java index 042c300..eeab79f 100644 --- a/src/de/steamwar/lobby/special/easter/EggHuntCommand.java +++ b/src/de/steamwar/lobby/special/easter/EggHuntCommand.java @@ -23,7 +23,7 @@ public class EggHuntCommand extends SWCommand { @Register public void genericCommand(Player player, @OptionalValue("ALL") Selection selection) { AtomicInteger atomicInteger = new AtomicInteger(); - String found = UserConfig.getConfig(player.getUniqueId(), "egghunt"); + String found = UserConfig.getConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY); List> entries = EggHunt.getEggList().stream() .map(egg -> { int index = atomicInteger.getAndIncrement();