From 9b8c336cad6953a40452b90d63831e2ab2666063 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 7 Apr 2023 17:25:23 +0200 Subject: [PATCH 1/6] Add some custom particles and other stuff --- src/de/steamwar/lobby/LobbySystem.properties | 22 ++++++- .../steamwar/lobby/LobbySystem_de.properties | 16 +++++ .../lobby/particle/ParticleElement.java | 9 ++- .../lobby/particle/ParticleInventory.java | 5 +- .../lobby/particle/ParticleListener.java | 15 +++-- .../lobby/particle/ParticleTickData.java | 16 ++++- .../steamwar/lobby/particle/WingDesign.java | 1 + .../lobby/particle/decorator/PL-Logo-Old.png | Bin 0 -> 129 bytes .../lobby/particle/decorator/PL-Logo.png | Bin 0 -> 140 bytes .../lobby/particle/elements/Circle.java | 15 ++++- .../lobby/particle/elements/DoubleCircle.java | 17 ++++- .../lobby/particle/elements/DustParticle.java | 2 +- .../lobby/particle/elements/OnlyOthers.java | 21 +++++++ .../lobby/particle/elements/OnlySelf.java | 21 +++++++ .../particle/elements/RandomParticle.java | 57 +++++++++++++++++ .../particle/elements/SimpleParticle.java | 2 +- .../elements/custom/PulseShimmer.java | 50 +++++++++++++++ .../particles/EventParticleParticipation.java | 2 +- .../particle/particles/RainCloudParticle.java | 59 ++++++++++++++++++ .../custom/CustomEasterParticle.java | 26 ++++++++ .../particles/custom/CustomTeamParticle.java | 10 ++- 21 files changed, 348 insertions(+), 18 deletions(-) create mode 100644 src/de/steamwar/lobby/particle/decorator/PL-Logo-Old.png create mode 100644 src/de/steamwar/lobby/particle/decorator/PL-Logo.png create mode 100644 src/de/steamwar/lobby/particle/elements/OnlyOthers.java create mode 100644 src/de/steamwar/lobby/particle/elements/OnlySelf.java create mode 100644 src/de/steamwar/lobby/particle/elements/RandomParticle.java create mode 100644 src/de/steamwar/lobby/particle/elements/custom/PulseShimmer.java create mode 100644 src/de/steamwar/lobby/particle/particles/RainCloudParticle.java diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 8cc5995..70e0c9c 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -52,6 +52,7 @@ PARTICLE_ATTRIBUTE_SEPARATOR = §f PARTICLE_SELECT = §eClick to select PARTICLE_LOCKED = §c§lLocked +PARTICLE_DEACTIVATED = §cThere are too many players online, particles are deactivated PARTICLE_SNEEZE = §aSneeze PARTICLE_SMOKE = §7Smoke @@ -89,13 +90,32 @@ PARTICLE_MAGIC_ENCHANTING = §5Magic/Enchantment PARTICLE_WINGS_EVIL = §5Purple wings 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_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_CLOUD = §fClouds PARTICLE_EVENT_SMOKE = §7Smoke PARTICLE_EVENT_WATER = §bWater PARTICLE_EVENT_WINGS = §fWings -PARTICLE_EVENT_RAIN_CLOUD = §fRaincloud +PARTICLE_EVENT_RAIN_CLOUD = §fRandom Raincloud PARTICLE_EVENT_WGS = §fWGS PARTICLE_EVENT_WARGEARCLASH = §fClash diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index a836eeb..c5ff141 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -51,6 +51,7 @@ PARTICLE_ATTRIBUTE = §eAttribute§7: PARTICLE_SELECT = §eZum Auswählen klicken PARTICLE_LOCKED = §c§lGesperrt +PARTICLE_DEACTIVATED = §cEs sind zu viele Spieler online! Partikel sind deaktiviert. PARTICLE_SNEEZE = §aSneeze PARTICLE_SMOKE = §7Rauch @@ -87,6 +88,21 @@ PARTICLE_WATER_FIRE = §bWasser§7/§cFeuer PARTICLE_MAGIC_ENCHANTING = §5Magie§7/§eZauber PARTICLE_WINGS_EVIL = §5Lila Flügel +PARTICLE_PLAYER_RONGAMER99091_AURA = §7Rauchgranate + +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_CLOUD = §fWolken PARTICLE_EVENT_SMOKE = §7Rauch diff --git a/src/de/steamwar/lobby/particle/ParticleElement.java b/src/de/steamwar/lobby/particle/ParticleElement.java index 3b14c14..c9fac94 100644 --- a/src/de/steamwar/lobby/particle/ParticleElement.java +++ b/src/de/steamwar/lobby/particle/ParticleElement.java @@ -24,8 +24,15 @@ public interface ParticleElement { return new Particle.DustOptions(randomColor(), randomSize()); } - default void display(Location location, Consumer consumer) { + default void display(Location location, Player root, boolean onlySelf, boolean onlyOther, Consumer consumer) { + if (onlySelf) { + consumer.accept(root); + return; + } Bukkit.getOnlinePlayers().forEach(player -> { + if (onlyOther && player == root) { + return; + } int viewDistance = player.getClientViewDistance() * 16; if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) { consumer.accept(player); diff --git a/src/de/steamwar/lobby/particle/ParticleInventory.java b/src/de/steamwar/lobby/particle/ParticleInventory.java index 8762616..86b80ce 100644 --- a/src/de/steamwar/lobby/particle/ParticleInventory.java +++ b/src/de/steamwar/lobby/particle/ParticleInventory.java @@ -32,6 +32,7 @@ public class ParticleInventory { CustomPlayerParticle.class, TeamParticle.class, CustomTeamParticle.class, + RainCloudParticle.class, ServerTeamParticle.class, EventParticle.class, EventParticlePlacement.class, @@ -60,7 +61,6 @@ public class ParticleInventory { return null; } } - // TODO: Add conversion from last version return null; } @@ -84,6 +84,9 @@ public class ParticleInventory { if (particle == null) return; lobbyPlayer.setParticle(particle); 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 -> { lobbyPlayer.setParticle(null); diff --git a/src/de/steamwar/lobby/particle/ParticleListener.java b/src/de/steamwar/lobby/particle/ParticleListener.java index c52ee18..c4000de 100644 --- a/src/de/steamwar/lobby/particle/ParticleListener.java +++ b/src/de/steamwar/lobby/particle/ParticleListener.java @@ -24,6 +24,7 @@ import de.steamwar.lobby.jumpandrun.JumpAndRun; import de.steamwar.lobby.listener.BasicListener; import de.steamwar.lobby.listener.PlayerSpawn; import de.steamwar.lobby.util.LobbyPlayer; +import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -39,6 +40,7 @@ import java.util.Map; public class ParticleListener extends BasicListener { private static final int PLAYER_MAX_SIZE = 20; + private static final int SERVER_TEAM_MAX_SIZE = 40; private static double deg = 0; @@ -48,12 +50,10 @@ public class ParticleListener extends BasicListener { Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> { movingPlayers.replaceAll((player, integer) -> integer - 1); movingPlayers.entrySet().removeIf(entry -> entry.getValue() <= 0); - if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) { - return; - } deg += 0.1; if (deg > 360) deg = 0; Bukkit.getOnlinePlayers().forEach(player -> { + if (disabled(player)) return; if (JumpAndRun.isPlayerInJumpAndRun(player)) return; LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); ParticleEnum particle = lobbyPlayer.getParticle(); @@ -69,7 +69,6 @@ public class ParticleListener extends BasicListener { @EventHandler(priority = EventPriority.NORMAL) public void handlePlayerInteract(PlayerInteractEvent event) { - if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) return; Player player = event.getPlayer(); if (JumpAndRun.isPlayerInJumpAndRun(player)) return; if (!PlayerSpawn.PARTICLE.equals(event.getItem())) return; @@ -80,8 +79,8 @@ public class ParticleListener extends BasicListener { @EventHandler public void handlePlayerMove(PlayerMoveEvent event) { - if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) return; Player player = event.getPlayer(); + if (disabled(player)) return; if (JumpAndRun.isPlayerInJumpAndRun(player)) return; LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); ParticleEnum particle = lobbyPlayer.getParticle(); @@ -108,4 +107,10 @@ public class ParticleListener extends BasicListener { 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(); + } } diff --git a/src/de/steamwar/lobby/particle/ParticleTickData.java b/src/de/steamwar/lobby/particle/ParticleTickData.java index b85da90..30cac11 100644 --- a/src/de/steamwar/lobby/particle/ParticleTickData.java +++ b/src/de/steamwar/lobby/particle/ParticleTickData.java @@ -17,6 +17,8 @@ public class ParticleTickData { private Location location; private final double deg; private final boolean isMoving; + private boolean onlySelf = false; + private boolean onlyOthers = false; public ParticleTickData withLocation(Location location) { ParticleTickData particleTickData = copy(); @@ -24,6 +26,18 @@ public class 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() { if (location == null) { return player.getLocation(); @@ -32,6 +46,6 @@ public class ParticleTickData { } public ParticleTickData copy() { - return new ParticleTickData(world, player, location, deg, isMoving); + return new ParticleTickData(world, player, location, deg, isMoving, onlySelf, onlyOthers); } } diff --git a/src/de/steamwar/lobby/particle/WingDesign.java b/src/de/steamwar/lobby/particle/WingDesign.java index dccb208..3c3358b 100644 --- a/src/de/steamwar/lobby/particle/WingDesign.java +++ b/src/de/steamwar/lobby/particle/WingDesign.java @@ -50,4 +50,5 @@ public interface WingDesign { 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 PL = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/PL-Logo.png")); } diff --git a/src/de/steamwar/lobby/particle/decorator/PL-Logo-Old.png b/src/de/steamwar/lobby/particle/decorator/PL-Logo-Old.png new file mode 100644 index 0000000000000000000000000000000000000000..40c36bc8401ba3d6c175c570b874c69974bbdec5 GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0vp@K+MU(1|(lrEz1H@9-c0aAre!QQxXz>oM%w_*Q~jx zVd6wVA7jDQjFGa!yF3kga*V7JoWvE5h4J|A@Ns9;3E9Xw`|OKti*K~#aqC6Tl<4@v bzR8NA@sF6?Vif^LpqUJwu6{1-oD!MG+r9B6^7z{X^{{EkT z@5aHvXL^1dr@k;Au$tTvyM$qtBiGkHmiG8M<2Ac?AN}sA`%?EG&#tD=UG|E8>+g%V pR5u$eN&LQgCYxueqGrckUe32d+=@&btAWNdc)I$ztaD0e0szZOFlhh) literal 0 HcmV?d00001 diff --git a/src/de/steamwar/lobby/particle/elements/Circle.java b/src/de/steamwar/lobby/particle/elements/Circle.java index a086e4a..272886b 100644 --- a/src/de/steamwar/lobby/particle/elements/Circle.java +++ b/src/de/steamwar/lobby/particle/elements/Circle.java @@ -7,8 +7,19 @@ import org.bukkit.util.Vector; public class Circle extends DelegatingParticleElement { + private double distance; + private double speed; + public Circle(ParticleElement 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 @@ -20,8 +31,8 @@ public class Circle extends DelegatingParticleElement { public void tick(ParticleTickData particleTickData) { Location location = particleTickData.getLocation(); - Vector vector = new Vector(1, 0, 0); - vector.rotateAroundY(particleTickData.getDeg()); + Vector vector = new Vector(distance, 0, 0); + vector.rotateAroundY((particleTickData.getDeg() * speed) % 360); ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector)); particleElement.tick(nParticleTickData); } diff --git a/src/de/steamwar/lobby/particle/elements/DoubleCircle.java b/src/de/steamwar/lobby/particle/elements/DoubleCircle.java index 926f5f2..3d777c2 100644 --- a/src/de/steamwar/lobby/particle/elements/DoubleCircle.java +++ b/src/de/steamwar/lobby/particle/elements/DoubleCircle.java @@ -10,9 +10,21 @@ public class DoubleCircle extends Circle { private ParticleElement second; + private double distance; + private double speed; + public DoubleCircle(ParticleElement first, ParticleElement second) { super(first); 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 @@ -25,7 +37,6 @@ public class DoubleCircle extends Circle { if (particleElement.tickType() == second.tickType()) { return particleElement.tickType(); } - // TODO: This could be improved but I will not do it return ParticleTickType.MOVE; } @@ -33,8 +44,8 @@ public class DoubleCircle extends Circle { public void tick(ParticleTickData particleTickData) { Location location = particleTickData.getLocation(); - Vector vector = new Vector(1, 0, 0); - vector.rotateAroundY(particleTickData.getDeg()); + Vector vector = new Vector(distance, 0, 0); + vector.rotateAroundY((particleTickData.getDeg() * speed) % 360); ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector)); particleElement.tick(nParticleTickData); diff --git a/src/de/steamwar/lobby/particle/elements/DustParticle.java b/src/de/steamwar/lobby/particle/elements/DustParticle.java index 24ef229..9c2f838 100644 --- a/src/de/steamwar/lobby/particle/elements/DustParticle.java +++ b/src/de/steamwar/lobby/particle/elements/DustParticle.java @@ -37,7 +37,7 @@ public class DustParticle implements ParticleElement { @Override public void tick(ParticleTickData particleTickData) { 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()); }); } diff --git a/src/de/steamwar/lobby/particle/elements/OnlyOthers.java b/src/de/steamwar/lobby/particle/elements/OnlyOthers.java new file mode 100644 index 0000000..b9068a3 --- /dev/null +++ b/src/de/steamwar/lobby/particle/elements/OnlyOthers.java @@ -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()); + } +} diff --git a/src/de/steamwar/lobby/particle/elements/OnlySelf.java b/src/de/steamwar/lobby/particle/elements/OnlySelf.java new file mode 100644 index 0000000..feb96d0 --- /dev/null +++ b/src/de/steamwar/lobby/particle/elements/OnlySelf.java @@ -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()); + } +} diff --git a/src/de/steamwar/lobby/particle/elements/RandomParticle.java b/src/de/steamwar/lobby/particle/elements/RandomParticle.java new file mode 100644 index 0000000..def3cab --- /dev/null +++ b/src/de/steamwar/lobby/particle/elements/RandomParticle.java @@ -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 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); + } +} diff --git a/src/de/steamwar/lobby/particle/elements/SimpleParticle.java b/src/de/steamwar/lobby/particle/elements/SimpleParticle.java index fc678b0..760f4eb 100644 --- a/src/de/steamwar/lobby/particle/elements/SimpleParticle.java +++ b/src/de/steamwar/lobby/particle/elements/SimpleParticle.java @@ -55,7 +55,7 @@ public class SimpleParticle implements ParticleElement { @Override public void tick(ParticleTickData particleTickData) { 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) { player.spawnParticle(particle, location, count, vx, vy, vz, time); } else { diff --git a/src/de/steamwar/lobby/particle/elements/custom/PulseShimmer.java b/src/de/steamwar/lobby/particle/elements/custom/PulseShimmer.java new file mode 100644 index 0000000..f286f14 --- /dev/null +++ b/src/de/steamwar/lobby/particle/elements/custom/PulseShimmer.java @@ -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))); + } +} diff --git a/src/de/steamwar/lobby/particle/particles/EventParticleParticipation.java b/src/de/steamwar/lobby/particle/particles/EventParticleParticipation.java index a128623..761aeda 100644 --- a/src/de/steamwar/lobby/particle/particles/EventParticleParticipation.java +++ b/src/de/steamwar/lobby/particle/particles/EventParticleParticipation.java @@ -32,7 +32,7 @@ public enum EventParticleParticipation implements ParticleEnum { new Circle(new SimpleParticle(Particle.WATER_WAKE, 0, 0, 0, 0))) ), 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), new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.DRAGON_BREATH, 0, 0, 0, 0, 1), 0.15, WingDesign.COMPLEX)), 20))) diff --git a/src/de/steamwar/lobby/particle/particles/RainCloudParticle.java b/src/de/steamwar/lobby/particle/particles/RainCloudParticle.java new file mode 100644 index 0000000..85b495f --- /dev/null +++ b/src/de/steamwar/lobby/particle/particles/RainCloudParticle.java @@ -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; +} diff --git a/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java b/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java index 456d609..5b73c54 100644 --- a/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java +++ b/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java @@ -2,12 +2,38 @@ package de.steamwar.lobby.particle.particles.custom; import de.steamwar.lobby.particle.ParticleData; import de.steamwar.lobby.particle.ParticleEnum; +import de.steamwar.lobby.particle.ParticleRequirement; +import de.steamwar.lobby.particle.WingDesign; +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.Getter; +import org.bukkit.Material; +import org.bukkit.Particle; @AllArgsConstructor 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_Logo(new ParticleData(Material.ENDER_CHEST, "PARTICLE_TEAM_PULSE_LOGO", ParticleRequirement.easterEventSpecificTeam(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(); diff --git a/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java b/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java index 37d956c..9af8c58 100644 --- a/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java +++ b/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java @@ -5,6 +5,8 @@ import de.steamwar.lobby.particle.ParticleEnum; import de.steamwar.lobby.particle.ParticleRequirement; import de.steamwar.lobby.particle.WingDesign; 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.Getter; import org.bukkit.Material; @@ -14,7 +16,13 @@ import org.bukkit.Particle; public enum CustomTeamParticle implements ParticleEnum { 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)))) ), ; public static ParticleEnum[] particles = values(); From 5567b6e3c9fe86434a3a849aabac187a644bd1d6 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 7 Apr 2023 23:09:58 +0200 Subject: [PATCH 2/6] Add JumpAndRun personal best to user config --- src/de/steamwar/lobby/LobbySystem.properties | 1 + src/de/steamwar/lobby/LobbySystem_de.properties | 1 + .../steamwar/lobby/jumpandrun/JumpAndRun.java | 17 +++++++++++++++++ .../particles/custom/CustomEasterParticle.java | 2 ++ 4 files changed, 21 insertions(+) diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 70e0c9c..5b3dbca 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -130,6 +130,7 @@ JUMP_AND_RUN_PROGRESS = §e{0}§8/§f{1} §c{2} §7{3} JUMP_AND_RUN_CANCEL = {0} JUMP_AND_RUN_TIME = mm:ss SSS JUMP_AND_RUN_FINISHED = §aFinished in {0} with {1} fails +JUMP_AND_RUN_PERSONAL_BEST = §aNice! You beat your personal best by {0} # Easter Egg Hunt DIFFICULTY_EASY = §aEasy diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index c5ff141..5bd4406 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -120,6 +120,7 @@ PARTICLE_EGG_HUNT_ADVANCED = §5Abheben PARTICLE_EGG_HUNT_HALF = §fDie Jagd ist eröffnet JUMP_AND_RUN_FINISHED = §aBeendet in {0} mit {1} Fails +JUMP_AND_RUN_PERSONAL_BEST = §aNice! Du hast deinen Rekord um {0} Sekunden verbessert! # Easter Egg Hunt DIFFICULTY_EASY = §aLeicht diff --git a/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java b/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java index f534fed..0ccc96a 100644 --- a/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java +++ b/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java @@ -3,6 +3,7 @@ package de.steamwar.lobby.jumpandrun; import de.steamwar.lobby.LobbySystem; import de.steamwar.lobby.listener.BasicListener; import de.steamwar.lobby.listener.PlayerSpawn; +import de.steamwar.sql.UserConfig; import net.md_5.bungee.api.ChatMessageType; import org.bukkit.Bukkit; 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); 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())); + updateJumpAndRunTime(event.getPlayer(), time); 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(time - jumpAndRunTime)); + LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST", player, parsed); + UserConfig.updatePlayerConfig(player.getUniqueId(), "jump_and_run", time + ""); + } + } + } + @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); diff --git a/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java b/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java index 5b73c54..7ba9466 100644 --- a/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java +++ b/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java @@ -15,12 +15,14 @@ import org.bukkit.Particle; @AllArgsConstructor 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)), From 49b6f82f1a125322fcd7d1b4ecbe39d4f229fa4a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 8 Apr 2023 00:00:49 +0200 Subject: [PATCH 3/6] Fix JumpAndRun time --- src/de/steamwar/lobby/jumpandrun/JumpAndRun.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java b/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java index 0ccc96a..64e9b13 100644 --- a/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java +++ b/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java @@ -135,7 +135,7 @@ public class JumpAndRun extends BasicListener { 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(time - jumpAndRunTime)); + 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 + ""); } From 7a621a780e211f3d08199ca5fd39cb6dae487e15 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 8 Apr 2023 00:06:03 +0200 Subject: [PATCH 4/6] Add JumpAndRunCommand --- src/de/steamwar/lobby/LobbySystem.java | 2 ++ src/de/steamwar/lobby/LobbySystem.properties | 2 ++ .../steamwar/lobby/LobbySystem_de.properties | 4 ++- .../lobby/jumpandrun/JumpAndRunCommand.java | 30 +++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index f87d9d4..3fce387 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -25,6 +25,7 @@ import de.steamwar.lobby.command.HologramCommand; import de.steamwar.lobby.command.ModifyCommand; import de.steamwar.lobby.command.PortalCommand; import de.steamwar.lobby.jumpandrun.JumpAndRun; +import de.steamwar.lobby.jumpandrun.JumpAndRunCommand; import de.steamwar.lobby.listener.*; import de.steamwar.lobby.map.CustomMapCommand; import de.steamwar.lobby.particle.ParticleListener; @@ -61,6 +62,7 @@ public class LobbySystem extends JavaPlugin { new CustomMapCommand(); new JumpAndRun(); + new JumpAndRunCommand(); config = new Config(getConfig()); new PlayerSpawn(); diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 5b3dbca..86ee7ef 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -131,6 +131,8 @@ JUMP_AND_RUN_CANCEL = {0} JUMP_AND_RUN_TIME = mm:ss SSS 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 DIFFICULTY_EASY = §aEasy diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index 5bd4406..b451a73 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -120,7 +120,9 @@ PARTICLE_EGG_HUNT_ADVANCED = §5Abheben PARTICLE_EGG_HUNT_HALF = §fDie Jagd ist eröffnet JUMP_AND_RUN_FINISHED = §aBeendet in {0} mit {1} Fails -JUMP_AND_RUN_PERSONAL_BEST = §aNice! Du hast deinen Rekord um {0} Sekunden verbessert! +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 DIFFICULTY_EASY = §aLeicht diff --git a/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java b/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java new file mode 100644 index 0000000..680f01b --- /dev/null +++ b/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java @@ -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); + } +} From 4641a0936fa785c7898f04ca46f70aabaf835c18 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 8 Apr 2023 00:43:58 +0200 Subject: [PATCH 5/6] Add HearthBeat --- src/de/steamwar/lobby/LobbySystem.properties | 1 + .../steamwar/lobby/LobbySystem_de.properties | 2 + .../lobby/particle/elements/Wing.java | 2 +- .../particle/elements/custom/HearthBeat.java | 44 +++++++++++++++++++ .../custom/CustomEasterParticle.java | 6 +-- .../particles/custom/CustomTeamParticle.java | 3 ++ 6 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 src/de/steamwar/lobby/particle/elements/custom/HearthBeat.java diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 86ee7ef..5fdfe48 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -96,6 +96,7 @@ 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 diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index b451a73..450779d 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -90,6 +90,8 @@ 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 diff --git a/src/de/steamwar/lobby/particle/elements/Wing.java b/src/de/steamwar/lobby/particle/elements/Wing.java index 6163382..bb43da5 100644 --- a/src/de/steamwar/lobby/particle/elements/Wing.java +++ b/src/de/steamwar/lobby/particle/elements/Wing.java @@ -25,7 +25,7 @@ public class Wing extends DelegatingParticleElement { @Override public void tick(ParticleTickData particleTickData) { for (Vector dVector : wingDesign.getVectors()) { - Vector vector = new Vector(dVector.getX() * size, 0.6 + dVector.getY() * size - (particleTickData.getPlayer().isSneaking() ? 0.5 : 0) , 0.5); + Vector vector = new Vector(dVector.getX() * size, 0.6 + dVector.getY() * size - (particleTickData.getPlayer().isSneaking() ? 0.5 : 0), 0.5); vector.rotateAroundY(Math.toRadians(particleTickData.getPlayer().getLocation().getYaw() * -1)); vector.setX(-vector.getX()); vector.setZ(-vector.getZ()); diff --git a/src/de/steamwar/lobby/particle/elements/custom/HearthBeat.java b/src/de/steamwar/lobby/particle/elements/custom/HearthBeat.java new file mode 100644 index 0000000..0e974e6 --- /dev/null +++ b/src/de/steamwar/lobby/particle/elements/custom/HearthBeat.java @@ -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); + } +} diff --git a/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java b/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java index 7ba9466..eba7415 100644 --- a/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java +++ b/src/de/steamwar/lobby/particle/particles/custom/CustomEasterParticle.java @@ -3,8 +3,8 @@ package de.steamwar.lobby.particle.particles.custom; import de.steamwar.lobby.particle.ParticleData; import de.steamwar.lobby.particle.ParticleEnum; import de.steamwar.lobby.particle.ParticleRequirement; -import de.steamwar.lobby.particle.WingDesign; 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; @@ -33,8 +33,8 @@ public enum CustomEasterParticle implements ParticleEnum { 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_Logo(new ParticleData(Material.ENDER_CHEST, "PARTICLE_TEAM_PULSE_LOGO", ParticleRequirement.easterEventSpecificTeam(210), - new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.END_ROD, 0, 0, 0, 0, 1), 0.15, WingDesign.PL)), 80))) + 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(); diff --git a/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java b/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java index 9af8c58..35b6afa 100644 --- a/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java +++ b/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java @@ -24,6 +24,9 @@ public enum CustomTeamParticle implements ParticleEnum { 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.easterEventSpecificTeam(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(); From d5c00013920e91a783b6334df77eae56336d8408 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 8 Apr 2023 00:50:40 +0200 Subject: [PATCH 6/6] Add HearthBeat --- .../lobby/particle/particles/custom/CustomTeamParticle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java b/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java index 35b6afa..14b7859 100644 --- a/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java +++ b/src/de/steamwar/lobby/particle/particles/custom/CustomTeamParticle.java @@ -24,7 +24,7 @@ public enum CustomTeamParticle implements ParticleEnum { 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.easterEventSpecificTeam(210), + 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))) ), ;