From d44bb520d42c158b3811459a287fd8ebeae45673 Mon Sep 17 00:00:00 2001 From: jojo Date: Fri, 8 Jan 2021 13:03:39 +0100 Subject: [PATCH] Add CloudParticle Add ParticleInventory.teamParticles Add ParticleInventory.serverteamParticles --- .../lobby/inventories/ParticleInventory.java | 48 ++++++++++++------- .../lobby/particle/CloudParticle.java | 44 +++++++++++++++++ 2 files changed, 76 insertions(+), 16 deletions(-) create mode 100644 src/de/steamwar/lobby/particle/CloudParticle.java diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index bfa6db1..68d735d 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -21,16 +21,15 @@ package de.steamwar.lobby.inventories; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWListInv; -import de.steamwar.lobby.particle.CircleParticle; -import de.steamwar.lobby.particle.FunctionalParticle; -import de.steamwar.lobby.particle.SimpleParticle; -import de.steamwar.lobby.particle.SpecialParticle; +import de.steamwar.lobby.particle.*; import de.steamwar.lobby.utils.LobbyPlayer; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserGroup; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import java.util.ArrayList; import java.util.Arrays; @@ -45,9 +44,11 @@ public class ParticleInventory { private static final List playerParticles = new ArrayList<>(); private static final List teamParticles = new ArrayList<>(); + private static final List serverteamParticles = new ArrayList<>(); private static final List> playerParticlesEntries = new ArrayList<>(); private static final List> teamParticlesEntries = new ArrayList<>(); + private static final List> serverteamParticlesEntries = new ArrayList<>(); static { playerParticles.add(new SimpleParticle(Material.SLIME_BLOCK, "§aSneeze", lore, Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01)); @@ -66,19 +67,30 @@ public class ParticleInventory { playerParticles.add(new SimpleParticle(Material.ZOMBIE_HEAD, "§7Mob", lore, Particle.SPELL_MOB)); teamParticles.addAll(playerParticles); - teamParticles.add(new SimpleParticle(Material.SPIDER_EYE, "§5Damage", lore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)); - teamParticles.add(new SimpleParticle(Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH)); - teamParticles.add(new SimpleParticle(Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE)); - teamParticles.add(new SimpleParticle(Material.EMERALD_BLOCK, "§2Freude", lore, Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01)); - teamParticles.add(new SimpleParticle(Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 0F, 0.2F, 0F, 0.01)); - teamParticles.add(new SimpleParticle(Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 0F, 0.2F, 0F, 0.01)); - teamParticles.add(new SimpleParticle(Material.END_ROD, "§fEnd Rod", lore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01)); - teamParticles.add(new CircleParticle(Material.MAGMA_BLOCK, "§7Flammen Ring", lore, Particle.FLAME, location -> location.add(0, 1.1, 0), 0F, 0.0F, 0F, 0.01)); - teamParticles.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)); - teamParticles.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)); + teamParticles.add(new SimpleParticle(Material.INK_SAC, "§8Squid", lore, Particle.SQUID_INK, 0.2F, 0.2F, 0.2F, 0.01)); + teamParticles.add(new SimpleParticle(Material.TUBE_CORAL, "§aBubble", lore, Particle.BUBBLE_POP, 0.2F, 0.2F, 0.2F, 0.01)); + 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))); + + 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)); + serverteamParticles.add(new SimpleParticle(Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 0F, 0.2F, 0F, 0.01)); + 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 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)); playerParticles.forEach(specialParticle -> playerParticlesEntries.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); teamParticles.forEach(specialParticle -> teamParticlesEntries.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); + serverteamParticles.forEach(specialParticle -> serverteamParticlesEntries.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); } private static SWInventory createInventory(Player player) { @@ -88,9 +100,13 @@ public class ParticleInventory { SWListInv particleSWListInv; if (userGroup == UserGroup.Member) { - particleSWListInv = new SWListInv<>(player, "§6Partikel", false, playerParticlesEntries, (clickType, particle) -> lobbyPlayer.setParticle(particle)); + if (steamwarUser.getTeam() != 0) { + particleSWListInv = new SWListInv<>(player, "§6Partikel", false, teamParticlesEntries, (clickType, particle) -> lobbyPlayer.setParticle(particle)); + } else { + particleSWListInv = new SWListInv<>(player, "§6Partikel", false, playerParticlesEntries, (clickType, particle) -> lobbyPlayer.setParticle(particle)); + } } else { - particleSWListInv = new SWListInv<>(player, "§6Partikel", false, teamParticlesEntries, (clickType, particle) -> lobbyPlayer.setParticle(particle)); + particleSWListInv = new SWListInv<>(player, "§6Partikel", false, serverteamParticlesEntries, (clickType, particle) -> lobbyPlayer.setParticle(particle)); } particleSWListInv.setItem(49, Material.BARRIER, "§8Keine Partikel", lore, false, clickType -> { lobbyPlayer.setParticle(null); diff --git a/src/de/steamwar/lobby/particle/CloudParticle.java b/src/de/steamwar/lobby/particle/CloudParticle.java new file mode 100644 index 0000000..d5f3a82 --- /dev/null +++ b/src/de/steamwar/lobby/particle/CloudParticle.java @@ -0,0 +1,44 @@ +/* + * + * 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.Material; +import org.bukkit.Particle; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import java.util.List; + +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)); + world.spawnParticle(particle, player.getLocation().subtract(0, -0.2, 0), 10, 1F, 0.02F, 1F, 0.01); + } else { + player.removePotionEffect(PotionEffectType.SLOW_FALLING); + } + }); + } + +}