Add NonMoving and YOffset and custom particle for Haylim_ for helping and YouTube video
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
abda6b652d
Commit
93933ec92c
@ -41,6 +41,7 @@ PARTICLE_ATTRIBUTE_NON_FLYING = §8-§f Not flying
|
||||
PARTICLE_ATTRIBUTE_FLYING = §8-§f Flying
|
||||
PARTICLE_ATTRIBUTE_WING = §8-§f Wings
|
||||
PARTICLE_ATTRIBUTE_SNEAKING = §8-§f Sneaking
|
||||
PARTICLE_ATTRIBUTE_NON_MOVING = §8-§f Not moving
|
||||
PARTICLE_ATTRIBUTE_SEPARATOR = §f
|
||||
|
||||
PARTICLE_SELECT = §eClick to select
|
||||
@ -81,6 +82,8 @@ PARTICLE_WATER_FIRE = §bWater§7/§cFire
|
||||
PARTICLE_MAGIC_ENCHANTING = §5Magic/Enchantment
|
||||
PARTICLE_WINGS_EVIL = §5Purple wings
|
||||
|
||||
PARTICLE_PLAYER_HAYLIM_AURA = §fHaylim\'s Aura
|
||||
|
||||
PARTICLE_EVENT_ENCHANTING = §cEnchantment
|
||||
PARTICLE_EVENT_CLOUD = §fClouds
|
||||
PARTICLE_EVENT_SMOKE = §7Smoke
|
||||
|
@ -40,6 +40,7 @@ PARTICLE_ATTRIBUTE_NON_FLYING = §8-§f Nicht am Fliegen
|
||||
PARTICLE_ATTRIBUTE_FLYING = §8-§f Am Fliegen
|
||||
PARTICLE_ATTRIBUTE_WING = §8-§f Flügel
|
||||
PARTICLE_ATTRIBUTE_SNEAKING = §8-§f Ducken
|
||||
PARTICLE_ATTRIBUTE_NON_MOVING = §8-§f Beim Stehen
|
||||
PARTICLE_ATTRIBUTE = §eAttribute§7:
|
||||
|
||||
PARTICLE_SELECT = §eZum Auswählen klicken
|
||||
|
@ -31,6 +31,10 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ParticleListener extends BasicListener {
|
||||
|
||||
@ -38,9 +42,14 @@ public class ParticleListener extends BasicListener {
|
||||
|
||||
private static double deg = 0;
|
||||
|
||||
private static Set<Player> movingPlayers = new HashSet<>();
|
||||
|
||||
public ParticleListener() {
|
||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
|
||||
if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) return;
|
||||
if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) {
|
||||
movingPlayers.clear();
|
||||
return;
|
||||
}
|
||||
deg += 0.1;
|
||||
if (deg > 360) deg = 0;
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
@ -51,9 +60,10 @@ public class ParticleListener extends BasicListener {
|
||||
ParticleData particleData = particle.getParticle();
|
||||
ParticleElement particleElement = particleData.getParticleElement();
|
||||
if (particleElement.tickType() == ParticleTickType.ALWAYS) {
|
||||
particleElement.tick(new ParticleTickData(player.getWorld(), player, deg));
|
||||
particleElement.tick(new ParticleTickData(player.getWorld(), player, deg, movingPlayers.contains(player)));
|
||||
}
|
||||
});
|
||||
movingPlayers.clear();
|
||||
}, 0, 1);
|
||||
}
|
||||
|
||||
@ -80,8 +90,16 @@ public class ParticleListener extends BasicListener {
|
||||
ParticleData particleData = particle.getParticle();
|
||||
ParticleElement particleElement = particleData.getParticleElement();
|
||||
if (particleElement.tickType() == ParticleTickType.MOVE) {
|
||||
particleElement.tick(new ParticleTickData(player.getWorld(), player, deg));
|
||||
particleElement.tick(new ParticleTickData(player.getWorld(), player, deg, true));
|
||||
}
|
||||
if (event.getFrom().getX() != event.getTo().getX() || event.getFrom().getY() != event.getTo().getY() || event.getFrom().getZ() != event.getTo().getZ()) {
|
||||
movingPlayers.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
movingPlayers.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -16,6 +16,7 @@ public class ParticleTickData {
|
||||
private final Player player;
|
||||
private Location location;
|
||||
private final double deg;
|
||||
private final boolean isMoving;
|
||||
|
||||
public ParticleTickData withLocation(Location location) {
|
||||
ParticleTickData particleTickData = copy();
|
||||
@ -31,6 +32,6 @@ public class ParticleTickData {
|
||||
}
|
||||
|
||||
public ParticleTickData copy() {
|
||||
return new ParticleTickData(world, player, location, deg);
|
||||
return new ParticleTickData(world, player, location, deg, isMoving);
|
||||
}
|
||||
}
|
||||
|
25
src/de/steamwar/lobby/particle/elements/custom/NonMoving.java
Normale Datei
25
src/de/steamwar/lobby/particle/elements/custom/NonMoving.java
Normale Datei
@ -0,0 +1,25 @@
|
||||
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;
|
||||
|
||||
public class NonMoving extends DelegatingParticleElement {
|
||||
|
||||
public NonMoving(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_NON_MOVING";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
if (particleTickData.isMoving()) {
|
||||
return;
|
||||
}
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
47
src/de/steamwar/lobby/particle/elements/custom/YOffset.java
Normale Datei
47
src/de/steamwar/lobby/particle/elements/custom/YOffset.java
Normale Datei
@ -0,0 +1,47 @@
|
||||
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;
|
||||
|
||||
public class YOffset extends DelegatingParticleElement {
|
||||
|
||||
private double multiplication;
|
||||
private double minY;
|
||||
private double maxY;
|
||||
private boolean inverted;
|
||||
|
||||
public YOffset(ParticleElement particleElement, double speed, double minY, double maxY, boolean inverted) {
|
||||
super(particleElement);
|
||||
this.multiplication = speed;
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
double value = ((particleTickData.getDeg() * multiplication) % 360) / 180;
|
||||
double y;
|
||||
if (inverted) {
|
||||
if (value <= 1) {
|
||||
y = maxY - (maxY - minY) * value;
|
||||
} else {
|
||||
y = minY + (maxY - minY) * (value - 1);
|
||||
}
|
||||
} else {
|
||||
if (value <= 1) {
|
||||
y = minY + (maxY - minY) * value;
|
||||
} else {
|
||||
y = maxY - (maxY - minY) * (value - 1);
|
||||
}
|
||||
}
|
||||
ParticleTickData current = particleTickData.withLocation(particleTickData.getLocation().clone().add(0, y, 0));
|
||||
particleElement.tick(current);
|
||||
}
|
||||
}
|
@ -2,12 +2,24 @@ 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.elements.*;
|
||||
import de.steamwar.lobby.particle.elements.custom.NonMoving;
|
||||
import de.steamwar.lobby.particle.elements.custom.YOffset;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum CustomPlayerParticle implements ParticleEnum {
|
||||
|
||||
Haylim_(new ParticleData(Material.WHITE_CANDLE, "PARTICLE_PLAYER_HAYLIM_AURA", ParticleRequirement.specificPlayer(9426),
|
||||
new Always(new NonMoving(new NonFlying(new Group(
|
||||
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), 40, 0, 2, false), new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.0,1), 40, 0, 2, true)),
|
||||
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), 40, 0, 2, true), new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.0,1), 40, 0, 2, false))
|
||||
)))))
|
||||
),
|
||||
;
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren