mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 18:45:27 +01:00
Use new EnumParticle, fixes #8
This commit is contained in:
parent
084d4f7e0a
commit
6268966136
@ -1,6 +1,7 @@
|
||||
package me.blackvein.particles;
|
||||
|
||||
import me.blackvein.quests.util.ReflectionUtil;
|
||||
import net.minecraft.server.v1_8_R1.EnumParticle;
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayOutWorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -9,67 +10,66 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public enum Eff_1_8_R1 {
|
||||
|
||||
EXPLOSION(0),
|
||||
EXPLOSION_LARGE(1),
|
||||
EXPLOSION_HUGE(2),
|
||||
FIREWORKS_SPARK(3),
|
||||
BUBBLE(4),
|
||||
WAKE(5),
|
||||
SPLASH(6),
|
||||
SUSPENDED(7),
|
||||
DEPTH_SUSPEND(8),
|
||||
CRIT(9),
|
||||
MAGIC_CRIT(10),
|
||||
SMOKE(11),
|
||||
LARGE_SMOKE(12),
|
||||
SPELL(13),
|
||||
INSTANT_SPELL(14),
|
||||
MOB_SPELL(15),
|
||||
MOB_SPELL_AMBIENT(16),
|
||||
WITCH_MAGIC(17),
|
||||
DRIP_WATER(18),
|
||||
DRIP_LAVA(19),
|
||||
ANGRY_VILLAGER(20),
|
||||
HAPPY_VILLAGER(21),
|
||||
TOWN_AURA(22),
|
||||
NOTE(23),
|
||||
PORTAL(24),
|
||||
ENCHANTMENT_TABLE(25),
|
||||
FLAME(26),
|
||||
LAVA(27),
|
||||
FOOTSTEP(28),
|
||||
CLOUD(29),
|
||||
RED_DUST(30),
|
||||
SNOWBALL_POOF(31),
|
||||
SNOW_SHOVEL(32),
|
||||
SLIME(33),
|
||||
HEART(34),
|
||||
BARRIER(35),
|
||||
ICONCRACK_(36),
|
||||
BLOCKCRACK_(37),
|
||||
BLOCKDUST_(38),
|
||||
DROPLET(39),
|
||||
TAKE(40),
|
||||
MOB_APPEARANCE(41);
|
||||
EXPLOSION(EnumParticle.EXPLOSION_NORMAL),
|
||||
EXPLOSION_LARGE(EnumParticle.EXPLOSION_LARGE),
|
||||
EXPLOSION_HUGE(EnumParticle.EXPLOSION_HUGE),
|
||||
FIREWORKS_SPARK(EnumParticle.FIREWORKS_SPARK),
|
||||
BUBBLE(EnumParticle.WATER_BUBBLE),
|
||||
WAKE(EnumParticle.WATER_WAKE),
|
||||
SPLASH(EnumParticle.WATER_SPLASH),
|
||||
SUSPENDED(EnumParticle.SUSPENDED),
|
||||
DEPTH_SUSPEND(EnumParticle.SUSPENDED_DEPTH),
|
||||
CRIT(EnumParticle.CRIT),
|
||||
MAGIC_CRIT(EnumParticle.CRIT_MAGIC),
|
||||
SMOKE(EnumParticle.SMOKE_NORMAL),
|
||||
LARGE_SMOKE(EnumParticle.SMOKE_LARGE),
|
||||
SPELL(EnumParticle.SPELL),
|
||||
INSTANT_SPELL(EnumParticle.SPELL_INSTANT),
|
||||
MOB_SPELL(EnumParticle.SPELL_MOB),
|
||||
MOB_SPELL_AMBIENT(EnumParticle.SPELL_MOB_AMBIENT),
|
||||
WITCH_MAGIC(EnumParticle.SPELL_WITCH),
|
||||
DRIP_WATER(EnumParticle.DRIP_WATER),
|
||||
DRIP_LAVA(EnumParticle.DRIP_LAVA),
|
||||
ANGRY_VILLAGER(EnumParticle.VILLAGER_ANGRY),
|
||||
HAPPY_VILLAGER(EnumParticle.VILLAGER_HAPPY),
|
||||
TOWN_AURA(EnumParticle.TOWN_AURA),
|
||||
NOTE(EnumParticle.NOTE),
|
||||
PORTAL(EnumParticle.PORTAL),
|
||||
ENCHANTMENT_TABLE(EnumParticle.ENCHANTMENT_TABLE),
|
||||
FLAME(EnumParticle.FLAME),
|
||||
LAVA(EnumParticle.LAVA),
|
||||
FOOTSTEP(EnumParticle.FOOTSTEP),
|
||||
CLOUD(EnumParticle.CLOUD),
|
||||
RED_DUST(EnumParticle.REDSTONE),
|
||||
SNOWBALL_POOF(EnumParticle.SNOWBALL),
|
||||
SNOW_SHOVEL(EnumParticle.SNOW_SHOVEL),
|
||||
SLIME(EnumParticle.SLIME),
|
||||
HEART(EnumParticle.HEART),
|
||||
BARRIER(EnumParticle.BARRIER),
|
||||
ICONCRACK_(EnumParticle.ITEM_CRACK),
|
||||
BLOCKCRACK_(EnumParticle.BLOCK_CRACK),
|
||||
BLOCKDUST_(EnumParticle.BLOCK_DUST),
|
||||
DROPLET(EnumParticle.WATER_DROP),
|
||||
TAKE(EnumParticle.ITEM_TAKE),
|
||||
MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE);
|
||||
|
||||
private final int particleId;
|
||||
private final EnumParticle particleEnum;
|
||||
|
||||
Eff_1_8_R1(int particleId) {
|
||||
this.particleId = particleId;
|
||||
Eff_1_8_R1(EnumParticle particleEnum) {
|
||||
this.particleEnum = particleEnum;
|
||||
}
|
||||
|
||||
public void sendToPlayer(Player player, Location location, boolean longDistance, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
|
||||
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
|
||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
|
||||
ReflectionUtil.setValue(packet, "a", particleId);
|
||||
ReflectionUtil.setValue(packet, "b", longDistance);
|
||||
ReflectionUtil.setValue(packet, "c", (float) location.getX());
|
||||
ReflectionUtil.setValue(packet, "d", (float) location.getY());
|
||||
ReflectionUtil.setValue(packet, "e", (float) location.getZ());
|
||||
ReflectionUtil.setValue(packet, "f", offsetX);
|
||||
ReflectionUtil.setValue(packet, "g", offsetY);
|
||||
ReflectionUtil.setValue(packet, "h", offsetZ);
|
||||
ReflectionUtil.setValue(packet, "i", speed);
|
||||
ReflectionUtil.setValue(packet, "j", count);
|
||||
ReflectionUtil.setValue(packet, "a", particleEnum);
|
||||
ReflectionUtil.setValue(packet, "b", (float) location.getX());
|
||||
ReflectionUtil.setValue(packet, "c", (float) location.getY());
|
||||
ReflectionUtil.setValue(packet, "d", (float) location.getZ());
|
||||
ReflectionUtil.setValue(packet, "e", offsetX);
|
||||
ReflectionUtil.setValue(packet, "f", offsetY);
|
||||
ReflectionUtil.setValue(packet, "g", offsetZ);
|
||||
ReflectionUtil.setValue(packet, "h", speed);
|
||||
ReflectionUtil.setValue(packet, "i", count);
|
||||
ReflectionUtil.setValue(packet, "k", data);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
@ -74,12 +74,11 @@ public class NpcEffectThread implements Runnable {
|
||||
//Get and set eye location, because npc.getBukkitEntity() is deprecated.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
boolean longDistance = false;
|
||||
|
||||
if (Quests.effect.equalsIgnoreCase("enchant")) {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.ENCHANTMENT_TABLE.sendToPlayer(player, eyeLoc, longDistance, 0, 1, 0, 1, 10, null);
|
||||
Eff_1_8_R1.ENCHANTMENT_TABLE.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 10, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -87,7 +86,7 @@ public class NpcEffectThread implements Runnable {
|
||||
} else if (Quests.effect.equalsIgnoreCase("crit")) {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.CRIT.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, (float) 0.35, 3, null);
|
||||
Eff_1_8_R1.CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -95,7 +94,7 @@ public class NpcEffectThread implements Runnable {
|
||||
} else if (Quests.effect.equalsIgnoreCase("spell")) {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.INSTANT_SPELL.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, 1, 3, null);
|
||||
Eff_1_8_R1.INSTANT_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -103,7 +102,7 @@ public class NpcEffectThread implements Runnable {
|
||||
} else if (Quests.effect.equalsIgnoreCase("magiccrit")) {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.MAGIC_CRIT.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, (float) 0.35, 3, null);
|
||||
Eff_1_8_R1.MAGIC_CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -111,7 +110,7 @@ public class NpcEffectThread implements Runnable {
|
||||
} else if (Quests.effect.equalsIgnoreCase("mobspell")) {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.MOB_SPELL.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, 1, 3, null);
|
||||
Eff_1_8_R1.MOB_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -121,7 +120,7 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Location old = eyeLoc;
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_8_R1.NOTE.sendToPlayer(player, newLoc, longDistance, 0, 0, 0, 1, 1, null);
|
||||
Eff_1_8_R1.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -129,7 +128,7 @@ public class NpcEffectThread implements Runnable {
|
||||
} else if (Quests.effect.equalsIgnoreCase("portal")) {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.PORTAL.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, 1, 5, null);
|
||||
Eff_1_8_R1.PORTAL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 5, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -138,7 +137,7 @@ public class NpcEffectThread implements Runnable {
|
||||
|
||||
try {
|
||||
Location newLoc = new Location(player.getWorld(), eyeLoc.getX(), eyeLoc.getY() + (float) 0.5, eyeLoc.getZ());
|
||||
Eff_1_8_R1.RED_DUST.sendToPlayer(player, newLoc, longDistance, 0, 0, 0, 1, 1, null);
|
||||
Eff_1_8_R1.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -146,7 +145,7 @@ public class NpcEffectThread implements Runnable {
|
||||
} else if (Quests.effect.equalsIgnoreCase("witch")) {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.WITCH_MAGIC.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, 1, 3, null);
|
||||
Eff_1_8_R1.WITCH_MAGIC.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -156,7 +155,7 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Location old = eyeLoc;
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_8_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, longDistance, 0, 0, 0, 1, 3, null);
|
||||
Eff_1_8_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -166,7 +165,7 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Location old = eyeLoc;
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_8_R1.SPLASH.sendToPlayer(player, newLoc, longDistance, 0, 0, 0, 1, 4, null);
|
||||
Eff_1_8_R1.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -174,7 +173,7 @@ public class NpcEffectThread implements Runnable {
|
||||
} else if (Quests.effect.equalsIgnoreCase("smoke")) {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.TOWN_AURA.sendToPlayer(player, eyeLoc, longDistance, 0, 1, 0, 1, 20, null);
|
||||
Eff_1_8_R1.TOWN_AURA.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 20, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -182,7 +181,7 @@ public class NpcEffectThread implements Runnable {
|
||||
} else {
|
||||
|
||||
try {
|
||||
Eff_1_8_R1.valueOf(Quests.effect);
|
||||
Eff_1_8_R1.valueOf(Quests.effect).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} catch (Exception e) {
|
||||
Quests.getInstance().getLogger().info(Quests.effect + " is not a valid effect name!");
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user