diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 9a51358..2330fe5 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -37,7 +37,6 @@ PARTICLE_MAGIC = §5Magie PARTICLE_ANGRY = §4Wut PARTICLE_SLIME = §aSchleim PARTICLE_MOB = §7Mob - PARTICLE_SQUID = §8Squid PARTICLE_BUBBLE = §aBubble PARTICLE_HONEY = §6Honey @@ -45,4 +44,15 @@ PARTICLE_NECTAR = §6Nectar PARTICLE_FIREWORK = §7Firework PARTICLE_DRAGON_BREATH = §5Dragon Breath PARTICLE_DAMAGE = §5Damage -PARTICLE_DOLPHIN = §dDolphin \ No newline at end of file +PARTICLE_DOLPHIN = §dDolphin +PARTICLE_WITCH = §5Hexe +PARTICLE_ENCHANTING = §eZauber +PARTICLE_HAPPY = §2Freude +PARTICLE_FLAME = §7Flammen +PARTICLE_END_ROD = §fEnd Rod +PARTICLE_CLOUD = §7Cloud +PARTICLE_TOTEM = §aTotem +PARTICLE_TOWN = §5Town +PARTICLE_ENCHANTING_CIRCLE = §fEnchanted +PARTICLE_WATER_FIRE = §bWater§7/§cFire +PARTICLE_MAGIC_ENCHANTING = §5Magic§7/§eZauber \ No newline at end of file diff --git a/src/de/steamwar/lobby/particle/ParticleInventory.java b/src/de/steamwar/lobby/particle/ParticleInventory.java index 33a7771..b95c73e 100644 --- a/src/de/steamwar/lobby/particle/ParticleInventory.java +++ b/src/de/steamwar/lobby/particle/ParticleInventory.java @@ -22,6 +22,8 @@ package de.steamwar.lobby.particle; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.lobby.particle.decorator.CircleParticle; +import de.steamwar.lobby.particle.decorator.CloudParticle; import de.steamwar.lobby.util.LobbyPlayer; import de.steamwar.sql.Event; import de.steamwar.sql.SteamwarUser; @@ -42,84 +44,6 @@ public class ParticleInventory { private ParticleInventory() { } - private static final List PLAYER_PARTICLES = new ArrayList<>(); - private static final List TEAM_PARTICLES = new ArrayList<>(); - private static final List SERVERTEAM_PARTICLES = new ArrayList<>(); - - private static final List> PLAYER_PARTICLES_ENTRIES = new ArrayList<>(); - private static final List> TEAM_PARTICLES_ENTRIES = new ArrayList<>(); - private static final List> SERVERTEAM_PARTICLES_ENTRIES = new ArrayList<>(); - - static { - List defaultLore = loreBuilder(null, null); - List teamLore = loreBuilder(null, "Teambeitritt"); - List serverTeamLore = loreBuilder(null, "Serverteam"); - List serverTeamLore_C = loreBuilder(new String[]{"Wolke"}, "Serverteam"); - List serverTeamLore_R = loreBuilder(new String[]{"Ring"}, "Serverteam"); - List serverTeamLore_2R = loreBuilder(new String[]{"doppel Ring"}, "Serverteam"); - List serverTeamLore_CR = loreBuilder(new String[]{"Wolke", "Ring"}, "Serverteam"); - - PLAYER_PARTICLES.add(new SimpleParticle(Material.SLIME_BLOCK, "§aSneeze", defaultLore, Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01)); - PLAYER_PARTICLES.add(new SimpleParticle(Material.COBWEB, "§7Smoke", defaultLore, Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01)); - PLAYER_PARTICLES.add(new SimpleParticle(Material.LAVA_BUCKET, "§cFeuer", defaultLore, Particle.DRIP_LAVA)); - PLAYER_PARTICLES.add(new SimpleParticle(Material.WATER_BUCKET, "§bWasser", defaultLore, Particle.DRIP_WATER)); - PLAYER_PARTICLES.add(new FunctionalParticle(Material.RED_DYE, "§cHerzen", defaultLore, (world, player, integer) -> world.spawnParticle(Particle.HEART, player.getLocation().add(0, 2.2, 0), 5))); - PLAYER_PARTICLES.add(new FunctionalParticle(Material.NOTE_BLOCK, "§eNoten", defaultLore, (world, player, integer) -> world.spawnParticle(Particle.NOTE, player.getLocation().add(0, 2.2, 0), 5))); - PLAYER_PARTICLES.add(new SimpleParticle(Material.NAUTILUS_SHELL, "§aNautilis", defaultLore, Particle.NAUTILUS, 0.2F, 0F, 0.2F, 0.01)); - PLAYER_PARTICLES.add(new SimpleParticle(Material.SNOWBALL, "§fSnowball", defaultLore, Particle.SNOWBALL, 0.2F, 0F, 0.2F, 0.01)); - PLAYER_PARTICLES.add(new FunctionalParticle(Material.GLASS_BOTTLE, "§5Effekt", defaultLore, (world, player, time) -> { - world.spawnParticle(Particle.REDSTONE, player.getLocation().add(0.0, 0.2, 0.0), 5, 0F, 0.2F, 0F, 0.01, SpecialParticle.getParticleDust()); - })); - PLAYER_PARTICLES.add(new SimpleParticle(Material.CAMPFIRE, "§7Rauch", defaultLore, Particle.CAMPFIRE_COSY_SMOKE, 0.0F, 0.2F, 0F, 0.01)); - PLAYER_PARTICLES.add(new SimpleParticle(Material.CAULDRON, "§5Magie", defaultLore, Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01)); - PLAYER_PARTICLES.add(new SimpleParticle(Material.REDSTONE_BLOCK, "§4Wut", defaultLore, Particle.VILLAGER_ANGRY, 0.2F, 0.02F, 0.2F, 0.01)); - PLAYER_PARTICLES.add(new SimpleParticle(Material.SLIME_BALL, "§aSchleim", defaultLore, Particle.SLIME)); - PLAYER_PARTICLES.add(new SimpleParticle(Material.ZOMBIE_HEAD, "§7Mob", defaultLore, Particle.SPELL_MOB)); - - TEAM_PARTICLES.addAll(PLAYER_PARTICLES); - TEAM_PARTICLES.add(new SimpleParticle(Material.INK_SAC, "§8Squid", teamLore, Particle.SQUID_INK, 0.2F, 0.2F, 0.2F, 0.01)); - TEAM_PARTICLES.add(new SimpleParticle(Material.TUBE_CORAL, "§aBubble", teamLore, Particle.BUBBLE_POP, 0.2F, 0.2F, 0.2F, 0.01)); - TEAM_PARTICLES.add(new SimpleParticle(Material.HONEY_BOTTLE, "§6Honey", teamLore, Particle.DRIPPING_HONEY, 0.2F, 0.2F, 0.2F, 1)); - TEAM_PARTICLES.add(new SimpleParticle(Material.HONEYCOMB, "§6Nectar", teamLore, Particle.FALLING_NECTAR, 0.2F, 0.2F, 0.2F, 1)); - TEAM_PARTICLES.add(new FunctionalParticle(Material.FIRE_CHARGE, "§7Firework", loreBuilder(new String[]{"in Luft"}, "Team beitritt"), (world, player, time) -> { - if (world.getBlockAt(player.getLocation().subtract(0, 1, 0)).getType() == Material.AIR) { - world.spawnParticle(Particle.FIREWORKS_SPARK, player.getLocation().subtract(0, -0.2, 0), 2, 0.1F, 0.1F, 0.1F, 0.2); - } - })); - TEAM_PARTICLES.add(new SimpleParticle(Material.DRAGON_BREATH, "§5Dragon Breath", teamLore, Particle.DRAGON_BREATH, 1F, 0.02F, 1F, 0.01)); - TEAM_PARTICLES.add(new SimpleParticle(Material.SPIDER_EYE, "§5Damage", teamLore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)); - TEAM_PARTICLES.add(new SimpleParticle(Material.BLUE_DYE, "§dDolphin", teamLore, Particle.DOLPHIN, 0.2F, 0F, 0.2F, 0.01)); - TEAM_PARTICLES.add(new CircleParticle(Material.RED_CONCRETE, "§cHerzen", loreBuilder(new String[]{"Ring"}, "Team beitritt"), Particle.HEART, null, location -> location.add(0, 2.2, 0))); - - SERVERTEAM_PARTICLES.addAll(TEAM_PARTICLES); - SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.EXPERIENCE_BOTTLE, "§5Hexe", serverTeamLore, Particle.SPELL_WITCH)); - SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.ENCHANTING_TABLE, "§eZauber", serverTeamLore, Particle.ENCHANTMENT_TABLE)); - SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.EMERALD_BLOCK, "§2Freude", serverTeamLore, Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01)); - SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.FLINT_AND_STEEL, "§7Flammen", serverTeamLore, Particle.FLAME, 0F, 0.2F, 0F, 0.01)); - SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.END_ROD, "§fEnd Rod", serverTeamLore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01)); - SERVERTEAM_PARTICLES.add(new CloudParticle(Material.WHITE_WOOL, "§fCloud", serverTeamLore_C, Particle.CLOUD)); - SERVERTEAM_PARTICLES.add(new CloudParticle(Material.TOTEM_OF_UNDYING, "§aTotem", serverTeamLore_C, Particle.TOTEM)); - SERVERTEAM_PARTICLES.add(new CloudParticle(Material.WHITE_DYE, "§eZauber", serverTeamLore_C, Particle.ENCHANTMENT_TABLE)); - SERVERTEAM_PARTICLES.add(new CloudParticle(Material.FIRE_CORAL_BLOCK, "§cFlammen", serverTeamLore_C, Particle.FLAME)); - SERVERTEAM_PARTICLES.add(new CloudParticle(Material.LIME_SHULKER_BOX, "§aSneeze", serverTeamLore_C, Particle.SNEEZE)); - SERVERTEAM_PARTICLES.add(new CloudParticle(Material.GREEN_SHULKER_BOX, "§aSchleim", serverTeamLore_C, Particle.SLIME)); - SERVERTEAM_PARTICLES.add(new CloudParticle(Material.DEAD_BRAIN_CORAL_BLOCK, "§8Smoke", serverTeamLore_C, Particle.CAMPFIRE_COSY_SMOKE)); - SERVERTEAM_PARTICLES.add(new CloudParticle(Material.FIREWORK_STAR, "§5Town", serverTeamLore_C, Particle.TOWN_AURA)); - SERVERTEAM_PARTICLES.add(new CircleParticle(Material.MAGMA_BLOCK, "§cFlammen", serverTeamLore_R, Particle.FLAME, null, location -> location.add(0, 1.1, 0), 0F, 0.0F, 0F, 0.01)); - SERVERTEAM_PARTICLES.add(new CircleParticle(Material.ENCHANTED_BOOK, "§fEnchanted", serverTeamLore_R, Particle.ENCHANTMENT_TABLE, null, location -> location.add(0, 1.1, 0), 0.0F, 0.0F, 0.0F, 0.01)); - SERVERTEAM_PARTICLES.add(new CircleParticle(Material.NOTE_BLOCK, "§eNoten", serverTeamLore_R, Particle.NOTE, null, location -> location.add(0, 2.2, 0), 0.0F, 0.0F, 0.0F, 0.01)); - SERVERTEAM_PARTICLES.add(new CircleParticle(Material.GUARDIAN_SPAWN_EGG, "§bWater§7/§cFire", serverTeamLore_2R, Particle.DRIP_WATER, Particle.DRIP_LAVA, location -> location.add(0, 1.1, 0), 0.0F, 0.0F, 0.0F, 0.01)); - SERVERTEAM_PARTICLES.add(new CircleParticle(Material.DIAMOND_SWORD, "§5Magic§7/§eZauber", serverTeamLore_2R, Particle.CRIT_MAGIC, Particle.ENCHANTMENT_TABLE, location -> location.add(0, 1.1, 0), 0.0F, 0.0F, 0.0F, 0.01)); - SERVERTEAM_PARTICLES.add(new CloudCircleParticle(Material.GLOWSTONE_DUST, "§5Magic", serverTeamLore_CR, Particle.CRIT_MAGIC, location -> location.add(0, 1.1, 0))); - SERVERTEAM_PARTICLES.add(new CloudCircleParticle(Material.FIRE_CORAL, "§cFlammen", serverTeamLore_CR, Particle.FLAME, location -> location.add(0, 1.1, 0))); - SERVERTEAM_PARTICLES.add(new CloudCircleParticle(Material.FIREWORK_ROCKET, "§7Firework", serverTeamLore_CR, Particle.FIREWORKS_SPARK, location -> location.add(0, 1.1, 0))); - SERVERTEAM_PARTICLES.add(new CloudCircleParticle(Material.CYAN_DYE, "§aWater", serverTeamLore_CR, Particle.WATER_WAKE, location -> location.add(0, 1.1, 0))); - - PLAYER_PARTICLES.forEach(specialParticle -> PLAYER_PARTICLES_ENTRIES.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); - TEAM_PARTICLES.forEach(specialParticle -> TEAM_PARTICLES_ENTRIES.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); - SERVERTEAM_PARTICLES.forEach(specialParticle -> SERVERTEAM_PARTICLES_ENTRIES.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); - } - private static SWInventory createInventory(Player player) { LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); @@ -182,25 +106,5 @@ public class ParticleInventory { public static void openParticleInventory(Player player) { createInventory(player).open(); } - - public static List loreBuilder(String[] attribute, String unlocked) { - List lore = new ArrayList<>(); - lore.add(""); - if (attribute != null && attribute.length > 0) { - lore.add("§eAttribute§7:"); - for (String s : attribute) { - lore.add("§7- §f" + s); - } - lore.add(""); - } - if (unlocked != null) { - lore.add("§eFreigeschaltet durch"); - lore.add("§f" + unlocked); - lore.add(""); - } - lore.add("§eKlicken zum auswählen"); - return lore; - } - } diff --git a/src/de/steamwar/lobby/particle/ServerTeamParticle.java b/src/de/steamwar/lobby/particle/ServerTeamParticle.java new file mode 100644 index 0000000..bab253b --- /dev/null +++ b/src/de/steamwar/lobby/particle/ServerTeamParticle.java @@ -0,0 +1,62 @@ +/* + * 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.lobby.particle.decorator.CircleParticle; +import de.steamwar.lobby.particle.decorator.CloudParticle; +import de.steamwar.lobby.particle.mutator.LocationParticleMutator; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.bukkit.Material; +import org.bukkit.Particle; + +import static org.bukkit.Material.*; + +@AllArgsConstructor +public enum ServerTeamParticle implements ParticleEnum { + + WITCH(new SimpleParticle(new ParticleItem(EXPERIENCE_BOTTLE, "PARTICLE_WITCH"), Particle.SPELL_WITCH)), + ENCHANTING(new SimpleParticle(new ParticleItem(ENCHANTING_TABLE, "PARTICLE_ENCHANTING"), Particle.ENCHANTMENT_TABLE)), + HAPPY(new SimpleParticle(new ParticleItem(EMERALD_BLOCK, "PARTICLE_HAPPY"), Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01)), + FLAME(new SimpleParticle(new ParticleItem(FLINT_AND_STEEL, "PARTICLE_FLAME"), Particle.FLAME, 0F, 0.2F, 0F, 0.01)), + END_ROD(new SimpleParticle(new ParticleItem(Material.END_ROD, "PARTICLE_END_ROD"), Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01)), + CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(WHITE_WOOL, "PARTICLE_CLOUD"), Particle.CLOUD))), + TOTEM(new CloudParticle(new SimpleParticle(new ParticleItem(TOTEM_OF_UNDYING, "PARTICLE_TOTEM"), Particle.TOTEM))), + ENCHANTING_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(WHITE_DYE, "PARTICLE_ENCHANTING"), Particle.ENCHANTMENT_TABLE))), + FLAME_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(FIRE_CORAL_BLOCK, "PARTICLE_FLAME"), Particle.FLAME))), + SNEEZE_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(LIME_SHULKER_BOX, "PARTICLE_SNEEZE"), Particle.SNEEZE))), + SLIME_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(GREEN_SHULKER_BOX, "PARTICLE_SLIME"), Particle.SLIME))), + SMOKE_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(DEAD_BRAIN_CORAL_BLOCK, "PARTICLE_SMOKE"), Particle.CAMPFIRE_COSY_SMOKE))), + TOWN_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(FIREWORK_STAR, "PARTICLE_TOWN"), Particle.TOWN_AURA))), + FLAME_CIRCLE(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(MAGMA_BLOCK, "PARTICLE_FLAME"), Particle.FLAME, 0F, 0F, 0F, 0.01), location -> location.add(0, 1.1, 0)))), + ENCHANTING_CIRCLE(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(WHITE_DYE, "PARTICLE_ENCHANTING_CIRCLE"), Particle.ENCHANTMENT_TABLE, 0F, 0F, 0F, 0.01), location -> location.add(0, 1.1, 0)))), + NOTES_CIRCLE(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(NOTE_BLOCK, "PARTICLE_NOTES"), Particle.NOTE, 0F, 0F, 0F, 0.01), location -> location.add(0, 2.2, 0)))), + WATER_FIRE(new LocationParticleMutator(new CircleParticle(new ParticleItem(GUARDIAN_SPAWN_EGG, "PARTICLE_WATER_FIRE"), new SimpleParticle(null, Particle.DRIP_WATER, 0.0F, 0.0F, 0.0F, 0.01), new SimpleParticle(null, Particle.DRIP_LAVA, 0.0F, 0.0F, 0.0F, 0.01)), location -> location.add(0, 1.1, 0))), + MAGIC_ENCHANTING(new LocationParticleMutator(new CircleParticle(new ParticleItem(DIAMOND_SWORD, "PARTICLE_MAGIC_ENCHANTING"), new SimpleParticle(null, Particle.CRIT_MAGIC, 0.0F, 0.0F, 0.0F, 0.01), new SimpleParticle(null, Particle.ENCHANTMENT_TABLE, 0.0F, 0.0F, 0.0F, 0.01)), location -> location.add(0, 1.1, 0))), + MAGIC_CLOUD_CIRCLE(new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(GLOWSTONE_DUST, "PARTICLE_MAGIC"), Particle.CRIT_MAGIC), location -> location.add(0, 1.1, 0))))), + FLAME_CLOUD_CIRCLE(new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(FIRE_CORAL, "PARTICLE_FLAME"), Particle.FLAME), location -> location.add(0, 1.1, 0))))), + FIREWORK_CLOUD_CIRCLE(new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(FIREWORK_ROCKET, "PARTICLE_FIREWORK"), Particle.FIREWORKS_SPARK), location -> location.add(0, 1.1, 0))))), + WATER_CLOUD_CIRCLE(new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(CYAN_DYE, "PARTICLE_WATER"), Particle.WATER_WAKE), location -> location.add(0, 1.1, 0))))), +; + public static ParticleEnum[] particles = values(); + + @Getter + private BaseParticle particle; +} diff --git a/src/de/steamwar/lobby/particle/decorator/CloudParticle.java b/src/de/steamwar/lobby/particle/decorator/CloudParticle.java index c3d6747..4aa2b5c 100644 --- a/src/de/steamwar/lobby/particle/decorator/CloudParticle.java +++ b/src/de/steamwar/lobby/particle/decorator/CloudParticle.java @@ -53,6 +53,7 @@ public class CloudParticle implements BaseParticle { particleData.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING); return; } + particleData.withLocation(particleData.getLocation().subtract(0, -0.2, 0)); particle.particle(particleData); } }