13
0

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

Reviewed-on: #29
Dieser Commit ist enthalten in:
YoyoNow 2023-04-08 00:53:10 +02:00
Commit ac4e89ee91
26 geänderte Dateien mit 456 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -25,6 +25,7 @@ import de.steamwar.lobby.command.HologramCommand;
import de.steamwar.lobby.command.ModifyCommand; import de.steamwar.lobby.command.ModifyCommand;
import de.steamwar.lobby.command.PortalCommand; import de.steamwar.lobby.command.PortalCommand;
import de.steamwar.lobby.jumpandrun.JumpAndRun; import de.steamwar.lobby.jumpandrun.JumpAndRun;
import de.steamwar.lobby.jumpandrun.JumpAndRunCommand;
import de.steamwar.lobby.listener.*; import de.steamwar.lobby.listener.*;
import de.steamwar.lobby.map.CustomMapCommand; import de.steamwar.lobby.map.CustomMapCommand;
import de.steamwar.lobby.particle.ParticleListener; import de.steamwar.lobby.particle.ParticleListener;
@ -61,6 +62,7 @@ public class LobbySystem extends JavaPlugin {
new CustomMapCommand(); new CustomMapCommand();
new JumpAndRun(); new JumpAndRun();
new JumpAndRunCommand();
config = new Config(getConfig()); config = new Config(getConfig());
new PlayerSpawn(); new PlayerSpawn();

Datei anzeigen

@ -52,6 +52,7 @@ PARTICLE_ATTRIBUTE_SEPARATOR = §f
PARTICLE_SELECT = §eClick to select PARTICLE_SELECT = §eClick to select
PARTICLE_LOCKED = §c§lLocked PARTICLE_LOCKED = §c§lLocked
PARTICLE_DEACTIVATED = §cThere are too many players online, particles are deactivated
PARTICLE_SNEEZE = §aSneeze PARTICLE_SNEEZE = §aSneeze
PARTICLE_SMOKE = §7Smoke PARTICLE_SMOKE = §7Smoke
@ -89,13 +90,33 @@ PARTICLE_MAGIC_ENCHANTING = §5Magic/Enchantment
PARTICLE_WINGS_EVIL = §5Purple wings PARTICLE_WINGS_EVIL = §5Purple wings
PARTICLE_PLAYER_HAYLIM_AURA = §fHaylim\'s Aura PARTICLE_PLAYER_HAYLIM_AURA = §fHaylim\'s Aura
PARTICLE_PLAYER_RONGAMER99091_AURA = §7Smoke Granade
PARTICLE_TEAM_PULSE_AURA_1 = §fPulse Aura §cFlame
PARTICLE_TEAM_PULSE_AURA_2 = §fPulse Aura §7End Rod
PARTICLE_TEAM_PULSE_AURA_3 = §fPulse Aura §fEnchanted
PARTICLE_TEAM_PULSE_LOGO = §fPulse Logo
PARTICLE_TEAM_PULSE_HEART_BEAT = §cHeart Beat
PARTICLE_RAINCLOUD_NORMAL = §fRaincloud
PARTICLE_RAINCLOUD_RED = §fLava cloud
PARTICLE_RAINCLOUD_YELLOW = §fNectar cloud
PARTICLE_RAINCLOUD_ORANGE = §fHoney cloud
PARTICLE_RAINCLOUD_GREEN = §fSpore Blossom cloud
PARTICLE_RAINCLOUD_PURPLE = §fObsidian Tears cloud
PARTICLE_RAINCLOUD_NAUTILUS = §fNautilus cloud
PARTICLE_RAINCLOUD_ENCHANTMENT = §fEnchantment cloud
PARTICLE_RAINCLOUD_SLIME = §fSlime cloud
PARTICLE_RAINCLOUD_HAIL = §fHail cloud
PARTICLE_RAINCLOUD_SNOW = §fSnow cloud
PARTICLE_RAINCLOUD_TOTEM = §fTotem cloud
PARTICLE_EVENT_ENCHANTING = §cEnchantment PARTICLE_EVENT_ENCHANTING = §cEnchantment
PARTICLE_EVENT_CLOUD = §fClouds PARTICLE_EVENT_CLOUD = §fClouds
PARTICLE_EVENT_SMOKE = §7Smoke PARTICLE_EVENT_SMOKE = §7Smoke
PARTICLE_EVENT_WATER = §bWater PARTICLE_EVENT_WATER = §bWater
PARTICLE_EVENT_WINGS = §fWings PARTICLE_EVENT_WINGS = §fWings
PARTICLE_EVENT_RAIN_CLOUD = §fRaincloud PARTICLE_EVENT_RAIN_CLOUD = §fRandom Raincloud
PARTICLE_EVENT_WGS = §fWGS PARTICLE_EVENT_WGS = §fWGS
PARTICLE_EVENT_WARGEARCLASH = §fClash PARTICLE_EVENT_WARGEARCLASH = §fClash
@ -110,6 +131,9 @@ JUMP_AND_RUN_PROGRESS = §e{0}§8/§f{1} §c{2} §7{3}
JUMP_AND_RUN_CANCEL = {0} JUMP_AND_RUN_CANCEL = {0}
JUMP_AND_RUN_TIME = mm:ss SSS JUMP_AND_RUN_TIME = mm:ss SSS
JUMP_AND_RUN_FINISHED = §aFinished in {0} with {1} fails JUMP_AND_RUN_FINISHED = §aFinished in {0} with {1} fails
JUMP_AND_RUN_PERSONAL_BEST = §aNice! You beat your personal best by {0}
JUMP_AND_RUN_PERSONAL_BEST_TIME = §aPersonal best in {0}
JUMP_AND_RUN_PERSONAL_BEST_NO_TIME = §cNo personal best
# Easter Egg Hunt # Easter Egg Hunt
DIFFICULTY_EASY = §aEasy DIFFICULTY_EASY = §aEasy

Datei anzeigen

@ -51,6 +51,7 @@ PARTICLE_ATTRIBUTE = §eAttribute§7:
PARTICLE_SELECT = §eZum Auswählen klicken PARTICLE_SELECT = §eZum Auswählen klicken
PARTICLE_LOCKED = §c§lGesperrt PARTICLE_LOCKED = §c§lGesperrt
PARTICLE_DEACTIVATED = §cEs sind zu viele Spieler online! Partikel sind deaktiviert.
PARTICLE_SNEEZE = §aSneeze PARTICLE_SNEEZE = §aSneeze
PARTICLE_SMOKE = §7Rauch PARTICLE_SMOKE = §7Rauch
@ -87,6 +88,23 @@ PARTICLE_WATER_FIRE = §bWasser§7/§cFeuer
PARTICLE_MAGIC_ENCHANTING = §5Magie§7/§eZauber PARTICLE_MAGIC_ENCHANTING = §5Magie§7/§eZauber
PARTICLE_WINGS_EVIL = §5Lila Flügel PARTICLE_WINGS_EVIL = §5Lila Flügel
PARTICLE_PLAYER_RONGAMER99091_AURA = §7Rauchgranate
PARTICLE_TEAM_PULSE_HEART_BEAT = §cHerzschlag
PARTICLE_RAINCLOUD_NORMAL = §fRegenwolke
PARTICLE_RAINCLOUD_RED = §fLavawolke
PARTICLE_RAINCLOUD_YELLOW = §fNektarwolke
PARTICLE_RAINCLOUD_ORANGE = §fHonigwolke
PARTICLE_RAINCLOUD_GREEN = §fSporenwolke
PARTICLE_RAINCLOUD_PURPLE = §fObsidanwolke
PARTICLE_RAINCLOUD_NAUTILUS = §fNautiluswolke
PARTICLE_RAINCLOUD_ENCHANTMENT = §fVerzauberungswolke
PARTICLE_RAINCLOUD_SLIME = §fSchleimwolke
PARTICLE_RAINCLOUD_HAIL = §fHagelwolke
PARTICLE_RAINCLOUD_SNOW = §fSchneewolke
PARTICLE_RAINCLOUD_TOTEM = §fTotemwolke
PARTICLE_EVENT_ENCHANTING = §cVerzaubert PARTICLE_EVENT_ENCHANTING = §cVerzaubert
PARTICLE_EVENT_CLOUD = §fWolken PARTICLE_EVENT_CLOUD = §fWolken
PARTICLE_EVENT_SMOKE = §7Rauch PARTICLE_EVENT_SMOKE = §7Rauch
@ -104,6 +122,9 @@ PARTICLE_EGG_HUNT_ADVANCED = §5Abheben
PARTICLE_EGG_HUNT_HALF = §fDie Jagd ist eröffnet PARTICLE_EGG_HUNT_HALF = §fDie Jagd ist eröffnet
JUMP_AND_RUN_FINISHED = §aBeendet in {0} mit {1} Fails JUMP_AND_RUN_FINISHED = §aBeendet in {0} mit {1} Fails
JUMP_AND_RUN_PERSONAL_BEST = §aNice! Du hast deinen Rekord um {0} verbessert!
JUMP_AND_RUN_PERSONAL_BEST_TIME = §aDein Rekord ist {0}
JUMP_AND_RUN_PERSONAL_BEST_NO_TIME = §cDu hast noch keinen Rekord
# Easter Egg Hunt # Easter Egg Hunt
DIFFICULTY_EASY = §aLeicht DIFFICULTY_EASY = §aLeicht

Datei anzeigen

@ -3,6 +3,7 @@ package de.steamwar.lobby.jumpandrun;
import de.steamwar.lobby.LobbySystem; import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.listener.BasicListener; import de.steamwar.lobby.listener.BasicListener;
import de.steamwar.lobby.listener.PlayerSpawn; import de.steamwar.lobby.listener.PlayerSpawn;
import de.steamwar.sql.UserConfig;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -121,10 +122,26 @@ public class JumpAndRun extends BasicListener {
SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", event.getPlayer()), Locale.ROOT); SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", event.getPlayer()), Locale.ROOT);
String parsed = format.format(new Date(time)); String parsed = format.format(new Date(time));
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_FINISHED", event.getPlayer(), parsed.substring(0, parsed.length() - 2), FAILS.get(event.getPlayer())); LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_FINISHED", event.getPlayer(), parsed.substring(0, parsed.length() - 2), FAILS.get(event.getPlayer()));
updateJumpAndRunTime(event.getPlayer(), time);
reset(event.getPlayer()); reset(event.getPlayer());
} }
} }
private void updateJumpAndRunTime(Player player, long time) {
String jumpAndRunTimeConfig = UserConfig.getConfig(player.getUniqueId(), "jump_and_run");
if (jumpAndRunTimeConfig == null) {
UserConfig.updatePlayerConfig(player.getUniqueId(), "jump_and_run", time + "");
} else {
long jumpAndRunTime = Long.parseLong(jumpAndRunTimeConfig);
if (time < jumpAndRunTime) {
SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", player), Locale.ROOT);
String parsed = format.format(new Date(jumpAndRunTime - time));
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST", player, parsed);
UserConfig.updatePlayerConfig(player.getUniqueId(), "jump_and_run", time + "");
}
}
}
@EventHandler @EventHandler
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();

