From 38cb38a1a16a9cdb42629f0487de8636089945f0 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 24 Mar 2022 15:40:56 +0100 Subject: [PATCH] Add TeamParticle --- src/de/steamwar/lobby/LobbySystem.properties | 11 ++++- .../lobby/particle/SimpleParticle.java | 16 +++++- .../steamwar/lobby/particle/TeamParticle.java | 49 +++++++++++++++++++ 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 src/de/steamwar/lobby/particle/TeamParticle.java diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 7f97e1d..9a51358 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -36,4 +36,13 @@ PARTICLE_CAMPFIRE = §7Rauch PARTICLE_MAGIC = §5Magie PARTICLE_ANGRY = §4Wut PARTICLE_SLIME = §aSchleim -PARTICLE_MOB = §7Mob \ No newline at end of file +PARTICLE_MOB = §7Mob + +PARTICLE_SQUID = §8Squid +PARTICLE_BUBBLE = §aBubble +PARTICLE_HONEY = §6Honey +PARTICLE_NECTAR = §6Nectar +PARTICLE_FIREWORK = §7Firework +PARTICLE_DRAGON_BREATH = §5Dragon Breath +PARTICLE_DAMAGE = §5Damage +PARTICLE_DOLPHIN = §dDolphin \ No newline at end of file diff --git a/src/de/steamwar/lobby/particle/SimpleParticle.java b/src/de/steamwar/lobby/particle/SimpleParticle.java index e59fe40..5b9d657 100644 --- a/src/de/steamwar/lobby/particle/SimpleParticle.java +++ b/src/de/steamwar/lobby/particle/SimpleParticle.java @@ -31,6 +31,7 @@ public class SimpleParticle implements BaseParticle { private float vy; private float vz; private double time = 1; + private int count = 5; public SimpleParticle(ParticleItem particleItem, Particle particle) { this.particleItem = particleItem; @@ -47,6 +48,17 @@ public class SimpleParticle implements BaseParticle { this.time = time; } + public SimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time, int count) { + this.particleItem = particleItem; + this.particle = particle; + this.customVelocity = true; + this.vx = vx; + this.vy = vy; + this.vz = vz; + this.time = time; + this.count = count; + } + @Override public ParticleItem getItem() { return particleItem; @@ -56,9 +68,9 @@ public class SimpleParticle implements BaseParticle { public void particle(ParticleData particleData) { Location location = particleData.getLocation().add(0.0, 0.2, 0.0); if (customVelocity) { - particleData.getWorld().spawnParticle(particle, location, 5, vx, vy, vz, time); + particleData.getWorld().spawnParticle(particle, location, count, vx, vy, vz, time); } else { - particleData.getWorld().spawnParticle(particle, location, 5); + particleData.getWorld().spawnParticle(particle, location, count); } } } diff --git a/src/de/steamwar/lobby/particle/TeamParticle.java b/src/de/steamwar/lobby/particle/TeamParticle.java new file mode 100644 index 0000000..ab94c01 --- /dev/null +++ b/src/de/steamwar/lobby/particle/TeamParticle.java @@ -0,0 +1,49 @@ +/* + * 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.NonFloorParticle; +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 TeamParticle implements ParticleEnum { + + SQUID(new SimpleParticle(new ParticleItem(INK_SAC, "PARTICLE_SQUID"), Particle.SQUID_INK, 0.2F, 0.2F, 0.2F, 0.01)), + BUBBLE(new SimpleParticle(new ParticleItem(TUBE_CORAL, "PARTICLE_BUBBLE"), Particle.BUBBLE_POP, 0.2F, 0.2F, 0.2F, 0.01)), + HONEY(new SimpleParticle(new ParticleItem(HONEY_BOTTLE, "PARTICLE_HONEY"), Particle.DRIPPING_HONEY, 0.2F, 0.2F, 0.2F, 1)), + NECTAR(new SimpleParticle(new ParticleItem(HONEYCOMB, "PARTICLE_NECTAR"), Particle.FALLING_NECTAR, 0.2F, 0.2F, 0.2F, 1)), + FIREWORK(new LocationParticleMutator(new NonFloorParticle(new SimpleParticle(new ParticleItem(FIRE_CHARGE, "PARTICLE_FIREWORK"), Particle.FIREWORKS_SPARK, 0.1F, 0.1F, 0.1F, 0.2, 2)), location -> location.subtract(0, -0.2, 0))), + DRAGON_BREATH(new SimpleParticle(new ParticleItem(Material.DRAGON_BREATH, "PARTICLE_DRAGON_BREATH"), Particle.DRAGON_BREATH, 1F, 0.2F, 1F, 0.01)), + DAMAGE(new SimpleParticle(new ParticleItem(SPIDER_EYE, "PARTICLE_DAMAGE"), Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)), + DOLPHIN(new SimpleParticle(new ParticleItem(BLUE_DYE, "PARTICLE_DOLPHIN"), Particle.DOLPHIN, 0.2F, 0F, 0.2F, 0.01)), + HEART(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(RED_CONCRETE, "PARTICLE_HEART"), Particle.HEART), location -> location.add(0, 2.2, 0)))) +; + public static ParticleEnum[] particles = values(); + + @Getter + private BaseParticle particle; +}