Archiviert
13
0

Fix Non Working Particle

Dieser Commit ist enthalten in:
jojo 2020-08-16 08:46:51 +02:00
Ursprung d5ad2b7e73
Commit 577b330fbd
3 geänderte Dateien mit 31 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -38,21 +38,19 @@ 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.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);
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);
// CAMPFIRE_COSY_SMOKE, SQUID_INK, TOTEM, FLAME
if (userGroup == UserGroup.Member) {
add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 31, player, lobbyPlayer);
} 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.EMERALD_BLOCK, "§2Freude", lore, Particle.VILLAGER_HAPPY, 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.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);
}
@ -60,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);

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.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);
}
}

Datei anzeigen

@ -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() {