Datei anzeigen

@ -0,0 +1,30 @@
package de.steamwar.lobby.jumpandrun;
import de.steamwar.command.SWCommand;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.sql.UserConfig;
import org.bukkit.entity.Player;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class JumpAndRunCommand extends SWCommand {
public JumpAndRunCommand() {
super("jumpandrun");
}
@Register
public void genericCommand(Player player, String... args) {
String time = UserConfig.getConfig(player.getUniqueId(), "jump_and_run");
if (time == null) {
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST_NO_TIME", player);
return;
}
long timeLong = Long.parseLong(time);
SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", player), Locale.ROOT);
String parsed = format.format(new Date(timeLong));
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST_TIME", player, parsed);
}
}

Datei anzeigen

@ -24,8 +24,15 @@ public interface ParticleElement {
return new Particle.DustOptions(randomColor(), randomSize()); return new Particle.DustOptions(randomColor(), randomSize());
} }
default void display(Location location, Consumer<Player> consumer) { default void display(Location location, Player root, boolean onlySelf, boolean onlyOther, Consumer<Player> consumer) {
if (onlySelf) {
consumer.accept(root);
return;
}
Bukkit.getOnlinePlayers().forEach(player -> { Bukkit.getOnlinePlayers().forEach(player -> {
if (onlyOther && player == root) {
return;
}
int viewDistance = player.getClientViewDistance() * 16; int viewDistance = player.getClientViewDistance() * 16;
if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) { if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) {
consumer.accept(player); consumer.accept(player);

Datei anzeigen

@ -32,6 +32,7 @@ public class ParticleInventory {
CustomPlayerParticle.class, CustomPlayerParticle.class,
TeamParticle.class, TeamParticle.class,
CustomTeamParticle.class, CustomTeamParticle.class,
RainCloudParticle.class,
ServerTeamParticle.class, ServerTeamParticle.class,
EventParticle.class, EventParticle.class,
EventParticlePlacement.class, EventParticlePlacement.class,
@ -60,7 +61,6 @@ public class ParticleInventory {
return null; return null;
} }
} }
// TODO: Add conversion from last version
return null; return null;
} }
@ -84,6 +84,9 @@ public class ParticleInventory {
if (particle == null) return; if (particle == null) return;
lobbyPlayer.setParticle(particle); lobbyPlayer.setParticle(particle);
player.closeInventory(); player.closeInventory();
if (ParticleListener.disabled(player)) {
LobbySystem.getMessage().send("PARTICLE_DEACTIVATED", player);
}
}); });
particleSWListInv.setItem(48, Material.BARRIER, LobbySystem.getMessage().parse("PARTICLE_DESELECT", player), new ArrayList<>(), false, clickType -> { particleSWListInv.setItem(48, Material.BARRIER, LobbySystem.getMessage().parse("PARTICLE_DESELECT", player), new ArrayList<>(), false, clickType -> {
lobbyPlayer.setParticle(null); lobbyPlayer.setParticle(null);

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.lobby.jumpandrun.JumpAndRun;
import de.steamwar.lobby.listener.BasicListener; import de.steamwar.lobby.listener.BasicListener;
import de.steamwar.lobby.listener.PlayerSpawn; import de.steamwar.lobby.listener.PlayerSpawn;
import de.steamwar.lobby.util.LobbyPlayer; import de.steamwar.lobby.util.LobbyPlayer;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -39,6 +40,7 @@ import java.util.Map;
public class ParticleListener extends BasicListener { public class ParticleListener extends BasicListener {
private static final int PLAYER_MAX_SIZE = 20; private static final int PLAYER_MAX_SIZE = 20;
private static final int SERVER_TEAM_MAX_SIZE = 40;
private static double deg = 0; private static double deg = 0;
@ -48,12 +50,10 @@ public class ParticleListener extends BasicListener {
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> { Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
movingPlayers.replaceAll((player, integer) -> integer - 1); movingPlayers.replaceAll((player, integer) -> integer - 1);
movingPlayers.entrySet().removeIf(entry -> entry.getValue() <= 0); movingPlayers.entrySet().removeIf(entry -> entry.getValue() <= 0);
if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) {
return;
}
deg += 0.1; deg += 0.1;
if (deg > 360) deg = 0; if (deg > 360) deg = 0;
Bukkit.getOnlinePlayers().forEach(player -> { Bukkit.getOnlinePlayers().forEach(player -> {
if (disabled(player)) return;
if (JumpAndRun.isPlayerInJumpAndRun(player)) return; if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
ParticleEnum particle = lobbyPlayer.getParticle(); ParticleEnum particle = lobbyPlayer.getParticle();
@ -69,7 +69,6 @@ public class ParticleListener extends BasicListener {
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void handlePlayerInteract(PlayerInteractEvent event) { public void handlePlayerInteract(PlayerInteractEvent event) {
if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (JumpAndRun.isPlayerInJumpAndRun(player)) return; if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
if (!PlayerSpawn.PARTICLE.equals(event.getItem())) return; if (!PlayerSpawn.PARTICLE.equals(event.getItem())) return;
@ -80,8 +79,8 @@ public class ParticleListener extends BasicListener {
@EventHandler @EventHandler
public void handlePlayerMove(PlayerMoveEvent event) { public void handlePlayerMove(PlayerMoveEvent event) {
if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (disabled(player)) return;
if (JumpAndRun.isPlayerInJumpAndRun(player)) return; if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
ParticleEnum particle = lobbyPlayer.getParticle(); ParticleEnum particle = lobbyPlayer.getParticle();
@ -108,4 +107,10 @@ public class ParticleListener extends BasicListener {
event.setCancelled(true); event.setCancelled(true);
} }
} }
public static boolean disabled(Player player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if (Bukkit.getOnlinePlayers().size() > SERVER_TEAM_MAX_SIZE) return true;
return Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE && !user.getUserGroup().isAdminGroup();
}
} }

Datei anzeigen

@ -17,6 +17,8 @@ public class ParticleTickData {
private Location location; private Location location;
private final double deg; private final double deg;
private final boolean isMoving; private final boolean isMoving;
private boolean onlySelf = false;
private boolean onlyOthers = false;
public ParticleTickData withLocation(Location location) { public ParticleTickData withLocation(Location location) {
ParticleTickData particleTickData = copy(); ParticleTickData particleTickData = copy();
@ -24,6 +26,18 @@ public class ParticleTickData {
return particleTickData; return particleTickData;
} }
public ParticleTickData onlySelf() {
ParticleTickData particleTickData = copy();
particleTickData.onlySelf = true;
return particleTickData;
}
public ParticleTickData onlyOthers() {
ParticleTickData particleTickData = copy();
particleTickData.onlyOthers = true;
return particleTickData;
}
public Location getLocation() { public Location getLocation() {
if (location == null) { if (location == null) {
return player.getLocation(); return player.getLocation();
@ -32,6 +46,6 @@ public class ParticleTickData {
} }
public ParticleTickData copy() { public ParticleTickData copy() {
return new ParticleTickData(world, player, location, deg, isMoving); return new ParticleTickData(world, player, location, deg, isMoving, onlySelf, onlyOthers);
} }
} }

Datei anzeigen

@ -50,4 +50,5 @@ public interface WingDesign {
WingDesign MWGL = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/MWGL.png")); WingDesign MWGL = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/MWGL.png"));
WingDesign ECLIPSE = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/ECLIPSE-Logo.png")); WingDesign ECLIPSE = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/ECLIPSE-Logo.png"));
WingDesign PL = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/PL-Logo.png"));
} }

Binäre Datei nicht angezeigt.

Nachher

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

Binäre Datei nicht angezeigt.

Nachher

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

Datei anzeigen

@ -7,8 +7,19 @@ import org.bukkit.util.Vector;
public class Circle extends DelegatingParticleElement { public class Circle extends DelegatingParticleElement {
private double distance;
private double speed;
public Circle(ParticleElement particleElement) { public Circle(ParticleElement particleElement) {
super(particleElement); super(particleElement);
this.distance = 1;
this.speed = 1;
}
public Circle(ParticleElement particleElement, double distance, double speed) {
super(particleElement);
this.distance = distance;
this.speed = speed;
} }
@Override @Override
@ -20,8 +31,8 @@ public class Circle extends DelegatingParticleElement {
public void tick(ParticleTickData particleTickData) { public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation(); Location location = particleTickData.getLocation();
Vector vector = new Vector(1, 0, 0); Vector vector = new Vector(distance, 0, 0);
vector.rotateAroundY(particleTickData.getDeg()); vector.rotateAroundY((particleTickData.getDeg() * speed) % 360);
ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector)); ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
particleElement.tick(nParticleTickData); particleElement.tick(nParticleTickData);
} }

Datei anzeigen

@ -10,9 +10,21 @@ public class DoubleCircle extends Circle {
private ParticleElement second; private ParticleElement second;
private double distance;
private double speed;
public DoubleCircle(ParticleElement first, ParticleElement second) { public DoubleCircle(ParticleElement first, ParticleElement second) {
super(first); super(first);
this.second = second; this.second = second;
this.distance = 1;
this.speed = 1;
}
public DoubleCircle(ParticleElement first, ParticleElement second, double distance, double speed) {
super(first);
this.second = second;
this.distance = distance;
this.speed = speed;
} }
@Override @Override
@ -25,7 +37,6 @@ public class DoubleCircle extends Circle {
if (particleElement.tickType() == second.tickType()) { if (particleElement.tickType() == second.tickType()) {
return particleElement.tickType(); return particleElement.tickType();
} }
// TODO: This could be improved but I will not do it
return ParticleTickType.MOVE; return ParticleTickType.MOVE;
} }
@ -33,8 +44,8 @@ public class DoubleCircle extends Circle {
public void tick(ParticleTickData particleTickData) { public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation(); Location location = particleTickData.getLocation();
Vector vector = new Vector(1, 0, 0); Vector vector = new Vector(distance, 0, 0);
vector.rotateAroundY(particleTickData.getDeg()); vector.rotateAroundY((particleTickData.getDeg() * speed) % 360);
ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector)); ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
particleElement.tick(nParticleTickData); particleElement.tick(nParticleTickData);

Datei anzeigen

@ -37,7 +37,7 @@ public class DustParticle implements ParticleElement {
@Override @Override
public void tick(ParticleTickData particleTickData) { public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0); Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0);
display(location, player -> { display(location, particleTickData.getPlayer(), particleTickData.isOnlySelf(), particleTickData.isOnlyOthers(), player -> {
player.spawnParticle(particle, location, count, vx, vy, vz, speed, randomParticleDust()); player.spawnParticle(particle, location, count, vx, vy, vz, speed, randomParticleDust());
}); });
} }

Datei anzeigen

@ -0,0 +1,21 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class OnlyOthers extends DelegatingParticleElement {
public OnlyOthers(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
particleElement.tick(particleTickData.onlyOthers());
}
}

Datei anzeigen

@ -0,0 +1,21 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class OnlySelf extends DelegatingParticleElement {
public OnlySelf(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
particleElement.tick(particleTickData.onlySelf());
}
}

Datei anzeigen

@ -0,0 +1,57 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
public class RandomParticle implements ParticleElement {
private RandomData randomData;
private ParticleEnum[] particleEnums;
private static class RandomData implements Listener {
private Random random = new Random();
private int max;
private Map<Player, Integer> data = new HashMap<>();
public RandomData(int max) {
this.max = max;
}
@EventHandler(ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent event) {
data.put(event.getPlayer(), random.nextInt(max));
}
@EventHandler(ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) {
data.remove(event.getPlayer());
}
}
public RandomParticle(ParticleEnum... particleEnums) {
if (particleEnums.length == 0) {
throw new IllegalArgumentException("ParticleEnums must not be empty");
}
this.randomData = new RandomData(particleEnums.length);
Bukkit.getPluginManager().registerEvents(randomData, LobbySystem.getPlugin());
this.particleEnums = particleEnums;
}
@Override
public void tick(ParticleTickData particleTickData) {
int currentNumber = randomData.data.getOrDefault(particleTickData.getPlayer(), 0);
particleEnums[currentNumber].getParticle().getParticleElement().tick(particleTickData);
}
}

Datei anzeigen

@ -55,7 +55,7 @@ public class SimpleParticle implements ParticleElement {
@Override @Override
public void tick(ParticleTickData particleTickData) { public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0); Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0);
display(location, player -> { display(location, particleTickData.getPlayer(), particleTickData.isOnlySelf(), particleTickData.isOnlyOthers(), player -> {
if (customVelocity) { if (customVelocity) {
player.spawnParticle(particle, location, count, vx, vy, vz, time); player.spawnParticle(particle, location, count, vx, vy, vz, time);
} else { } else {

Datei anzeigen

@ -0,0 +1,44 @@
package de.steamwar.lobby.particle.elements.custom;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
import org.bukkit.Location;
import org.bukkit.util.Vector;
public class HearthBeat extends DelegatingParticleElement {
private double speed;
private double y(double time) {
double d1 = Math.pow(2, -Math.pow(time * 17 - 7.5, 2));
double d2 = Math.pow(2, -Math.pow(time * 20 - 11, 2)) * 0.5;
double d3 = Math.pow(2, -Math.pow(time * 25 - 17, 2)) * 0.1;
return (d1 - d2 + d3) * 0.5;
}
public HearthBeat(ParticleElement particleElement, double speed) {
super(particleElement);
this.speed = speed;
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
double time = ((particleTickData.getDeg() * speed) % 360) / 360.0;
double y = y(time) * 2;
double x = (time - 0.5) * 2;
Vector vector = new Vector(x, 1.1 + y - (particleTickData.getPlayer().isSneaking() ? 0.5 : 0), 0.7);
vector.rotateAroundY(Math.toRadians(particleTickData.getPlayer().getLocation().getYaw() * -1));
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
Location location = particleTickData.getPlayer().getLocation().clone().add(vector);
ParticleTickData current = particleTickData.withLocation(location);
particleElement.tick(current);
}
}

Datei anzeigen

@ -0,0 +1,50 @@
package de.steamwar.lobby.particle.elements.custom;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
import org.bukkit.util.Vector;
public class PulseShimmer extends DelegatingParticleElement {
private int speed;
private int rotationSpeed;
private double x(double time) {
if (time < 0.45) {
return Math.pow(2, -Math.pow((time - 0.45) * 6, 2)) * 0.8;
} else {
return Math.pow(2, -Math.pow((time - 0.45) * 4, 2)) * 0.8;
}
}
private double y(double time) {
return (8 * Math.pow(time, 2.2) - time) / (6.5 / 3.5) -0.1;
}
public PulseShimmer(ParticleElement particleElement, int speed, int rotationSpeed) {
super(particleElement);
this.speed = speed;
this.rotationSpeed = rotationSpeed;
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
double time = ((particleTickData.getDeg() * speed) % 360) / 360.0;
double x = x(time);
double y = y(time);
Vector vector = new Vector(x, y, 0);
vector.rotateAroundY((particleTickData.getDeg() * rotationSpeed) % 360);
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
vector.rotateAroundY(90);
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
vector.rotateAroundY(90);
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
}
}

Datei anzeigen

@ -32,7 +32,7 @@ public enum EventParticleParticipation implements ParticleEnum {
new Circle(new SimpleParticle(Particle.WATER_WAKE, 0, 0, 0, 0))) new Circle(new SimpleParticle(Particle.WATER_WAKE, 0, 0, 0, 0)))
), ),
UnderwaterMWG(new ParticleData(Material.BLUE_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", ParticleRequirement.eventParticipation(35), UnderwaterMWG(new ParticleData(Material.BLUE_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", ParticleRequirement.eventParticipation(35),
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new SimpleParticle(Particle.WATER_WAKE, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.DRIP_WATER, 0.3F, 0.0F, 0.3F, 0.01), 0, 0.2, 0)), 0, 2.2, 0))) new Always(new RandomParticle(RainCloudParticle.values())))
), ),
WarGearSeason2022(new ParticleData(Material.DIAMOND_SWORD, "PARTICLE_EVENT_WINGS", ParticleRequirement.eventParticipation(37), WarGearSeason2022(new ParticleData(Material.DIAMOND_SWORD, "PARTICLE_EVENT_WINGS", ParticleRequirement.eventParticipation(37),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.DRAGON_BREATH, 0, 0, 0, 0, 1), 0.15, WingDesign.COMPLEX)), 20))) new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.DRAGON_BREATH, 0, 0, 0, 0, 1), 0.15, WingDesign.COMPLEX)), 20)))

