13
0

Merge pull request 'Particle' (#4) from Particle into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #4
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-03-26 16:26:40 +01:00
Commit 21c4472356
37 geänderte Dateien mit 1327 neuen und 553 gelöschten Zeilen

Datei anzeigen

@ -10,3 +10,71 @@ PORTAL_COMMAND_REMOVE_HELP = §8/§7portal §eremove §8[§7PortalName§8] §8-
PORTAL_COMMAND_LIST_SHORT_INFO = §e{0} §8- §7{1} §7Pos1§8(§7{2}§8) §7Pos2§8(§7{3}§8)
PORTAL_NO_WORLDEDIT_SELECTION = §cKeine WorldEdit Selection
# Particle
PARTICLE_INVENTORY = §6Partikel
PARTICLE_DESELECT = §8Keine Partikel
PARTICLE_LOCKED = {0} §8- §c§lGesperrt
PARTICLE_UNLOCKED_BY_TEAM = §fTeambeitritt
PARTICLE_UNLOCKED_BY_EVENT = §fEventteilnahme
PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServerteam
PARTICLE_ATTRIBUTE_CIRCLE = §8-§f Ring
PARTICLE_ATTRIBUTE_BI_CIRCLE = §8-§f Doppelring
PARTICLE_ATTRIBUTE_CLOUD = §8-§f Wolke
PARTICLE_ATTRIBUTE_TICK = §8-§f Immer aktiv
PARTICLE_ATTRIBUTE_NON_FLOOR = §8-§f in Luft
PARTICLE_ATTRIBUTE_WING = §8-§f Flügel
PARTICLE_ATTRIBUTE = §eAttribute§7:
PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch
PARTICLE_SELECT = §eZum Auswählen klicken
PARTICLE_SNEEZE = §aSneeze
PARTICLE_SMOKE = §7Rauch
PARTICLE_FIRE = §cFeuer
PARTICLE_WATER = §bWasser
PARTICLE_HEART = §cHerzen
PARTICLE_NOTES = §eNoten
PARTICLE_NAUTILUS = §aNautilus
PARTICLE_SNOWBALL = §fSchneeball
PARTICLE_EFFECT = §5Effekt
PARTICLE_CAMPFIRE = §7Rauch
PARTICLE_MAGIC = §5Magie
PARTICLE_ANGRY = §4Wut
PARTICLE_SLIME = §aSchleim
PARTICLE_MOB = §7Mob
PARTICLE_SQUID = §8Tintenfisch
PARTICLE_BUBBLE = §aBlasen
PARTICLE_HONEY = §6Honig
PARTICLE_NECTAR = §6Nektar
PARTICLE_FIREWORK = §7Feuerwerk
PARTICLE_DRAGON_BREATH = §5Drachenatem
PARTICLE_DAMAGE = §5Schaden
PARTICLE_DOLPHIN = §dDelphin
PARTICLE_WITCH = §5Hexe
PARTICLE_ENCHANTING = §eZauber
PARTICLE_HAPPY = §2Freude
PARTICLE_FLAME = §7Flammen
PARTICLE_END_ROD = §fEnd Rod
PARTICLE_CLOUD = §7Wolke
PARTICLE_TOTEM = §aTotem
PARTICLE_TOWN = §5Town
PARTICLE_ENCHANTING_CIRCLE = §fVerzaubert
PARTICLE_WATER_FIRE = §bWasser§7/§cFeuer
PARTICLE_MAGIC_ENCHANTING = §5Magie§7/§eZauber
PARTICLE_WINGS_EVIL = §5Lila Flügel
PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. oder 3. Platz
PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION = §f{0}
PARTICLE_EVENT_ENCHANTING = §cVerzaubert
PARTICLE_EVENT_CLOUD = §fWolken
PARTICLE_EVENT_SMOKE = §7Rauch
PARTICLE_EVENT_WATER = §bWasser
PARTICLE_EVENT_WINGS = §fFlügel
PARTICLE_EVENT_RAIN_CLOUD = §fRegenwolke
PARTICLE_EVENT_WGS = §fWGS
PARTICLE_EVENT_WARGEARCLASH = §fClash

Datei anzeigen

@ -20,8 +20,10 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.particles.ParticleEnum;
import de.steamwar.lobby.particle.ParticleInventory;
import de.steamwar.lobby.particle.SpecialParticle;
import de.steamwar.lobby.util.LobbyPlayer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -38,6 +40,15 @@ public class ParticleListener extends BasicListener {
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
deg += 0.1;
if (deg > 360) deg = 0;
Bukkit.getOnlinePlayers().forEach(player -> {
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
ParticleEnum particle = lobbyPlayer.getParticle();
if (particle == null) return;
BaseParticle baseParticle = particle.getParticle();
if (baseParticle.needsTick()) {
baseParticle.particle(new ParticleData(player.getWorld(), player, deg));
}
});
}, 0, 1);
}
@ -53,11 +64,11 @@ public class ParticleListener extends BasicListener {
public void handlePlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
SpecialParticle particle = lobbyPlayer.getParticle();
ParticleEnum particle = lobbyPlayer.getParticle();
if (particle == null) return;
particle.execute(player.getWorld(), player, deg);
BaseParticle baseParticle = particle.getParticle();
if (baseParticle.needsTick()) return;
baseParticle.particle(new ParticleData(player.getWorld(), player, deg));
}
}

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Color;
import org.bukkit.Particle;
import java.util.Random;
public interface BaseParticle {
Random RANDOM = new Random();
default Color randomColor() {
return Color.fromRGB(RANDOM.nextInt(256), RANDOM.nextInt(256), RANDOM.nextInt(256));
}
default float randomSize() {
return RANDOM.nextFloat() / 2 + 1;
}
default Particle.DustOptions getParticleDust() {
return new Particle.DustOptions(randomColor(), randomSize());
}
ParticleItem getItem();
default boolean needsTick() {
return false;
}
void particle(ParticleData particleData);
}

