Archiviert
13
0

Fix Non Working Particle

Dieser Commit ist enthalten in:
jojo 2020-08-16 09:09:01 +02:00
Ursprung 5bfd4288f8
Commit 89f4c3e221
3 geänderte Dateien mit 54 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -38,8 +38,8 @@ public class ParticleInventory {
add(swInventory, Material.NOTE_BLOCK, "§eNoten", lore, Particle.NOTE, 15, player, lobbyPlayer); 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.GLASS_BOTTLE, "§5Effekt", lore, Particle.SPELL, 20, player, lobbyPlayer);
add(swInventory, Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 21, player, lobbyPlayer, true); add(swInventory, Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 21, player, lobbyPlayer, true, 0F, 0.2F, 0F, 0.2);
add(swInventory, Material.CAULDRON, "§5Magie", lore, Particle.CRIT_MAGIC, 22, player, lobbyPlayer); add(swInventory, Material.CAULDRON, "§5Magie", lore, Particle.CRIT_MAGIC, 22, player, lobbyPlayer, true);
add(swInventory, Material.INK_SAC, "§8Tintenfisch", lore, Particle.SQUID_INK, 23, player, lobbyPlayer, true); 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); add(swInventory, Material.SLIME_BALL, "§aSchleim", lore, Particle.SLIME, 24, player, lobbyPlayer);
@ -50,7 +50,7 @@ public class ParticleInventory {
add(swInventory, Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE, 30, 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.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.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.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 33, player, lobbyPlayer, true, 0F, 0.2F, 0F, 0.2);
add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 40, player, lobbyPlayer); add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 40, player, lobbyPlayer);
} }
@ -58,9 +58,19 @@ public class ParticleInventory {
return swInventory; 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) { private static void add(SWInventory swInventory, Material material, String name, List<String> lore, Particle particle, int slot, Player player, LobbyPlayer lobbyPlayer, boolean customVelocity, float vx, float vy, float vz, double time) {
SWItem swItem = new SWItem(material, name, lore, false, clickType -> { SWItem swItem = new SWItem(material, name, lore, false, clickType -> {
lobbyPlayer.setParticle(particle, removeVelocity); lobbyPlayer.setParticle(particle, customVelocity);
lobbyPlayer.setParticle(vx, vy, vz, time);
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, boolean customVelocity) {
SWItem swItem = new SWItem(material, name, lore, false, clickType -> {
lobbyPlayer.setParticle(particle, customVelocity);
player.closeInventory(); player.closeInventory();
}); });
swInventory.setItem(slot, swItem); swInventory.setItem(slot, swItem);

Datei anzeigen

@ -29,8 +29,8 @@ public class ParticleListener implements Listener {
Particle particle = lobbyPlayer.getParticle(); Particle particle = lobbyPlayer.getParticle();
if (particle == null) return; if (particle == null) return;
if (lobbyPlayer.isRemoveVelocity()) { if (lobbyPlayer.isCustomVelocity()) {
player.getWorld().spawnParticle(lobbyPlayer.getParticle(), player.getLocation().add(0.0D, 0.2D, 0.0D), 5, 0F, 0F, 0F, 0.001); 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());
} else { } else {
player.getWorld().spawnParticle(lobbyPlayer.getParticle(), player.getLocation().add(0.0D, 0.2D, 0.0D), 5); player.getWorld().spawnParticle(lobbyPlayer.getParticle(), player.getLocation().add(0.0D, 0.2D, 0.0D), 5);
} }

Datei anzeigen

@ -9,8 +9,14 @@ public class LobbyPlayer {
private static Map<UUID, LobbyPlayer> cache = new HashMap<>(); private static Map<UUID, LobbyPlayer> cache = new HashMap<>();
private PlayerHiderState hiderState; private PlayerHiderState hiderState;
private Particle particle; private Particle particle;
private boolean removeVelocity = false; private boolean customVelocity = false;
private float particle_vx = 0;
private float particle_vy = 0;
private float particle_vz = 0;
private double particle_time = 0.001;
private boolean enderPearlUsed; private boolean enderPearlUsed;
private LobbyPlayer(UUID uuid) { private LobbyPlayer(UUID uuid) {
@ -30,18 +36,43 @@ public class LobbyPlayer {
return particle; return particle;
} }
public boolean isRemoveVelocity() { public boolean isCustomVelocity() {
return removeVelocity; return customVelocity;
}
public float getParticle_vx() {
return particle_vx;
}
public float getParticle_vy() {
return particle_vy;
}
public float getParticle_vz() {
return particle_vz;
}
public double getParticle_time() {
return particle_time;
} }
public void setParticle(Particle particle) { public void setParticle(Particle particle) {
this.particle = particle; this.particle = particle;
this.removeVelocity = false; this.customVelocity = false;
setParticle(0, 0, 0, 0.001);
} }
public void setParticle(Particle particle, boolean removeVelocity) { public void setParticle(Particle particle, boolean customVelocity) {
this.particle = particle; this.particle = particle;
this.removeVelocity = removeVelocity; this.customVelocity = customVelocity;
setParticle(0, 0, 0, 0.001);
}
public void setParticle(float vx, float vy, float vz, double time) {
this.particle_vx = vx;
this.particle_vy = vy;
this.particle_vz = vz;
this.particle_time = time;
} }
public boolean isEnderPearlUsed() { public boolean isEnderPearlUsed() {