From 4dfb865353f37f954e7d4a19281205962093d3f4 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 24 Mar 2022 15:25:41 +0100 Subject: [PATCH] Add PlayerParticle --- src/de/steamwar/lobby/LobbySystem.properties | 15 ++++++ .../lobby/particle/DustSimpleParticle.java | 53 +++++++++++++++++++ .../lobby/particle/PlayerParticle.java | 48 +++++++++++++++++ .../lobby/particle/SimpleParticle.java | 3 -- 4 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 src/de/steamwar/lobby/particle/DustSimpleParticle.java create mode 100644 src/de/steamwar/lobby/particle/PlayerParticle.java diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index a08edb6..7f97e1d 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -22,3 +22,18 @@ PARTICLE_ATTRIBUTE = §eAttribute§7: PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch PARTICLE_SELECT = §eKlicken zum auswählen + +PARTICLE_SNEEZE = §aSneeze +PARTICLE_SMOKE = §7Smoke +PARTICLE_FIRE = §cFeuer +PARTICLE_WATER = §bWasser +PARTICLE_HEART = §cHerzen +PARTICLE_NOTES = §eNoten +PARTICLE_NAUTILUS = §aNautilus +PARTICLE_SNOWBALL = §fSnowball +PARTICLE_EFFECT = §5Effekt +PARTICLE_CAMPFIRE = §7Rauch +PARTICLE_MAGIC = §5Magie +PARTICLE_ANGRY = §4Wut +PARTICLE_SLIME = §aSchleim +PARTICLE_MOB = §7Mob \ No newline at end of file diff --git a/src/de/steamwar/lobby/particle/DustSimpleParticle.java b/src/de/steamwar/lobby/particle/DustSimpleParticle.java new file mode 100644 index 0000000..bf77930 --- /dev/null +++ b/src/de/steamwar/lobby/particle/DustSimpleParticle.java @@ -0,0 +1,53 @@ +/* + * 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 org.bukkit.Location; +import org.bukkit.Particle; + +public class DustSimpleParticle implements BaseParticle { + + private final ParticleItem particleItem; + private final Particle particle; + private float vx; + private float vy; + private float vz; + private double time = 1; + + public DustSimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time) { + this.particleItem = particleItem; + this.particle = particle; + this.vx = vx; + this.vy = vy; + this.vz = vz; + this.time = time; + } + + @Override + public ParticleItem getItem() { + return particleItem; + } + + @Override + public void particle(ParticleData particleData) { + Location location = particleData.getLocation().add(0.0, 0.2, 0.0); + particleData.getWorld().spawnParticle(particle, location, 5, vx, vy, vz, time, getParticleDust()); + } +} diff --git a/src/de/steamwar/lobby/particle/PlayerParticle.java b/src/de/steamwar/lobby/particle/PlayerParticle.java new file mode 100644 index 0000000..ea10ac0 --- /dev/null +++ b/src/de/steamwar/lobby/particle/PlayerParticle.java @@ -0,0 +1,48 @@ +/* + * 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.mutator.LocationParticleMutator; +import lombok.AllArgsConstructor; +import org.bukkit.Material; +import org.bukkit.Particle; + +import static org.bukkit.Material.*; + +@AllArgsConstructor +public enum PlayerParticle { + + SNEEZE(new SimpleParticle(new ParticleItem(SLIME_BLOCK, "PARTICLE_SNEEZE"), Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01)), + SMOKE(new SimpleParticle(new ParticleItem(COBWEB, "PARTICLE_SMOKE"), Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01)), + FIRE(new SimpleParticle(new ParticleItem(LAVA_BUCKET, "PARTICLE_FIRE"), Particle.DRIP_LAVA)), + WATER(new SimpleParticle(new ParticleItem(WATER_BUCKET, "PARTICLE_WATER"), Particle.DRIP_WATER)), + HEART(new LocationParticleMutator(new SimpleParticle(new ParticleItem(RED_DYE, "PARTICLE_HEART"), Particle.HEART), location -> location.add(0, 2.2, 0))), + NOTES(new LocationParticleMutator(new SimpleParticle(new ParticleItem(NOTE_BLOCK, "PARTICLE_NOTES"), Particle.NOTE), location -> location.add(0, 2.2, 0))), + NAUTILUS(new SimpleParticle(new ParticleItem(NAUTILUS_SHELL, "PARTICLE_NAUTILUS"), Particle.NAUTILUS, 0.2F, 0.2F, 0.2F, 0.01)), + SNOWBALL(new SimpleParticle(new ParticleItem(Material.SNOWBALL, "PARTICLE_SNOWBALL"), Particle.SNOWBALL, 0.2F, 0.2F, 0.2F, 0.01)), + EFFECT(new DustSimpleParticle(new ParticleItem(GLASS_BOTTLE, "PARTICLE_EFFECT"), Particle.REDSTONE, 0F, 0.2F, 0F, 0.01)), + CAMPFIRE(new SimpleParticle(new ParticleItem(Material.CAMPFIRE, "PARTICLE_CAMPFIRE"), Particle.CAMPFIRE_COSY_SMOKE, 0F, 0.2F, 0F, 0.01)), + MAGIC(new SimpleParticle(new ParticleItem(CAULDRON, "PARTICLE_MAGIC"), Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01)), + ANGRY(new SimpleParticle(new ParticleItem(REDSTONE_BLOCK, "PARTICLE_ANGRY"), Particle.VILLAGER_ANGRY, 0.2F, 0.2F, 0.2F, 0.01)), + SLIME(new SimpleParticle(new ParticleItem(SLIME_BALL, "PARTICLE_SLIME"), Particle.SLIME)), + MOB(new SimpleParticle(new ParticleItem(ZOMBIE_HEAD, "PARTICLE_MOB"), Particle.SPELL_MOB)), +; + private BaseParticle particle; +} diff --git a/src/de/steamwar/lobby/particle/SimpleParticle.java b/src/de/steamwar/lobby/particle/SimpleParticle.java index 416ea79..e59fe40 100644 --- a/src/de/steamwar/lobby/particle/SimpleParticle.java +++ b/src/de/steamwar/lobby/particle/SimpleParticle.java @@ -19,9 +19,6 @@ package de.steamwar.lobby.particle; -import de.steamwar.lobby.particle.BaseParticle; -import de.steamwar.lobby.particle.ParticleData; -import de.steamwar.lobby.particle.ParticleItem; import org.bukkit.Location; import org.bukkit.Particle;