Datei anzeigen

@ -1,87 +0,0 @@
/*
*
* 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 <https://www.gnu.org/licenses/>.
*/
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.util.Vector;
import java.util.List;
import java.util.function.Function;
import java.util.function.UnaryOperator;
public class CircleParticle extends SpecialParticle {
private Particle particle;
private Particle particle2;
private Function<Location, Location> locationShift;
private boolean customVelocity = false;
private float vx;
private float vy;
private float vz;
private double time = 1;
public CircleParticle(Material material, String name, List<String> lore, Particle particle, Particle particle2, UnaryOperator<Location> locationShift) {
super(material, name, lore);
this.particle = particle;
this.particle2 = particle2;
this.locationShift = locationShift;
}
public CircleParticle(Material material, String name, List<String> lore, Particle particle, Particle particle2, UnaryOperator<Location> locationShift, float vx, float vy, float vz, double time) {
super(material, name, lore);
this.particle = particle;
this.particle2 = particle2;
this.locationShift = locationShift;
customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
}
@Override
public void particle(World world, Player player, double deg) {
Vector vector = new Vector(1, 0, 0);
vector.rotateAroundY(deg);
if (customVelocity) {
world.spawnParticle(particle, locationShift.apply(player.getLocation().add(vector)), 1, vx, vy, vz, time);
} else {
world.spawnParticle(particle, locationShift.apply(player.getLocation().add(vector)), 1);
}
if (particle2 == null) {
return;
}
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
if (customVelocity) {
world.spawnParticle(particle2, locationShift.apply(player.getLocation().add(vector)), 1, vx, vy, vz, time);
} else {
world.spawnParticle(particle2, locationShift.apply(player.getLocation().add(vector)), 1);
}
}
}

Datei anzeigen

@ -1,44 +0,0 @@
/*
*
* 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 <https://www.gnu.org/licenses/>.
*/
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 java.util.List;
import java.util.function.UnaryOperator;
public class CloudCircleParticle extends CircleParticle {
public CloudCircleParticle(Material material, String name, List<String> lore, Particle particle, UnaryOperator<Location> locationShift) {
super(material, name, lore, particle, null, locationShift, 0.0F, 0.0F, 0.0F, 0.01);
asCloud = true;
}
@Override
public void particle(World world, Player player, double deg) {
super.particle(world, player, deg);
}
}

Datei anzeigen

@ -1,44 +0,0 @@
/*
*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.List;
public class CloudParticle extends SpecialParticle {
private Particle particle;
public CloudParticle(Material material, String name, List<String> lore, Particle particle) {
super(material, name, lore);
asCloud = true;
this.particle = particle;
}
@Override
public void particle(World world, Player player, double deg) {
world.spawnParticle(particle, player.getLocation().subtract(0, -0.2, 0), 5, 0.5F, 0.02F, 0.5F, 0.01);
}
}

Datei anzeigen

@ -0,0 +1,60 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Bukkit;
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;
private int count = 5;
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);
Bukkit.getOnlinePlayers().forEach(player -> {
int viewDistance = player.getClientViewDistance() * 16;
if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) {
player.spawnParticle(particle, location, count, vx, vy, vz, time, getParticleDust());
}
});
}
}

Datei anzeigen

@ -1,46 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Material;
import org.bukkit.Particle;
public enum EventParticle {
WarGearSeason(22, new int[]{12, 285, 54}, new CloudCircleParticle(Material.ENCHANTING_TABLE, "§cVerzaubert", ParticleInventory.loreBuilder(new String[]{"Wolke", "Ring"}, "WarGearSeason 1., 2. oder 3. Platz"), Particle.ENCHANTMENT_TABLE, location -> location.add(0, 1.1, 0)), new SimpleParticle(Material.BOOK, "§5Verzaubert", ParticleInventory.loreBuilder(new String[0], "WarGearSeason"), Particle.ENCHANTMENT_TABLE)),
AirshipEvent(26, new int[]{205, 9, 54, 120, 292}, new CircleParticle(Material.SNOWBALL, "§fCloud", ParticleInventory.loreBuilder(new String[]{"Ring"}, "AirshipEvent 1., 2. oder 3. Platz"), Particle.CLOUD, null, location -> location.add(0, 2.2, 0)), new SimpleParticle(Material.SNOW_BLOCK, "§fCloud", ParticleInventory.loreBuilder(new String[0], "AirshipEvent"), Particle.CLOUD)),
HellsBellsWs(28, new int[]{205, 9, 11}, new CloudCircleParticle(Material.TNT_MINECART, "§7Smoke", ParticleInventory.loreBuilder(new String[]{"Wolke", "Ring"}, "HellsBells 1., 2. oder 3. Platz"), Particle.CAMPFIRE_COSY_SMOKE, location -> location.add(0, 2.2, 0)), new CircleParticle(Material.TNT, "§8Smoke", ParticleInventory.loreBuilder(new String[]{"Ring"}, "HellsBells"), Particle.CAMPFIRE_COSY_SMOKE, null, location -> location, 0, 0, 0, 0.01)),
Underwater(31, new int[]{9, 210, 520}, new CloudParticle(Material.PRISMARINE_CRYSTALS, "§bWasser", ParticleInventory.loreBuilder(new String[]{"Wolke"}, "Underwater 1., 2. oder 3. Platz"), Particle.DRIP_WATER), new SimpleParticle(Material.PRISMARINE_BRICKS, "§bWasser", ParticleInventory.loreBuilder(new String[0], "Underwater"), Particle.DRIP_WATER));
public static EventParticle[] eventParticles = values();
EventParticle(int event, int[] placementTeams, SpecialParticle placementParticle, SpecialParticle participationParticles) {
this.event = event;
this.placementTeams = placementTeams;
this.placementParticle = placementParticle;
this.participationParticles = participationParticles;
}
public final int event;
public final int[] placementTeams;
public final SpecialParticle placementParticle;
public final SpecialParticle participationParticles;
}

Datei anzeigen

@ -0,0 +1,74 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWItem;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.sql.Event;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class EventParticleItem extends ParticleItem {
public static EventParticleItem participation(Material material, String name, int eventId) {
return new EventParticleItem(material, name, "PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION", eventId);
}
public static EventParticleItem placement(Material material, String name, int eventId) {
return new EventParticleItem(material, name, "PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT", eventId);
}
private final String eventName;
public EventParticleItem(Material material, String name, int eventId) {
this(material, name, null, eventId);
}
public EventParticleItem(Material material, String name, String unlockedBy, int eventId) {
super(material, name, unlockedBy);
eventName = Event.get(eventId).getEventName();
}
public EventParticleItem addAttribute(String attribute) {
super.addAttribute(attribute);
return this;
}
public SWItem toSWItem(Player player) {
String translatedName = LobbySystem.getMessage().parse(name, player);
List<String> lore = new ArrayList<>();
lore.add("");
if (!attributes.isEmpty()) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_ATTRIBUTE", player));
attributes.forEach(attribute -> lore.add(LobbySystem.getMessage().parse(attribute, player)));
lore.add("");
}
if (unlockedBy != null) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player));
lore.add(LobbySystem.getMessage().parse(unlockedBy, player, eventName));
lore.add("");
}
lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player));
return new SWItem(material, translatedName, lore, false, clickType -> {});
}
}

Datei anzeigen

@ -1,43 +0,0 @@
/*
*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.List;
public class FunctionalParticle extends SpecialParticle {
private ParticleFunction particleFunction;
public FunctionalParticle(Material material, String name, List<String> lore, ParticleFunction particleFunction) {
super(material, name, lore);
this.particleFunction = particleFunction;
}
@Override
public void particle(World world, Player player, double deg) {
particleFunction.accept(world, player, deg);
}
}

Datei anzeigen

@ -0,0 +1,54 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@RequiredArgsConstructor
@AllArgsConstructor
@Getter
public class ParticleData {
private final World world;
private final Player player;
private Location location;
private final double deg;
public ParticleData withLocation(Location location) {
ParticleData particleData = copy();
particleData.location = location;
return particleData;
}
public Location getLocation() {
if (location == null) {
return player.getLocation();
}
return location;
}
public ParticleData copy() {
return new ParticleData(world, player, location, deg);
}
}

Datei anzeigen

@ -1,29 +0,0 @@
/*
*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
@FunctionalInterface
public interface ParticleFunction {
void accept(World world, Player player, double time);
}

Datei anzeigen

@ -22,13 +22,14 @@ package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.particle.particles.*;
import de.steamwar.lobby.util.LobbyPlayer;
import de.steamwar.sql.Event;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.TeamTeilnahme;
import de.steamwar.sql.UserGroup;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import java.util.ArrayList;
@ -42,82 +43,10 @@ public class ParticleInventory {
private ParticleInventory() {
}
private static final List<SpecialParticle> PLAYER_PARTICLES = new ArrayList<>();
private static final List<SpecialParticle> TEAM_PARTICLES = new ArrayList<>();
private static final List<SpecialParticle> SERVERTEAM_PARTICLES = new ArrayList<>();
private static final List<SWListInv.SWListEntry<SpecialParticle>> PLAYER_PARTICLES_ENTRIES = new ArrayList<>();
private static final List<SWListInv.SWListEntry<SpecialParticle>> TEAM_PARTICLES_ENTRIES = new ArrayList<>();
private static final List<SWListInv.SWListEntry<SpecialParticle>> SERVERTEAM_PARTICLES_ENTRIES = new ArrayList<>();
static {
List<String> defaultLore = loreBuilder(null, null);
List<String> teamLore = loreBuilder(null, "Teambeitritt");
List<String> serverTeamLore = loreBuilder(null, "Serverteam");
List<String> serverTeamLore_C = loreBuilder(new String[]{"Wolke"}, "Serverteam");
List<String> serverTeamLore_R = loreBuilder(new String[]{"Ring"}, "Serverteam");
List<String> serverTeamLore_2R = loreBuilder(new String[]{"doppel Ring"}, "Serverteam");
List<String> 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 void calculateParticles(ParticleEnum[] particles, Player player, List<SWListInv.SWListEntry<ParticleEnum>> particleList) {
for (ParticleEnum particle : particles) {
particleList.add(new SWListInv.SWListEntry<>(particle.getParticle().getItem().toSWItem(player), particle));
}
}
private static SWInventory createInventory(Player player) {
@ -125,53 +54,52 @@ public class ParticleInventory {
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
List<SWListInv.SWListEntry<SpecialParticle>> particleList;
if (userGroup == UserGroup.Member) {
if (steamwarUser.getTeam() != 0) {
particleList = new ArrayList<>(TEAM_PARTICLES_ENTRIES);
} else {
if (TEAM_PARTICLES.contains(lobbyPlayer.getParticle())) {
lobbyPlayer.setParticle(null);
}
particleList = new ArrayList<>(PLAYER_PARTICLES_ENTRIES);
}
} else {
particleList = new ArrayList<>(SERVERTEAM_PARTICLES_ENTRIES);
List<SWListInv.SWListEntry<ParticleEnum>> particleList = new ArrayList<>();
calculateParticles(PlayerParticle.particles, player, particleList);
if (steamwarUser.getTeam() != 0 || userGroup != UserGroup.Member) {
calculateParticles(TeamParticle.particles, player, particleList);
}
if (userGroup != UserGroup.Member) {
calculateParticles(ServerTeamParticle.particles, player, particleList);
}
Set<Integer> events = steamwarUser.getTeam() == 0 ? new HashSet<>() : TeamTeilnahme.getEvents(steamwarUser.getTeam()).stream().map(Event::getEventID).collect(Collectors.toSet());
for (EventParticle eventParticle : EventParticle.eventParticles) {
boolean clickablePlacement = userGroup.isTeamGroup();
clickablePlacement |= (steamwarUser.getTeam() != 0 && contains(eventParticle.placementTeams, steamwarUser.getTeam()));
if (clickablePlacement) {
particleList.add(new SWListInv.SWListEntry<>(eventParticle.placementParticle.getItem(), eventParticle.placementParticle));
} else {
SWItem swItem = eventParticle.placementParticle.getItem();
swItem.setName(swItem.getItemMeta().getDisplayName() + " §8- §c§lGesperrt");
particleList.add(new SWListInv.SWListEntry<>(swItem, null));
}
if (eventParticle.placementTeams.length != 0 && (userGroup.isTeamGroup() || events.contains(eventParticle.event))) {
particleList.add(new SWListInv.SWListEntry<>(eventParticle.participationParticles.getItem(), eventParticle.participationParticles));
} else {
SWItem swItem = eventParticle.participationParticles.getItem();
swItem.setName(swItem.getItemMeta().getDisplayName() + " §8- §c§lGesperrt");
particleList.add(new SWListInv.SWListEntry<>(swItem, null));
}
if (!events.isEmpty()) {
calculateParticles(EventParticle.particles, player, particleList);
}
for (EventParticlePlacement particle : EventParticlePlacement.particles) {
boolean clickable = userGroup.isTeamGroup();
clickable |= (steamwarUser.getTeam() != 0 && contains(particle.getPlacementTeams(), steamwarUser.getTeam()));
addParticle(particleList, particle, clickable, player);
}
for (EventParticleParticipation particle : EventParticleParticipation.particles) {
boolean clickable = userGroup.isTeamGroup();
clickable |= events.contains(particle.getEvent());
addParticle(particleList, particle, clickable, player);
}
SWListInv<SpecialParticle> particleSWListInv = new SWListInv<>(player, "§6Partikel", false, particleList, (clickType, particle) -> {
SWListInv<ParticleEnum> particleSWListInv = new SWListInv<>(player, LobbySystem.getMessage().parse("PARTICLE_INVENTORY", player), false, particleList, (clickType, particle) -> {
if (particle == null) return;
lobbyPlayer.setParticle(particle);
player.closeInventory();
});
particleSWListInv.setItem(49, Material.BARRIER, "§8Keine Partikel", new ArrayList<>(), false, clickType -> {
particleSWListInv.setItem(49, Material.BARRIER, LobbySystem.getMessage().parse("PARTICLE_DESELECT", player), new ArrayList<>(), false, clickType -> {
lobbyPlayer.setParticle(null);
});
return particleSWListInv;
}
private static void addParticle(List<SWListInv.SWListEntry<ParticleEnum>> particleList, ParticleEnum particle, boolean clickable, Player player) {
if (clickable) {
particleList.add(new SWListInv.SWListEntry<>(particle.getParticle().getItem().toSWItem(player), particle));
} else {
SWItem swItem = particle.getParticle().getItem().toSWItem(player);
swItem.setName(LobbySystem.getMessage().parse("PARTICLE_LOCKED", player, swItem.getItemMeta().getDisplayName()));
particleList.add(new SWListInv.SWListEntry<>(swItem, null));
}
}
private static boolean contains(int[] ints, int element) {
for (int i : ints) {
if (i == element) return true;
@ -182,25 +110,5 @@ public class ParticleInventory {
public static void openParticleInventory(Player player) {
createInventory(player).open();
}
public static List<String> loreBuilder(String[] attribute, String unlocked) {
List<String> 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;
}
}

Datei anzeigen

@ -0,0 +1,69 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWItem;
import de.steamwar.lobby.LobbySystem;
import lombok.RequiredArgsConstructor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@RequiredArgsConstructor
public class ParticleItem {
protected final Material material;
protected final String name;
protected final Set<String> attributes = new LinkedHashSet<>();
protected String unlockedBy;
public ParticleItem(Material material, String name, String unlockedBy) {
this.material = material;
this.name = name;
this.unlockedBy = unlockedBy;
}
public ParticleItem addAttribute(String attribute) {
this.attributes.add(attribute);
return this;
}
public SWItem toSWItem(Player player) {
String translatedName = LobbySystem.getMessage().parse(name, player);
List<String> lore = new ArrayList<>();
lore.add("");
if (!attributes.isEmpty()) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_ATTRIBUTE", player));
attributes.forEach(attribute -> lore.add(LobbySystem.getMessage().parse(attribute, player)));
lore.add("");
}
if (unlockedBy != null) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player));
lore.add(LobbySystem.getMessage().parse(unlockedBy, player));
lore.add("");
}
lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player));
return new SWItem(material, translatedName, lore, false, clickType -> {});
}
}

Datei anzeigen

@ -1,62 +1,82 @@
/*
* This file is a part of the SteamWar software.
*
* This file is a part of the SteamWar software.
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* 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 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.
*
* 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 <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
import java.util.List;
public class SimpleParticle implements BaseParticle {
public class SimpleParticle extends SpecialParticle {
private Particle particle;
private final ParticleItem particleItem;
private final Particle particle;
private boolean customVelocity = false;
private float vx;
private float vy;
private float vz;
private double time = 1;
private int count = 5;
public SimpleParticle(Material material, String name, List<String> lore, Particle particle) {
super(material, name, lore);
public SimpleParticle(ParticleItem particleItem, Particle particle) {
this.particleItem = particleItem;
this.particle = particle;
}
public SimpleParticle(Material material, String name, List<String> lore, Particle particle, float vx, float vy, float vz, double time) {
super(material, name, lore);
public SimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time) {
this.particleItem = particleItem;
this.particle = particle;
customVelocity = true;
this.customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
}
@Override
public void particle(World world, Player player, double deg) {
Location location = player.getLocation().add(0.0, 0.2, 0.0);
if (customVelocity) {
world.spawnParticle(particle, location, 5, vx, vy, vz, time);
} else {
world.spawnParticle(particle, location, 5);
}
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;
}
@Override
public void particle(ParticleData particleData) {
Location location = particleData.getLocation().add(0.0, 0.2, 0.0);
Bukkit.getOnlinePlayers().forEach(player -> {
int viewDistance = player.getClientViewDistance() * 16;
if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) {
if (customVelocity) {
player.spawnParticle(particle, location, count, vx, vy, vz, time);
} else {
player.spawnParticle(particle, location, count);
}
}
});
}
}

Datei anzeigen

@ -1,84 +0,0 @@
/*
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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWItem;
import org.bukkit.Color;
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.ArrayList;
import java.util.List;
import java.util.Random;
public abstract class SpecialParticle {
private static final List<String> EMPTY_LORE = new ArrayList<>();
private static Random random = new Random();
public static Color randomColor() {
return Color.fromRGB(random.nextInt(256), random.nextInt(256), random.nextInt(256));
}
public static float randomSize() {
return random.nextFloat() / 2 + 1;
}
public static Particle.DustOptions getParticleDust() {
return new Particle.DustOptions(randomColor(), randomSize());
}
private Material material;
private String name;
private List<String> lore;
protected boolean asCloud = false;
protected SpecialParticle(Material material, String name, List<String> lore) {
if (lore == null) {
lore = EMPTY_LORE;
}
this.material = material;
this.name = name;
this.lore = lore;
}
public final SWItem getItem() {
return new SWItem(material, name, lore, false, clickType -> {});
}
public final void execute(World world, Player player, double deg) {
if (asCloud) {
if (world.getBlockAt(player.getLocation().subtract(0, 1, 0)).getType() == Material.AIR) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false));
} else {
player.removePotionEffect(PotionEffectType.SLOW_FALLING);
return;
}
}
particle(world, player, deg);
}
public abstract void particle(World world, Player player, double deg);
}

Datei anzeigen

@ -0,0 +1,75 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
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.util.Vector;
public class CircleParticle implements BaseParticle {
private ParticleItem particleItem = null;
private BaseParticle particle;
private BaseParticle particle2;
public CircleParticle(BaseParticle particle) {
this.particle = particle;
}
public CircleParticle(ParticleItem particleItem, BaseParticle particle, BaseParticle particle2) {
this.particleItem = particleItem;
this.particle = particle;
this.particle2 = particle2;
}
@Override
public ParticleItem getItem() {
if (particleItem != null) {
return particleItem.addAttribute("PARTICLE_ATTRIBUTE_BI_CIRCLE");
}
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_CIRCLE");
}
@Override
public boolean needsTick() {
return particle.needsTick() || (particle2 != null && particle2.needsTick());
}
@Override
public void particle(ParticleData particleData) {
Location location = particleData.getLocation();
Vector vector = new Vector(1, 0, 0);
vector.rotateAroundY(particleData.getDeg());
ParticleData nData = particleData.withLocation(location.clone().add(vector));
particle.particle(nData);
if (particle2 == null) {
return;
}
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
nData = particleData.withLocation(location.clone().add(vector));
particle2.particle(nData);
}
}

Datei anzeigen

@ -0,0 +1,59 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import lombok.NonNull;
import org.bukkit.Material;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class CloudParticle implements BaseParticle {
private BaseParticle particle;
public CloudParticle(@NonNull BaseParticle particle) {
this.particle = particle;
}
@Override
public ParticleItem getItem() {
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_CLOUD");
}
@Override
public boolean needsTick() {
return particle.needsTick();
}
@Override
public void particle(ParticleData particleData) {
if (particleData.getWorld().getBlockAt(particleData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType() == Material.AIR) {
particleData.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false));
} else {
particleData.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING);
return;
}
ParticleData nData = particleData.withLocation(particleData.getLocation().subtract(0, -0.2, 0));
particle.particle(nData);
}
}

Datei anzeigen

@ -0,0 +1,46 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import org.bukkit.Material;
public class NonFloorParticle implements BaseParticle {
private BaseParticle particle;
public NonFloorParticle(BaseParticle particle) {
this.particle = particle;
}
@Override
public ParticleItem getItem() {
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_NON_FLOOR");
}
@Override
public void particle(ParticleData particleData) {
if (particleData.getWorld().getBlockAt(particleData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType() == Material.AIR) {
particle.particle(particleData);
}
}
}

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import lombok.NonNull;
public class TickParticle implements BaseParticle {
private BaseParticle particle;
public TickParticle(@NonNull BaseParticle particle) {
this.particle = particle;
}
@Override
public ParticleItem getItem() {
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_TICK");
}
@Override
public boolean needsTick() {
return true;
}
@Override
public void particle(ParticleData particleData) {
particle.particle(particleData);
}
}

Datei anzeigen

@ -0,0 +1,110 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import lombok.SneakyThrows;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.util.Vector;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WingParticle implements BaseParticle, Listener {
private Map<Player, Integer> playerMap = new HashMap<>();
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
playerMap.remove(event.getPlayer());
}
public enum WingDesign {
SIMPLE("WingSimple4.png"),
COMPLEX("WingSimple2.png"),
SWORD("WingSword.png"),
SW("WingSW.png"),
WGS("WingWGS.png"),
SWORD_CROSSED("WingSwordCrossed.png"),
;
private List<Vector> vectors = new ArrayList<>();
@SneakyThrows
WingDesign(String wingResource) {
BufferedImage bufferedImage = ImageIO.read(WingParticle.class.getResourceAsStream(wingResource));
for (int x = 0; x < bufferedImage.getWidth(); x++) {
for (int y = 0; y < bufferedImage.getHeight(); y++) {
int rgb = bufferedImage.getRGB(x, y);
if (Color.WHITE.getRGB() != rgb) {
vectors.add(new Vector(x - bufferedImage.getWidth() / 2.0, bufferedImage.getHeight() - y - 1.0, 0));
}
}
}
}
}
private BaseParticle particle;
private double size;
private WingDesign wingDesign;
public WingParticle(BaseParticle particle, double size, WingDesign wingDesign) {
this.particle = particle;
this.size = size;
this.wingDesign = wingDesign;
}
@Override
public ParticleItem getItem() {
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_WING");
}
@Override
public void particle(ParticleData particleData) {
int currentNumber = playerMap.getOrDefault(particleData.getPlayer(), 0) % 20;
playerMap.put(particleData.getPlayer(), currentNumber + 1);
if (currentNumber != 0) {
return;
}
if (particleData.getPlayer().isGliding()) {
return;
}
wingDesign.vectors.forEach(dVector -> {
Vector vector = new Vector(dVector.getX() * size, 0.6 + dVector.getY() * size - (particleData.getPlayer().isSneaking() ? 0.5 : 0) , 0.5);
vector.rotateAroundY(Math.toRadians(particleData.getPlayer().getLocation().getYaw() * -1));
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
Location location = particleData.getPlayer().getLocation().clone().add(vector);
ParticleData current = particleData.withLocation(location);
particle.particle(current);
});
}
}

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 205 B

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 746 B

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 511 B

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 188 B

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 855 B

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 184 B

Datei anzeigen

@ -0,0 +1,47 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.group;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
public class ParticleGroup implements BaseParticle {
private ParticleItem particleItem;
private BaseParticle[] particles;
public ParticleGroup(ParticleItem particleItem, BaseParticle... particles) {
this.particleItem = particleItem;
this.particles = particles;
}
@Override
public ParticleItem getItem() {
return particleItem;
}
@Override
public void particle(ParticleData particleData) {
for (BaseParticle particle : particles) {
particle.particle(particleData.copy());
}
}
}

Datei anzeigen

@ -0,0 +1,54 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.mutator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import org.bukkit.Location;
import java.util.function.UnaryOperator;
public class LocationParticleMutator implements BaseParticle {
private BaseParticle particle;
private UnaryOperator<Location> mutator;
public LocationParticleMutator(BaseParticle particle, UnaryOperator<Location> mutator) {
this.particle = particle;
this.mutator = mutator;
}
@Override
public ParticleItem getItem() {
return particle.getItem();
}
@Override
public boolean needsTick() {
return particle.needsTick();
}
@Override
public void particle(ParticleData particleData) {
ParticleData nData = particleData.withLocation(mutator.apply(particleData.getLocation()));
particle.particle(nData);
}
}

Datei anzeigen

@ -0,0 +1,46 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.NonFloorParticle;
import de.steamwar.lobby.particle.decorator.TickParticle;
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 EventParticle implements ParticleEnum {
WATER(new TickParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(WATER_BUCKET, "PARTICLE_WATER", "PARTICLE_UNLOCKED_BY_EVENT"), Particle.DRIP_WATER), location -> location.add(0, 1.1, 0))))),
LAVA(new TickParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(LAVA_BUCKET, "PARTICLE_FIRE", "PARTICLE_UNLOCKED_BY_EVENT"), Particle.DRIP_LAVA), location -> location.add(0, 1.1, 0))))),
;
public static ParticleEnum[] particles = values();
@Getter
private BaseParticle particle;
}

Datei anzeigen

@ -0,0 +1,56 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.EventParticleItem;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.TickParticle;
import de.steamwar.lobby.particle.decorator.WingParticle;
import de.steamwar.lobby.particle.group.ParticleGroup;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
@Getter
public enum EventParticleParticipation implements ParticleEnum {
WarGearSeason(22, new SimpleParticle(EventParticleItem.participation(BOOK, "PARTICLE_EVENT_ENCHANTING", 22), Particle.ENCHANTMENT_TABLE)),
AirshipEvent(26, new SimpleParticle(EventParticleItem.participation(SNOW_BLOCK, "PARTICLE_EVENT_CLOUD", 26), Particle.CLOUD)),
HellsBellsWs(28, new CircleParticle(new SimpleParticle(EventParticleItem.participation(TNT, "PARTICLE_EVENT_SMOKE", 28), Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01))),
Underwater(31, new SimpleParticle(EventParticleItem.participation(PRISMARINE_BRICKS, "PARTICLE_EVENT_WATER", 31), Particle.DRIP_WATER)),
AdventWarShip(32, new ParticleGroup(EventParticleItem.participation(PRISMARINE_WALL, "PARTICLE_EVENT_WATER", 32), new SimpleParticle(null, Particle.DRIP_WATER), new SimpleParticle(null, Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))),
MiniWarGearLiga(33, new CircleParticle(new SimpleParticle(EventParticleItem.participation(PRISMARINE_SLAB, "PARTICLE_EVENT_WATER", 33), Particle.WATER_WAKE, 0, 0, 0, 0))),
// Absturz(34, null),
UnderwaterMWG(35, new TickParticle(new LocationParticleMutator(new ParticleGroup(EventParticleItem.participation(BLUE_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", 35), new SimpleParticle(null, Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new SimpleParticle(null, Particle.WATER_WAKE, 0.3F, 0.1F, 0.3F, 0.01), new LocationParticleMutator(new SimpleParticle(null, Particle.DRIP_WATER, 0.3F, 0.0F, 0.3F, 0.01), location -> location.subtract(0, 0.2, 0))), location -> location.add(0, 2.2, 0)))),
WarGearSeason2022(37, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.participation(DIAMOND_SWORD, "PARTICLE_EVENT_WINGS", 37), Particle.DRAGON_BREATH, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.COMPLEX))),
// WargearClash(38, null),
;
public static EventParticleParticipation[] particles = values();
private int event;
private BaseParticle particle;
}

Datei anzeigen

@ -0,0 +1,57 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.EventParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.CloudParticle;
import de.steamwar.lobby.particle.decorator.TickParticle;
import de.steamwar.lobby.particle.decorator.WingParticle;
import de.steamwar.lobby.particle.group.ParticleGroup;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
@Getter
public enum EventParticlePlacement implements ParticleEnum {
WarGearSeason(22, new int[]{12, 285, 54}, new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(ENCHANTING_TABLE, "PARTICLE_EVENT_ENCHANTING", 22), Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), location -> location.add(0, 1.1, 0))))),
AirshipEvent(26, new int[]{205, 9, 54, 120, 292}, new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(SNOWBALL, "PARTICLE_EVENT_CLOUD", 26), Particle.CLOUD, 0, 0, 0, 0.01), location -> location.add(0, 2.2, 0)))),
HellsBellsWs(28, new int[]{205, 9, 11}, new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(TNT_MINECART, "PARTICLE_EVENT_SMOKE", 28), Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01), location -> location.add(0, 2.2, 0))))),
Underwater(31, new int[]{9, 210, 520}, new CloudParticle(new SimpleParticle(EventParticleItem.placement(PRISMARINE_SHARD, "PARTICLE_EVENT_WATER", 31), Particle.DRIP_WATER))),
AdventWarShip(32, new int[]{9, 205, 210}, new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleGroup(EventParticleItem.placement(PRISMARINE_CRYSTALS, "PARTICLE_EVENT_WATER", 32), new SimpleParticle(null, Particle.DRIP_WATER), new SimpleParticle(null, Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))), location -> location.add(0, 1.1, 0)))),
MiniWarGearLiga(33, new int[]{9, 34, 205}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(IRON_SWORD, "PARTICLE_EVENT_WINGS", 33), Particle.WATER_WAKE, 0, 0, 0, 0, 1), 0.05, WingParticle.WingDesign.SWORD))),
Absturz(34, new int[]{210, 205, 527, 286}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(FEATHER, "PARTICLE_EVENT_WINGS", 34), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SIMPLE))),
UnderwaterMWG(35, new int[]{9, 210}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(CYAN_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", 35), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SW))),
WarGearSeason2022(37, new int[]{}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(DIAMOND_HELMET, "PARTICLE_EVENT_WGS", 37), Particle.FIREWORKS_SPARK, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.WGS))),
WargearClash(38, new int[]{210, 158, 167, 286}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(GOLDEN_SWORD, "PARTICLE_EVENT_WARGEARCLASH", 38), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.1, WingParticle.WingDesign.SWORD_CROSSED))),
;
public static EventParticlePlacement[] particles = values();
private int event;
private int[] placementTeams;
private BaseParticle particle;
}

Datei anzeigen

@ -0,0 +1,26 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.BaseParticle;
public interface ParticleEnum {
BaseParticle getParticle();
}

Datei anzeigen

@ -0,0 +1,56 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.DustSimpleParticle;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
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 PlayerParticle implements ParticleEnum {
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)),
;
public static ParticleEnum[] particles = values();
@Getter
private BaseParticle particle;
}

Datei anzeigen

@ -0,0 +1,71 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.CloudParticle;
import de.steamwar.lobby.particle.decorator.TickParticle;
import de.steamwar.lobby.particle.decorator.WingParticle;
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_UNLOCKED_BY_SERVER_TEAM"), Particle.SPELL_WITCH)),
ENCHANTING(new SimpleParticle(new ParticleItem(ENCHANTING_TABLE, "PARTICLE_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.ENCHANTMENT_TABLE)),
HAPPY(new SimpleParticle(new ParticleItem(EMERALD_BLOCK, "PARTICLE_HAPPY", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01)),
FLAME(new SimpleParticle(new ParticleItem(FLINT_AND_STEEL, "PARTICLE_FLAME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.FLAME, 0F, 0.2F, 0F, 0.01)),
END_ROD(new SimpleParticle(new ParticleItem(Material.END_ROD, "PARTICLE_END_ROD", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01)),
CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(WHITE_WOOL, "PARTICLE_CLOUD", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.CLOUD))),
TOTEM(new CloudParticle(new SimpleParticle(new ParticleItem(TOTEM_OF_UNDYING, "PARTICLE_TOTEM", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.TOTEM, 0.2F, 0.2F, 0.2F, 0.01))),
ENCHANTING_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(WHITE_DYE, "PARTICLE_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.ENCHANTMENT_TABLE))),
FLAME_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(FIRE_CORAL_BLOCK, "PARTICLE_FLAME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.FLAME))),
SNEEZE_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(LIME_SHULKER_BOX, "PARTICLE_SNEEZE", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.SNEEZE))),
SLIME_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(GREEN_SHULKER_BOX, "PARTICLE_SLIME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.SLIME))),
SMOKE_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(DEAD_BRAIN_CORAL_BLOCK, "PARTICLE_SMOKE", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.CAMPFIRE_COSY_SMOKE, 0.2F, 0.2F, 0.2F, 0.01))),
TOWN_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(FIREWORK_STAR, "PARTICLE_TOWN", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.TOWN_AURA))),
FLAME_CIRCLE(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(MAGMA_BLOCK, "PARTICLE_FLAME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), 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_UNLOCKED_BY_SERVER_TEAM"), Particle.ENCHANTMENT_TABLE, 0.2F, 0.2F, 0.2F, 0.01), location -> location.add(0, 1.1, 0)))),
NOTES_CIRCLE(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(NOTE_BLOCK, "PARTICLE_NOTES", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), 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", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), 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))),
WATER_FIRE_ALWAYS(new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleItem(MAGMA_CUBE_SPAWN_EGG, "PARTICLE_WATER_FIRE", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), 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", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), 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_ENCHANTING_ALWAYS(new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleItem(WOODEN_SWORD, "PARTICLE_MAGIC_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), 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_UNLOCKED_BY_SERVER_TEAM"), Particle.CRIT_MAGIC, 0.0F, 0.0F, 0.0F, 0.01), 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_UNLOCKED_BY_SERVER_TEAM"), Particle.FLAME, 0.0F, 0.0F, 0.0F, 0.01), 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_UNLOCKED_BY_SERVER_TEAM"), Particle.FIREWORKS_SPARK, 0.0F, 0.0F, 0.0F, 0.01), 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_UNLOCKED_BY_SERVER_TEAM"), Particle.WATER_WAKE, 0.0F, 0.0F, 0.0F, 0.01), location -> location.add(0, 1.1, 0))))),
ENCHANTING_DOUBLE_CIRCLE(new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleItem(BUBBLE_CORAL_BLOCK, "PARTICLE_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), new SimpleParticle(null, Particle.ENCHANTMENT_TABLE, 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, 2.2, 0)))),
EVIL_WINGS(new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(PURPUR_SLAB, "PARTICLE_WINGS_EVIL", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.SPELL_WITCH, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SIMPLE))),
;
public static ParticleEnum[] particles = values();
@Getter
private BaseParticle particle;
}

Datei anzeigen

@ -0,0 +1,52 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
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_UNLOCKED_BY_TEAM"), Particle.SQUID_INK, 0.2F, 0.2F, 0.2F, 0.01)),
BUBBLE(new SimpleParticle(new ParticleItem(TUBE_CORAL, "PARTICLE_BUBBLE", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.BUBBLE_POP, 0.2F, 0.2F, 0.2F, 0.01)),
HONEY(new SimpleParticle(new ParticleItem(HONEY_BOTTLE, "PARTICLE_HONEY", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.DRIPPING_HONEY, 0.2F, 0.2F, 0.2F, 1)),
NECTAR(new SimpleParticle(new ParticleItem(HONEYCOMB, "PARTICLE_NECTAR", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.FALLING_NECTAR, 0.2F, 0.2F, 0.2F, 1)),
FIREWORK(new LocationParticleMutator(new NonFloorParticle(new SimpleParticle(new ParticleItem(FIRE_CHARGE, "PARTICLE_FIREWORK", "PARTICLE_UNLOCKED_BY_TEAM"), 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_UNLOCKED_BY_TEAM"), Particle.DRAGON_BREATH, 1F, 0.2F, 1F, 0.01)),
DAMAGE(new SimpleParticle(new ParticleItem(SPIDER_EYE, "PARTICLE_DAMAGE", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)),
DOLPHIN(new SimpleParticle(new ParticleItem(BLUE_DYE, "PARTICLE_DOLPHIN", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.DOLPHIN, 0.2F, 0F, 0.2F, 0.01)),
HEART(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(RED_CONCRETE, "PARTICLE_HEART", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.HEART), location -> location.add(0, 2.2, 0)))),
;
public static ParticleEnum[] particles = values();
@Getter
private BaseParticle particle;
}

Datei anzeigen

@ -19,7 +19,9 @@
package de.steamwar.lobby.util;
import de.steamwar.lobby.particle.SpecialParticle;
import de.steamwar.lobby.particle.particles.*;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserConfig;
import org.bukkit.entity.Player;
import java.util.HashMap;
@ -30,13 +32,40 @@ public class LobbyPlayer {
private static Map<UUID, LobbyPlayer> cache = new HashMap<>();
private SpecialParticle specialParticle;
private ParticleEnum particle;
private int userId;
private boolean fly;
private LobbyPlayer(UUID uuid) {
userId = SteamwarUser.get(uuid).getId();
cache.put(uuid, this);
specialParticle = null;
particle = null;
String saved = UserConfig.getConfig(userId, "lobby-particle");
if (saved != null) {
String[] strings = saved.split("@");
switch (strings[0]) {
case "PlayerParticle":
particle = PlayerParticle.valueOf(strings[1]);
break;
case "TeamParticle":
particle = TeamParticle.valueOf(strings[1]);
break;
case "ServerTeamParticle":
particle = ServerTeamParticle.valueOf(strings[1]);
break;
case "EventParticle":
particle = EventParticle.valueOf(strings[1]);
case "EventParticleParticipation":
particle = EventParticleParticipation.valueOf(strings[1]);
break;
case "EventParticlePlacement":
particle = EventParticlePlacement.valueOf(strings[1]);
break;
default:
break;
}
}
}
public boolean isFlying() {
@ -47,12 +76,18 @@ public class LobbyPlayer {
this.fly = fly;
}
public SpecialParticle getParticle() {
return specialParticle;
public ParticleEnum getParticle() {
return particle;
}
public void setParticle(SpecialParticle specialParticle) {
this.specialParticle = specialParticle;
public void setParticle(ParticleEnum particle) {
if (particle == null) {
UserConfig.removePlayerConfig(userId, "lobby-particle");
} else {
String saved = particle.getClass().getSimpleName() + "@" + ((Enum<?>) particle).name();
UserConfig.updatePlayerConfig(userId, "lobby-particle", saved);
}
this.particle = particle;
}
public static LobbyPlayer getLobbyPlayer(UUID uuid) {
@ -63,5 +98,4 @@ public class LobbyPlayer {
public static LobbyPlayer getLobbyPlayer(Player player) {
return getLobbyPlayer(player.getUniqueId());
}
}