Archiviert
13
0

Fix Non Working Particle

Dieser Commit ist enthalten in:
jojo 2020-08-16 09:28:23 +02:00
Ursprung e044f2ff9e
Commit 87e3056e25
2 geänderte Dateien mit 14 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -40,7 +40,7 @@ public class ParticleInventory {
add(swInventory, Material.GLASS_BOTTLE, "§5Effekt", lore, Particle.SPELL, 20, player, lobbyPlayer);
add(swInventory, Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 21, player, lobbyPlayer, true, 0F, 0.2F, 0F, 0.01);
add(swInventory, Material.CAULDRON, "§5Magie", lore, Particle.CRIT_MAGIC, 22, player, lobbyPlayer, true, 0.2F, 0.2F, 0.2F, 0.01);
add(swInventory, Material.REDSTONE_BLOCK, "§4Wut", lore, Particle.VILLAGER_ANGRY, 23, player, lobbyPlayer, true, 0.2F, 0.2F, 0.2F, 0.01);
add(swInventory, Material.REDSTONE_BLOCK, "§4Wut", lore, Particle.VILLAGER_ANGRY, 23, player, lobbyPlayer, true, 0.2F, 0.02F, 0.2F, 0.01);
add(swInventory, Material.SLIME_BALL, "§aSchleim", lore, Particle.SLIME, 24, player, lobbyPlayer);
if (userGroup == UserGroup.Member) {

Datei anzeigen

@ -3,6 +3,7 @@ package de.steamwar.lobby.listener;
import de.steamwar.lobby.inventories.LobbyInventory;
import de.steamwar.lobby.inventories.ParticleInventory;
import de.steamwar.lobby.utils.LobbyPlayer;
import org.bukkit.Color;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -11,8 +12,12 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import java.util.Random;
public class ParticleListener implements Listener {
private static Random random = new Random();
@EventHandler(priority = EventPriority.NORMAL)
public void handlePlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
@ -29,10 +34,16 @@ public class ParticleListener implements Listener {
Particle particle = lobbyPlayer.getParticle();
if (particle == null) return;
if (particle == Particle.SPELL) {
Particle.DustOptions dust = new Particle.DustOptions(Color.fromRGB(random.nextInt(256), random.nextInt(256), random.nextInt(256)), random.nextFloat() / 2 + 1);
player.getWorld().spawnParticle(particle, player.getLocation().add(0.0D, 0.2D, 0.0D), 5, dust);
return;
}
if (lobbyPlayer.isCustomVelocity()) {
player.getWorld().spawnParticle(lobbyPlayer.getParticle(), player.getLocation().add(0.0D, 0.2D, 0.0D), 5, lobbyPlayer.getParticle_vx(), lobbyPlayer.getParticle_vy(), lobbyPlayer.getParticle_vz(), lobbyPlayer.getParticle_time());
player.getWorld().spawnParticle(particle, player.getLocation().add(0.0D, 0.2D, 0.0D), 5, lobbyPlayer.getParticle_vx(), lobbyPlayer.getParticle_vy(), lobbyPlayer.getParticle_vz(), lobbyPlayer.getParticle_time());
} else {
player.getWorld().spawnParticle(lobbyPlayer.getParticle(), player.getLocation().add(0.0D, 0.2D, 0.0D), 5);
player.getWorld().spawnParticle(particle, player.getLocation().add(0.0D, 0.2D, 0.0D), 5);
}
}