Datei anzeigen

@ -0,0 +1,59 @@
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.elements.Always;
import de.steamwar.lobby.particle.elements.Group;
import de.steamwar.lobby.particle.elements.LocationMutator;
import de.steamwar.lobby.particle.elements.SimpleParticle;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
@AllArgsConstructor
public enum RainCloudParticle implements ParticleEnum {
Raincloud(new ParticleData(Material.BLUE_CARPET, "PARTICLE_RAINCLOUD_NORMAL", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new SimpleParticle(Particle.WATER_WAKE, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.DRIP_WATER, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Red_Raincloud(new ParticleData(Material.RED_CARPET, "PARTICLE_RAINCLOUD_RED", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.DRIP_LAVA, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Yellow_Raincloud(new ParticleData(Material.YELLOW_CARPET, "PARTICLE_RAINCLOUD_YELLOW", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.FALLING_NECTAR, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Orange_Raincloud(new ParticleData(Material.ORANGE_CARPET, "PARTICLE_RAINCLOUD_ORANGE", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.FALLING_HONEY, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Green_Raincloud(new ParticleData(Material.LIME_CARPET, "PARTICLE_RAINCLOUD_GREEN", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.FALLING_SPORE_BLOSSOM, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Purple_Raincloud(new ParticleData(Material.PURPLE_CARPET, "PARTICLE_RAINCLOUD_PURPLE", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.FALLING_OBSIDIAN_TEAR, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Nautilus_Raincloud(new ParticleData(Material.NAUTILUS_SHELL, "PARTICLE_RAINCLOUD_NAUTILUS", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.NAUTILUS, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Enchantment_Raincloud(new ParticleData(Material.ENCHANTED_BOOK, "PARTICLE_RAINCLOUD_ENCHANTMENT", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Slime_Raincloud(new ParticleData(Material.GREEN_CARPET, "PARTICLE_RAINCLOUD_SLIME", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.SLIME, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Hail_Raincloud(new ParticleData(Material.LIGHT_GRAY_CARPET, "PARTICLE_RAINCLOUD_HAIL", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.SNOWBALL, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Snow_Raincloud(new ParticleData(Material.WHITE_CARPET, "PARTICLE_RAINCLOUD_SNOW", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.SNOWFLAKE, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Totem_Raincloud(new ParticleData(Material.TOTEM_OF_UNDYING, "PARTICLE_RAINCLOUD_TOTEM", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.TOTEM, 0.3F, 0.0F, 0.3F, 0.01, 2), 0, -0.3, 0)), 0, 2.4, 0)))
),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
}

Datei anzeigen

@ -2,12 +2,40 @@ package de.steamwar.lobby.particle.particles.custom;
import de.steamwar.lobby.particle.ParticleData; import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum; import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.elements.*;
import de.steamwar.lobby.particle.elements.custom.HearthBeat;
import de.steamwar.lobby.particle.elements.custom.NonMoving;
import de.steamwar.lobby.particle.elements.custom.PulseShimmer;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
@AllArgsConstructor @AllArgsConstructor
public enum CustomEasterParticle implements ParticleEnum { public enum CustomEasterParticle implements ParticleEnum {
/*
Lord_Loading(new ParticleData(Material.ENDER_PEARL, "Loading Test", ParticleRequirement.easterEventSpecificPlayer(1063),
new Always(new DoubleCircle(new DoubleCircle(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01, 1),
new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01, 1), 0.5, 4),
new DoubleCircle(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01, 1),
new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01, 1), 0.5, 4), 1.5, 1)))
),
*/
Rongamer99091(new ParticleData(Material.GUNPOWDER, "PARTICLE_PLAYER_RONGAMER99091_AURA", ParticleRequirement.easterEventSpecificPlayer(10697),
new Always(new Sneaking(new Group(
new OnlySelf(new Delayed(new SimpleParticle(Particle.EXPLOSION_HUGE, 0, 0, 0, 0.01, 1), 20)),
new OnlyOthers(new Delayed(new SimpleParticle(Particle.EXPLOSION_HUGE, 0, 0, 0, 0.01, 1), 2))
))))
),
Pulse_EASTER_1(new ParticleData(Material.RED_CANDLE, "PARTICLE_TEAM_PULSE_AURA_1", ParticleRequirement.easterEventSpecificTeam(210),
new Always(new NonMoving(new PulseShimmer(new SimpleParticle(Particle.FLAME, 0, 0, 0, 0, 1), 80, 2))))
),
Pulse_EASTER_3(new ParticleData(Material.APPLE, "PARTICLE_TEAM_PULSE_HEART_BEAT", ParticleRequirement.easterEventSpecificTeam(210),
new Always(new NonFlying(new HearthBeat(new SimpleParticle(Particle.FLAME, 0, 0, 0, 0, 1), 80))))
),
; ;
public static ParticleEnum[] particles = values(); public static ParticleEnum[] particles = values();

Datei anzeigen

@ -5,6 +5,8 @@ import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement; import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.WingDesign; import de.steamwar.lobby.particle.WingDesign;
import de.steamwar.lobby.particle.elements.*; import de.steamwar.lobby.particle.elements.*;
import de.steamwar.lobby.particle.elements.custom.NonMoving;
import de.steamwar.lobby.particle.elements.custom.PulseShimmer;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Material; import org.bukkit.Material;
@ -14,7 +16,16 @@ import org.bukkit.Particle;
public enum CustomTeamParticle implements ParticleEnum { public enum CustomTeamParticle implements ParticleEnum {
Eclipse(new ParticleData(Material.ENDER_CHEST, "PARTICLE_EVENT_ENCHANTING", ParticleRequirement.specificTeam(34), Eclipse(new ParticleData(Material.ENDER_CHEST, "PARTICLE_EVENT_ENCHANTING", ParticleRequirement.specificTeam(34),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.PORTAL, 0, 0, 0, 0.01), 0.15, WingDesign.ECLIPSE)), 20))) new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.END_ROD, 0, 0, 0, 0, 1), 0.15, WingDesign.ECLIPSE)), 80)))
),
Pulse_1(new ParticleData(Material.GRAY_CANDLE, "PARTICLE_TEAM_PULSE_AURA_2", ParticleRequirement.specificTeam(210),
new Always(new NonMoving(new PulseShimmer(new SimpleParticle(Particle.END_ROD, 0, 0, 0, 0, 1), 80, 2))))
),
Pulse_2(new ParticleData(Material.WHITE_CANDLE, "PARTICLE_TEAM_PULSE_AURA_3", ParticleRequirement.specificTeam(210),
new Always(new NonMoving(new PulseShimmer(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0, 5), 80, 2))))
),
Pulse_Logo(new ParticleData(Material.ENDER_CHEST, "PARTICLE_TEAM_PULSE_LOGO", ParticleRequirement.specificTeam(210),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.END_ROD, 0, 0, 0, 0, 1), 0.15, WingDesign.PL)), 80)))
), ),
; ;
public static ParticleEnum[] particles = values(); public static ParticleEnum[] particles = values();