From a0498ce7940fb1e1ade0347e7ba60c5b5abb6c6d Mon Sep 17 00:00:00 2001 From: jojo Date: Fri, 8 Jan 2021 15:58:43 +0100 Subject: [PATCH] Add CloudCircleParticle --- .../lobby/inventories/ParticleInventory.java | 13 +++-- .../lobby/particle/CircleParticle.java | 5 +- .../lobby/particle/CloudCircleParticle.java | 51 +++++++++++++++++++ .../lobby/particle/CloudParticle.java | 2 +- 4 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 src/de/steamwar/lobby/particle/CloudCircleParticle.java diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index 68d735d..58a6d88 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -72,10 +72,11 @@ public class ParticleInventory { teamParticles.add(new SimpleParticle(Material.HONEY_BOTTLE, "§6Honey", lore, Particle.DRIPPING_HONEY, 0.2F, 0.2F, 0.2F, 1)); teamParticles.add(new SimpleParticle(Material.FIRE_CHARGE, "§7Firework", lore, Particle.FIREWORKS_SPARK, 0.2F, 0.2F, 0.2F, 0.5)); teamParticles.add(new SimpleParticle(Material.DRAGON_BREATH, "§5Dragon Breath", lore, Particle.DRAGON_BREATH, 1F, 0.02F, 1F, 0.01)); - teamParticles.add(new CircleParticle(Material.RED_WOOL, "§cHerzen Ring", lore, Particle.HEART, location -> location.add(0, 2.2, 0))); + teamParticles.add(new SimpleParticle(Material.SPIDER_EYE, "§5Damage", lore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)); + teamParticles.add(new SimpleParticle(Material.BLUE_DYE, "§dDolphin", lore, Particle.DOLPHIN, 0.2F, 0F, 0.2F, 0.01)); + teamParticles.add(new CircleParticle(Material.RED_CONCRETE, "§cHerzen Ring", lore, Particle.HEART, location -> location.add(0, 2.2, 0))); serverteamParticles.addAll(teamParticles); - serverteamParticles.add(new SimpleParticle(Material.SPIDER_EYE, "§5Damage", lore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)); serverteamParticles.add(new SimpleParticle(Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH)); serverteamParticles.add(new SimpleParticle(Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE)); serverteamParticles.add(new SimpleParticle(Material.EMERALD_BLOCK, "§2Freude", lore, Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01)); @@ -83,10 +84,14 @@ public class ParticleInventory { serverteamParticles.add(new SimpleParticle(Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 0F, 0.2F, 0F, 0.01)); serverteamParticles.add(new SimpleParticle(Material.END_ROD, "§fEnd Rod", lore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01)); serverteamParticles.add(new CloudParticle(Material.WHITE_WOOL, "§fCloud", lore, Particle.CLOUD)); - serverteamParticles.add(new CloudParticle(Material.ENCHANTED_GOLDEN_APPLE, "§eZauber Cloud", lore, Particle.ENCHANTMENT_TABLE)); - serverteamParticles.add(new CircleParticle(Material.MAGMA_BLOCK, "§7Flammen Ring", lore, Particle.FLAME, location -> location.add(0, 1.1, 0), 0F, 0.0F, 0F, 0.01)); + serverteamParticles.add(new CloudParticle(Material.WHITE_DYE, "§eZauber Wolke", lore, Particle.ENCHANTMENT_TABLE)); + serverteamParticles.add(new CloudParticle(Material.FIRE_CORAL_BLOCK, "§cFlammen Wolke", lore, Particle.FLAME)); + serverteamParticles.add(new CloudParticle(Material.LIME_SHULKER_BOX, "§aSneeze Wolke", lore, Particle.SNEEZE)); + serverteamParticles.add(new CloudParticle(Material.GREEN_SHULKER_BOX, "§aSchleim Wolke", lore, Particle.SLIME)); + serverteamParticles.add(new CircleParticle(Material.MAGMA_BLOCK, "§cFlammen Ring", lore, Particle.FLAME, location -> location.add(0, 1.1, 0), 0F, 0.0F, 0F, 0.01)); serverteamParticles.add(new CircleParticle(Material.ENCHANTED_BOOK, "§fEnchanted Ring", lore, Particle.ENCHANTMENT_TABLE, location -> location.add(0, 1.1, 0), 0.0F, 0.0F, 0.0F, 0.01)); serverteamParticles.add(new CircleParticle(Material.NOTE_BLOCK, "§eNoten Ring", lore, Particle.NOTE, location -> location.add(0, 2.2, 0), 0.0F, 0.0F, 0.0F, 0.01)); + serverteamParticles.add(new CloudCircleParticle(Material.GLOWSTONE_DUST, "§5Magic Ring Wolke", lore, Particle.CRIT_MAGIC, location -> location.add(0, 1.1, 0))); playerParticles.forEach(specialParticle -> playerParticlesEntries.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); teamParticles.forEach(specialParticle -> teamParticlesEntries.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); diff --git a/src/de/steamwar/lobby/particle/CircleParticle.java b/src/de/steamwar/lobby/particle/CircleParticle.java index bca7529..0031103 100644 --- a/src/de/steamwar/lobby/particle/CircleParticle.java +++ b/src/de/steamwar/lobby/particle/CircleParticle.java @@ -30,6 +30,7 @@ import org.bukkit.util.Vector; import java.util.List; import java.util.function.Function; +import java.util.function.UnaryOperator; public class CircleParticle extends SpecialParticle { @@ -41,13 +42,13 @@ public class CircleParticle extends SpecialParticle { private float vz; private double time = 1; - public CircleParticle(Material material, String name, List lore, Particle particle, Function locationShift) { + public CircleParticle(Material material, String name, List lore, Particle particle, UnaryOperator locationShift) { super(material, name, lore); this.particle = particle; this.locationShift = locationShift; } - public CircleParticle(Material material, String name, List lore, Particle particle, Function locationShift, float vx, float vy, float vz, double time) { + public CircleParticle(Material material, String name, List lore, Particle particle, UnaryOperator locationShift, float vx, float vy, float vz, double time) { super(material, name, lore); this.particle = particle; this.locationShift = locationShift; diff --git a/src/de/steamwar/lobby/particle/CloudCircleParticle.java b/src/de/steamwar/lobby/particle/CloudCircleParticle.java new file mode 100644 index 0000000..5e1a668 --- /dev/null +++ b/src/de/steamwar/lobby/particle/CloudCircleParticle.java @@ -0,0 +1,51 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 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.Material; +import org.bukkit.Particle; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import java.util.List; +import java.util.function.UnaryOperator; + +public class CloudCircleParticle extends CircleParticle { + + public CloudCircleParticle(Material material, String name, List lore, Particle particle, UnaryOperator locationShift) { + super(material, name, lore, particle, locationShift, 0.0F, 0.0F, 0.0F, 0.01); + } + + @Override + public void particle(World world, Player player, double deg) { + if (world.getBlockAt(player.getLocation().subtract(0, 1, 0)).getType() == Material.AIR) { + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false)); + super.particle(world, player, deg); + } else { + player.removePotionEffect(PotionEffectType.SLOW_FALLING); + } + } + +} diff --git a/src/de/steamwar/lobby/particle/CloudParticle.java b/src/de/steamwar/lobby/particle/CloudParticle.java index d5f3a82..7ebb689 100644 --- a/src/de/steamwar/lobby/particle/CloudParticle.java +++ b/src/de/steamwar/lobby/particle/CloudParticle.java @@ -33,7 +33,7 @@ public class CloudParticle extends FunctionalParticle { public CloudParticle(Material material, String name, List lore, Particle particle) { super(material, name, lore, (world, player, time) -> { if (world.getBlockAt(player.getLocation().subtract(0, 1, 0)).getType() == Material.AIR) { - player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 1, false, false, false)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false)); world.spawnParticle(particle, player.getLocation().subtract(0, -0.2, 0), 10, 1F, 0.02F, 1F, 0.01); } else { player.removePotionEffect(PotionEffectType.SLOW_FALLING);