Fix Particle Exception #10
@ -38,9 +38,9 @@ public class ParticleInventory {
|
||||
add(swInventory, Material.NOTE_BLOCK, "§eNoten", lore, Particle.NOTE, 15, player, lobbyPlayer);
|
||||
|
||||
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);
|
||||
add(swInventory, Material.APPLE, "§8Item", lore, Particle.ITEM_CRACK, 22, player, lobbyPlayer);
|
||||
add(swInventory, Material.INK_SAC, "§8Tintenfisch", lore, Particle.SQUID_INK, 23, player, lobbyPlayer);
|
||||
add(swInventory, Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 21, player, lobbyPlayer, true);
|
||||
add(swInventory, Material.IRON_SWORD, "§8Angriff", lore, Particle.SWEEP_ATTACK, 22, player, lobbyPlayer);
|
||||
add(swInventory, Material.INK_SAC, "§8Tintenfisch", lore, Particle.SQUID_INK, 23, player, lobbyPlayer, true);
|
||||
add(swInventory, Material.SLIME_BALL, "§aSchleim", lore, Particle.SLIME, 24, player, lobbyPlayer);
|
||||
|
||||
if (userGroup == UserGroup.Member) {
|
||||
@ -48,9 +48,9 @@ public class ParticleInventory {
|
||||
} else {
|
||||
add(swInventory, Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH, 29, player, lobbyPlayer);
|
||||
add(swInventory, Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE, 30, player, lobbyPlayer);
|
||||
add(swInventory, Material.TUBE_CORAL_FAN, "§bLuftblasen", lore, Particle.BUBBLE_COLUMN_UP, 31, player, lobbyPlayer);
|
||||
add(swInventory, Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 32, player, lobbyPlayer);
|
||||
add(swInventory, Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 33, player, lobbyPlayer);
|
||||
add(swInventory, Material.EMERALD_BLOCK, "§2Freude", lore, Particle.VILLAGER_HAPPY, 31, player, lobbyPlayer);
|
||||
add(swInventory, Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 32, player, lobbyPlayer, true);
|
||||
add(swInventory, Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 33, player, lobbyPlayer, true);
|
||||
|
||||
add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 40, player, lobbyPlayer);
|
||||
}
|
||||
@ -58,6 +58,14 @@ public class ParticleInventory {
|
||||
return swInventory;
|
||||
}
|
||||
|
||||
private static void add(SWInventory swInventory, Material material, String name, List<String> lore, Particle particle, int slot, Player player, LobbyPlayer lobbyPlayer, boolean removeVelocity) {
|
||||
SWItem swItem = new SWItem(material, name, lore, false, clickType -> {
|
||||
lobbyPlayer.setParticle(particle, removeVelocity);
|
||||
player.closeInventory();
|
||||
});
|
||||
swInventory.setItem(slot, swItem);
|
||||
}
|
||||
|
||||
private static void add(SWInventory swInventory, Material material, String name, List<String> lore, Particle particle, int slot, Player player, LobbyPlayer lobbyPlayer) {
|
||||
SWItem swItem = new SWItem(material, name, lore, false, clickType -> {
|
||||
lobbyPlayer.setParticle(particle);
|
||||
|
@ -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.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -25,9 +26,14 @@ public class ParticleListener implements Listener {
|
||||
public void handlePlayerMove(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||
if(lobbyPlayer.getParticle() == null) return;
|
||||
Particle particle = lobbyPlayer.getParticle();
|
||||
if (particle == null) return;
|
||||
|
||||
player.getWorld().spawnParticle(lobbyPlayer.getParticle(), player.getLocation().add(0.0D, 0.2D, 0.0D), 5);
|
||||
if (lobbyPlayer.isRemoveVelocity()) {
|
||||
player.getWorld().spawnParticle(lobbyPlayer.getParticle(), player.getLocation().add(0.0D, 0.2D, 0.0D), 5, 0F, 0F, 0F);
|
||||
} else {
|
||||
player.getWorld().spawnParticle(lobbyPlayer.getParticle(), player.getLocation().add(0.0D, 0.2D, 0.0D), 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@ public class LobbyPlayer {
|
||||
|
||||
private PlayerHiderState hiderState;
|
||||
private Particle particle;
|
||||
private boolean removeVelocity = false;
|
||||
private boolean enderPearlUsed;
|
||||
|
||||
private LobbyPlayer(UUID uuid) {
|
||||
@ -29,8 +30,18 @@ public class LobbyPlayer {
|
||||
return particle;
|
||||
}
|
||||
|
||||
public boolean isRemoveVelocity() {
|
||||
return removeVelocity;
|
||||
}
|
||||
|
||||
public void setParticle(Particle particle) {
|
||||
this.particle = particle;
|
||||
this.removeVelocity = false;
|
||||
}
|
||||
|
||||
public void setParticle(Particle particle, boolean removeVelocity) {
|
||||
this.particle = particle;
|
||||
this.removeVelocity = removeVelocity;
|
||||
}
|
||||
|
||||
public boolean isEnderPearlUsed() {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren