Browse Source

Fixed particles and added EMPTY one

master
pintux98 5 years ago
parent
commit
0777c56281
  1. 4
      MultiArena-TheBridge/particles.yml
  2. 2
      MultiArena-TheBridge/plugin.yml
  3. 2
      MultiArena-TheBridge/pom.xml
  4. 34
      MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java
  5. 50
      MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Particle.java
  6. 8
      MultiArena-TheBridge/src/cx/sfy/TheBridge/game/InventoryData.java
  7. 6
      MultiArena-TheBridge/src/cx/sfy/TheBridge/game/PlayerData.java
  8. 63
      MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/PlayerListener.java
  9. 11
      MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/GenericNMS.java
  10. 8
      MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/NMS.java
  11. 169
      MultiArena-TheBridge/src/cx/sfy/TheBridge/packets/ParticleHandler.java

4
MultiArena-TheBridge/particles.yml

@ -30,7 +30,7 @@ trails:
isBuy: true
name: "Default Arrow Effect"
effect:
type: CRIT
type: EMPTY
ammount: 20
permission: bridges.arrow.default
description:
@ -49,7 +49,7 @@ trails:
isBuy: true
name: "Default Feet Effect"
effect:
type: CRIT
type: EMPTY
ammount: 20
permission: bridges.feet.default
description:

2
MultiArena-TheBridge/plugin.yml

@ -1,6 +1,6 @@
main: cx.sfy.TheBridge.Main
name: TheBridge
version: 2.4.5
version: 2.4.6-BETA1
authors: [Stefatorus, pintux98, Leonardo0013YT]
softdepend: [PlaceholderAPI, LeaderHeads, FastAsyncWorldEdit, WorldEdit]
commands:

2
MultiArena-TheBridge/pom.xml

@ -6,7 +6,7 @@
<groupId>TheBridge</groupId>
<artifactId>TheBridge</artifactId>
<version>2.4.5</version>
<version>2.4.6-BETA1</version>
<name>TheBridge</name>
<packaging>jar</packaging>

34
MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java

@ -37,11 +37,10 @@ public class SetupCMD implements CommandExecutor {
if (sender instanceof Player) {
final Player p = (Player) sender;
if (args.length < 1) {
if (p.hasPermission("bridges.admin")) {
if (p.hasPermission("bridges.admin"))
sendHelp(p);
} else {
else
sendPlayerCommands(p);
}
return true;
}
switch (args[0].toLowerCase()) {
@ -107,7 +106,7 @@ public class SetupCMD implements CommandExecutor {
p.sendMessage(plugin.getLang().get("messages.alreadyGame"));
return true;
}
plugin.getGmu().openGameMenu(p);
plugin.getGmu().openSelectTypeMenu(p);
break;
case "shop":
if (!p.hasPermission("bridges.shop")) {
@ -159,38 +158,34 @@ public class SetupCMD implements CommandExecutor {
case "normal":
for (final GameDuo game : plugin.getGm().getGames()) {
GameDuo g = null;
int alto = 0;
if (game.isState(State.FINISH) || game.isState(State.INGAME) || game.isState(State.RESTARTING)
|| game.isState(State.PREGAME))
if (game.isState(State.FINISH) || game.isState(State.INGAME)
|| game.isState(State.RESTARTING) || game.isState(State.PREGAME))
continue;
if (game.getPlayers() == game.getMax())
continue;
if (game.getPlayers() <= alto) {
if (game.getPlayers() < game.getMax())
g = game;
alto = game.getPlayers();
}
if (g != null)
if (g != null) {
plugin.getGm().addPlayerGame(p, game);
else
return true;
} else
p.sendMessage(plugin.getLang().get("messages.noGames"));
}
break;
case "four":
for (final GameFour game : plugin.getGm().getGamesFour()) {
GameFour g = null;
int alto = 0;
if (game.isState(FState.FINISH) || game.isState(FState.INGAME)
|| game.isState(FState.RESTARTING) || game.isState(FState.PREGAME))
continue;
if (game.getPlayers().size() == game.getMax())
continue;
if (game.getPlayers().size() <= alto) {
if (game.getPlayers().size() < game.getMax())
g = game;
alto = game.getPlayers().size();
}
if (g != null)
if (g != null) {
plugin.getGm().addPlayerGameFour(p, game);
else
return true;
} else
p.sendMessage(plugin.getLang().get("messages.noGames"));
}
break;
@ -333,7 +328,8 @@ public class SetupCMD implements CommandExecutor {
}
final Inventory inv = Bukkit.getServer().createInventory(null, 36);
for (int i = 0; i < 35; i++) {
if (p.getInventory().getItem(i) == null || p.getInventory().getItem(i).getType() == Material.AIR) {
if (p.getInventory().getItem(i) == null
|| p.getInventory().getItem(i).getType() == Material.AIR) {
inv.setItem(i, new ItemStack(Material.BARRIER, 1, (short) 0));
continue;
}

50
MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Particle.java

@ -37,10 +37,9 @@ public class Particle {
this.plugin = plugin;
this.icon = new ItemStack(Material.valueOf(plugin.getParticles().get(path + ".icon")),
plugin.getParticles().getInt(path + ".amount"), (short) plugin.getParticles().getInt(path + ".data"));
this.lore = new ArrayList<String>();
for (String l : plugin.getParticles().getList(path + ".description")) {
this.lore = new ArrayList<>();
for (String l : plugin.getParticles().getList(path + ".description"))
lore.add(l.replaceAll("&", "§"));
}
this.id = id;
this.name = plugin.getParticles().get(path + ".name");
this.permission = plugin.getParticles().get(path + ".permission");
@ -54,17 +53,14 @@ public class Particle {
public ItemStack getHasIcon() {
ItemStack perm = icon;
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getParticles().getList("unlocked")) {
if (msg.contains("<description>")) {
for (String l : lore) {
List<String> nLore = new ArrayList<>();
for (String msg : plugin.getParticles().getList("unlocked"))
if (msg.contains("<description>"))
for (String l : lore)
nLore.add(l);
}
} else {
else
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§a" + name);
perm.setItemMeta(permM);
@ -74,17 +70,14 @@ public class Particle {
public ItemStack getPermIcon() {
ItemStack perm = icon;
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getParticles().getList("noPerm")) {
if (msg.contains("<description>")) {
for (String l : lore) {
List<String> nLore = new ArrayList<>();
for (String msg : plugin.getParticles().getList("noPerm"))
if (msg.contains("<description>"))
for (String l : lore)
nLore.add(l);
}
} else {
else
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§c" + name);
perm.setItemMeta(permM);
@ -94,17 +87,14 @@ public class Particle {
public ItemStack getBuyIcon() {
ItemStack perm = icon;
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getParticles().getList("locked")) {
if (msg.contains("<description>")) {
for (String l : lore) {
List<String> nLore = new ArrayList<>();
for (String msg : plugin.getParticles().getList("locked"))
if (msg.contains("<description>"))
for (String l : lore)
nLore.add(l);
}
} else {
else
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§c" + name);
perm.setItemMeta(permM);

8
MultiArena-TheBridge/src/cx/sfy/TheBridge/game/InventoryData.java

@ -14,7 +14,7 @@ import cx.sfy.TheBridge.Main;
public class InventoryData {
private static HashMap<Player, InventoryData> inventoryData = new HashMap<Player, InventoryData>();
private static HashMap<Player, InventoryData> inventoryData = new HashMap<>();
private UUID uuid;
private Inventory inv;
private ItemStack[] armor;
@ -34,9 +34,8 @@ public class InventoryData {
public void restore() {
if (!restored) {
Player p = this.getPlayer();
if (p == null) {
if (p == null)
return;
}
if (Main.get().isStop()) {
p.getInventory().setContents(inv.getContents());
p.getInventory().setArmorContents(armor);
@ -74,9 +73,8 @@ public class InventoryData {
}
public static InventoryData getInventoryData(Player p) {
if (inventoryData.containsKey(p)) {
if (inventoryData.containsKey(p))
return inventoryData.get(p);
}
return null;
}

6
MultiArena-TheBridge/src/cx/sfy/TheBridge/game/PlayerData.java

@ -46,9 +46,8 @@ public class PlayerData {
public void restore() {
if (!restored) {
Player p = this.getPlayer();
if (p == null) {
if (p == null)
return;
}
restored = true;
p.closeInventory();
p.setGameMode(gm);
@ -66,11 +65,10 @@ public class PlayerData {
Location respawn = Main.get().getMainLobby();
p.teleport(respawn, TeleportCause.END_PORTAL);
Utils.setPlayerExperience(p, PlayerStat.getPlayerStat(p).getXp());
if (!Main.get().isStop()) {
if (!Main.get().isStop())
Main.get().getTop().createInfo(p);
}
}
}
public Player getPlayer() {
return Bukkit.getPlayer(uuid);

63
MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/PlayerListener.java

@ -79,19 +79,26 @@ public class PlayerListener implements Listener {
private BukkitTask task;
public void sendArrowParticle(Player p, Entity e) {
if (plugin.getPam().getParticleByName("arrow", PlayerStat.getPlayerStat(p).getArrow_trail()).getTrail()
.equalsIgnoreCase("EMPTY"))
return;
task = Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(this.plugin, () -> {
Location loc = e.getLocation();
if (e.isOnGround() || e.getLocation().getY() < 10) {
if (e.isOnGround() || e.getLocation().getY() < 10 || leaving.contains(p)) {
task.cancel();
return;
}
createTrail(loc, plugin.getPam().getParticleByName("arrow", PlayerStat.getPlayerStat(p).getArrow_trail()));
}, 0, 1);
}
public void sendFeetParticle(Player p) {
if (p.isFlying() || p.hasPotionEffect(PotionEffectType.INVISIBILITY) || p.getGameMode() == GameMode.SPECTATOR) {
if (plugin.getPam().getParticleByName("arrow", PlayerStat.getPlayerStat(p).getArrow_trail()).getTrail()
.equalsIgnoreCase("EMPTY"))
return;
if (p.isFlying() || p.hasPotionEffect(PotionEffectType.INVISIBILITY) || p.getGameMode() == GameMode.SPECTATOR
|| leaving.contains(p))
return;
}
Location loc = p.getLocation();
createTrail(loc, plugin.getPam().getParticleByName("feet", PlayerStat.getPlayerStat(p).getFeet_trail()));
}
@ -101,16 +108,15 @@ public class PlayerListener implements Listener {
.sendToLocation(loc);
}
@EventHandler
@EventHandler(ignoreCancelled = true)
public void onShoot(ProjectileLaunchEvent e) {
if (e.getEntity().getShooter() instanceof Player) {
if (e.getEntity().getShooter() instanceof Player)
if (e.getEntity() instanceof Arrow) {
Player p = (Player) e.getEntity().getShooter();
if (plugin.getGm().getGameByPlayer(p) != null || plugin.getGm().getGameFourByPlayer(p) != null)
sendArrowParticle(p, e.getEntity());
}
}
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
@ -319,6 +325,7 @@ public class PlayerListener implements Listener {
}
}.runTaskLater(plugin, 20);
}
return;
}
}
if (plugin.getGm().getGameByPlayer(p) != null) {
@ -339,16 +346,19 @@ public class PlayerListener implements Listener {
if (!leaving.contains(p)) {
leaving.add(p);
new BukkitRunnable() {
@Override
public void run() {
leaving.remove(p);
}
}.runTaskLater(plugin, 20);
}
return;
}
}
if (plugin.getGm().getGameFourByPlayer(p) == null && plugin.getGm().getGameByPlayer(p) == null) {
if (p.getItemInHand() != null && p.getItemInHand().getType() != Material.AIR) {
final ItemStack item = p.getItemInHand();
if (item.hasItemMeta()) {
if (plugin.getConfig().getBoolean("items.menu.enabled")) {
@ -370,23 +380,42 @@ public class PlayerListener implements Listener {
plugin.getConfig().getString("items.random.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.random.loreItem").replaceAll("&", "§"));
if (item.equals(random)) {
int rand = (int) (Math.random() * 1);
if (rand == 0) {
GameDuo g = null;
int alto = 0;
for (final GameDuo game : plugin.getGm().getGames()) {
if (game.isState(State.FINISH) || game.isState(State.INGAME)
|| game.isState(State.RESTARTING) || game.isState(State.PREGAME))
continue;
if (game.getPlayers() == game.getMax())
continue;
if (game.getPlayers() <= alto) {
if (game.getPlayers() < game.getMax()) {
g = game;
alto = game.getPlayers();
break;
}
}
if (g != null)
plugin.getGm().addPlayerGame(p, g);
else
p.sendMessage(plugin.getLang().get("messages.noGames"));
} else if (rand == 1) {
GameFour g = null;
for (final GameFour game : plugin.getGm().getGamesFour()) {
if (game.isState(FState.FINISH) || game.isState(FState.INGAME)
|| game.isState(FState.RESTARTING) || game.isState(FState.PREGAME))
continue;
if (game.getPlayers().size() == game.getMax())
continue;
if (game.getPlayers().size() < game.getMax()) {
g = game;
break;
}
}
if (g != null)
plugin.getGm().addPlayerGameFour(p, g);
else
p.sendMessage(plugin.getLang().get("messages.noGames"));
}
}
}
if (plugin.getConfig().getBoolean("items.hotbar.enabled")) {
@ -489,9 +518,8 @@ public class PlayerListener implements Listener {
final Player p = e.getPlayer();
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (e.getFrom() != e.getTo()) {
if (e.getFrom() != e.getTo())
sendFeetParticle(p);
}
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.FINISH))
if (p.getLocation().getY() < 30)
p.teleport(game.getLobby());
@ -516,9 +544,8 @@ public class PlayerListener implements Listener {
}
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (e.getFrom() != e.getTo()) {
if (e.getFrom() != e.getTo())
sendFeetParticle(p);
}
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.FINISH))
if (p.getLocation().getY() < 30)
p.teleport(game.getLobby());
@ -883,6 +910,7 @@ public class PlayerListener implements Listener {
PlayerStat.getPlayerStat(p).removeCoins(arrow.getPrice());
p.getOpenInventory().close();
new BukkitRunnable() {
@Override
public void run() {
plugin.getAtm().createArrowMenu(p);
@ -903,7 +931,9 @@ public class PlayerListener implements Listener {
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
return;
for (final cx.sfy.TheBridge.cosmetics.Particle feet : plugin.getPam().getFeet_trails().values())
for (
final cx.sfy.TheBridge.cosmetics.Particle feet : plugin.getPam().getFeet_trails().values())
if (feet.getSlot() == e.getSlot())
if (!p.hasPermission(feet.getPermission())) {
if (!feet.isBuy())
@ -1206,7 +1236,7 @@ public class PlayerListener implements Listener {
public void onShoot(EntityShootBowEvent e) {
if (e.getEntity() instanceof Player) {
final Player p = (Player) e.getEntity();
if (plugin.getGm().getGameFourByPlayer(p) != null || plugin.getGm().getGameByPlayer(p) != null) {
if (plugin.getGm().getGameFourByPlayer(p) != null || plugin.getGm().getGameByPlayer(p) != null)
if (bow.contains(p)) {
p.sendMessage(plugin.getLang().get("messages.noShoot"));
e.setCancelled(true);
@ -1216,7 +1246,6 @@ public class PlayerListener implements Listener {
}
}
}
}
public void timeBow(Player p) {
p.setLevel(plugin.getConfig().getInt("bow.seconds"));
@ -1357,6 +1386,7 @@ public class PlayerListener implements Listener {
p.setHealth(p.getMaxHealth());
if (plugin.getConfig().getBoolean("remove.absorption") == true)
new BukkitRunnable() {
@Override
public void run() {
p.removePotionEffect(PotionEffectType.ABSORPTION);
@ -1370,6 +1400,7 @@ public class PlayerListener implements Listener {
}
}.runTaskLater(plugin, 1);
}
}
@EventHandler

11
MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/GenericNMS.java

@ -14,8 +14,8 @@ import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import cx.sfy.TheBridge.packets.ParticleHandler;
import cx.sfy.TheBridge.packets.Reflection;
import cx.sfy.TheBridge.packets.ParticleHandler.ParticleType;
import cx.sfy.TheBridge.packets.Reflection;
public class GenericNMS implements NMS {
@ -45,14 +45,11 @@ public class GenericNMS implements NMS {
@Override
public ChunkData generateChunkData(World world, Random random, int cx, int cz, BiomeGrid biome) {
final ChunkGenerator.ChunkData chunkData = this.createChunkData(world);
for (int x = 0; x < 16; ++x) {
for (int z = 0; z < 16; ++z) {
for (int x = 0; x < 16; ++x)
for (int z = 0; z < 16; ++z)
biome.setBiome(x, z, bm());
}
}
if (0 >= cx << 4 && 0 < cx + 1 << 4 && 0 >= cz << 4 && 0 < cz + 1 << 4) {
if (0 >= cx << 4 && 0 < cx + 1 << 4 && 0 >= cz << 4 && 0 < cz + 1 << 4)
chunkData.setBlock(0, 81, 0, Material.STONE);
}
return chunkData;
}
};

8
MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/NMS.java

@ -8,12 +8,12 @@ import cx.sfy.TheBridge.packets.ParticleHandler.ParticleType;
public interface NMS {
public ChunkGenerator getChunkGenerator();
ChunkGenerator getChunkGenerator();
public void sendTitle(Player player, int fadein, int stay, int fadeout, String title, String subtitle);
void sendTitle(Player player, int fadein, int stay, int fadeout, String title, String subtitle);
public void sendActionBar(Player player, String s);
void sendActionBar(Player player, String s);
public ParticleHandler sendParticle(ParticleType type, double speed, int count, double radius);
ParticleHandler sendParticle(ParticleType type, double speed, int count, double radius);
}

169
MultiArena-TheBridge/src/cx/sfy/TheBridge/packets/ParticleHandler.java

@ -12,40 +12,41 @@ import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import lombok.Getter;
@SuppressWarnings({ "unchecked", "rawtypes" })
public class ParticleHandler {
private static Class<?> packetClass = null;
private static Constructor<?> packetConstructor = null;
private static Field player_connection = null;
private static Method player_sendPacket = null;
private static HashMap<Class<? extends Entity>, Method> handles = new HashMap<Class<? extends Entity>, Method>();
private static Field playerCon = null;
private static Method sendPacket = null;
private static HashMap<Class<? extends Entity>, Method> handles = new HashMap<>();
private static Class<Enum> enumParticle = null;
private static Class<Enum> enump = null;
private ParticleType type;
@Getter
private double speed;
@Getter
private int count;
@Getter
private double radius;
public static void load() {
String vString = getVersion().replace("v", "");
double v = 0;
if (!vString.isEmpty()) {
String[] array = vString.split("_");
v = Double.parseDouble(array[0] + "." + array[1]);
String str = getVersion().replace("v", "");
double version = 0;
if (!str.isEmpty()) {
String[] array = str.split("_");
version = Double.parseDouble(array[0] + "." + array[1]);
}
try {
packetClass = getNmsClass("PacketPlayOutWorldParticles");
if (v == 1.8) {
Bukkit.getLogger().info("[ParticleHandler] Hooking into Netty NMS classes");
Bukkit.getLogger().info("[ParticleHandler] Version is " + v + " - using packet constructor");
enumParticle = (Class<Enum>) getNmsClass("EnumParticle");
packetConstructor = packetClass.getDeclaredConstructor(enumParticle, boolean.class, float.class,
float.class, float.class, float.class, float.class, float.class, float.class, int.class,
int[].class);
} else {
if (version == 1.8) {
Bukkit.getLogger().info("[ParticleHandler] Version is " + version + " - using packet constructor");
enump = (Class<Enum>) getNmsClass("EnumParticle");
packetConstructor = getNmsClass("PacketPlayOutWorldParticles").getDeclaredConstructor(enump,
boolean.class, float.class, float.class, float.class, float.class, float.class, float.class,
float.class, int.class, int[].class);
} else
Bukkit.getLogger().info("[ParticleHandler] Hooking into the new particle system");
}
} catch (Exception ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("[ParticleHandler] Failed to initialize NMS components!");
@ -59,18 +60,6 @@ public class ParticleHandler {
this.radius = radius;
}
public double getSpeed() {
return speed;
}
public int getCount() {
return count;
}
public double getRadius() {
return radius;
}
public void sendToLocation(Location location) {
String vString = getVersion().replace("v", "");
double v = 0;
@ -78,29 +67,26 @@ public class ParticleHandler {
String[] array = vString.split("_");
v = Double.parseDouble(array[0] + "." + array[1]);
}
if (v == 1.8) {
if (v == 1.8)
try {
Object packet = createPacket(location);
for (Player player : Bukkit.getOnlinePlayers()) {
for (Player player : Bukkit.getOnlinePlayers())
sendPacket(player, packet);
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
location.getWorld().spawnParticle(Particle.valueOf(type.getName().toUpperCase()), (float) location.getX(),
(float) location.getY(), (float) location.getZ(), this.count, (float) this.radius,
(float) this.radius, (float) this.radius, (float) this.speed);
}
else
location.getWorld().spawnParticle(Particle.valueOf(type.getParticle().toUpperCase()),
(float) location.getX(), (float) location.getY(), (float) location.getZ(), this.count,
(float) this.radius, (float) this.radius, (float) this.radius, (float) this.speed);
}
private Object createPacket(Location location) {
try {
if (this.count <= 0) {
if (this.count <= 0)
this.count = 1;
}
Object packet;
Object particleType = enumParticle.getEnumConstants()[type.getId()];
Object particleType = enump.getEnumConstants()[type.getId()];
packet = packetConstructor.newInstance(particleType, true, (float) location.getX(), (float) location.getY(),
(float) location.getZ(), (float) this.radius, (float) this.radius, (float) this.radius,
(float) this.speed, this.count, new int[0]);
@ -120,15 +106,13 @@ public class ParticleHandler {
private static void sendPacket(Player p, Object packet) throws IllegalArgumentException {
try {
if (player_connection == null) {
player_connection = getHandle(p).getClass().getField("playerConnection");
for (Method m : player_connection.get(getHandle(p)).getClass().getMethods()) {
if (m.getName().equalsIgnoreCase("sendPacket")) {
player_sendPacket = m;
if (playerCon == null) {
playerCon = getHandle(p).getClass().getField("playerConnection");
for (Method m : playerCon.get(getHandle(p)).getClass().getMethods())
if (m.getName().equalsIgnoreCase("sendPacket"))
sendPacket = m;
}
}
}
player_sendPacket.invoke(player_connection.get(getHandle(p)), packet);
sendPacket.invoke(playerCon.get(getHandle(p)), packet);
} catch (IllegalAccessException ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("[ParticleHandler] Failed to send packet!");
@ -176,45 +160,60 @@ public class ParticleHandler {
return "";
}
@Getter
public enum ParticleType {
EXPLOSION_NORMAL("explode", 0, 17), EXPLOSION_LARGE("largeexplode", 1, 1),
EXPLOSION_HUGE("hugeexplosion", 2, 0), FIREWORKS_SPARK("fireworksSpark", 3, 2), WATER_BUBBLE("bubble", 4, 3),
WATER_SPLASH("splash", 5, 21), WATER_WAKE("wake", 6, -1), SUSPENDED("suspended", 7, 4),
SUSPENDED_DEPTH("depthsuspend", 8, 5), CRIT("crit", 9, 7), CRIT_MAGIC("magicCrit", 10, 8),
SMOKE_NORMAL("smoke", 11, -1), SMOKE_LARGE("largesmoke", 12, 22), SPELL("spell", 13, 11),
SPELL_INSTANT("instantSpell", 14, 12), SPELL_MOB("mobSpell", 15, 9),
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, 10), SPELL_WITCH("witchMagic", 17, 13),
DRIP_WATER("dripWater", 18, 27), DRIP_LAVA("dripLava", 19, 28), VILLAGER_ANGRY("angryVillager", 20, 31),
VILLAGER_HAPPY("happyVillager", 21, 32), TOWN_AURA("townaura", 22, 6), NOTE("note", 23, 24),
PORTAL("portal", 24, 15), ENCHANTMENT_TABLE("enchantmenttable", 25, 16), FLAME("flame", 26, 18),
LAVA("lava", 27, 19), FOOTSTEP("footstep", 28, 20), CLOUD("cloud", 29, 23), REDSTONE("reddust", 30, 24),
SNOWBALL("snowballpoof", 31, 25), SNOW_SHOVEL("snowshovel", 32, 28), SLIME("slime", 33, 29),
HEART("heart", 34, 30), BARRIER("barrier", 35, -1), ITEM_CRACK("iconcrack_", 36, 33),
BLOCK_CRACK("tilecrack_", 37, 34), BLOCK_DUST("blockdust_", 38, -1), WATER_DROP("droplet", 39, -1),
ITEM_TAKE("take", 40, -1), MOB_APPEARANCE("mobappearance", 41, -1);
private String name;
CRIT("crit", 9, 7),
CRIT_MAGIC("magicCrit", 10, 8),
SMOKE_NORMAL("smoke", 11, -1),
SMOKE_LARGE("largesmoke", 12, 22),
SPELL("spell", 13, 11),
SPELL_INSTANT("instantSpell", 14, 12),
SPELL_MOB("mobSpell", 15, 9),
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, 10),
SLIME("slime", 33, 29),
HEART("heart", 34, 30),
BARRIER("barrier", 35, -1),
ITEM_CRACK("iconcrack_", 36, 33),
BLOCK_CRACK("tilecrack_", 37, 34),
BLOCK_DUST("blockdust_", 38, -1),
SPELL_WITCH("witchMagic", 17, 13),
DRIP_WATER("dripWater", 18, 27),
DRIP_LAVA("dripLava", 19, 28),
VILLAGER_ANGRY("angryVillager", 20, 31),
VILLAGER_HAPPY("happyVillager", 21, 32),
TOWN_AURA("townaura", 22, 6),
EXPLOSION_NORMAL("explode", 0, 17),
EXPLOSION_LARGE("largeexplode", 1, 1),
EXPLOSION_HUGE("hugeexplosion", 2, 0),
FIREWORKS_SPARK("fireworksSpark", 3, 2),
WATER_BUBBLE("bubble", 4, 3),
WATER_SPLASH("splash", 5, 21),
WATER_WAKE("wake", 6, -1),
SUSPENDED("suspended", 7, 4),
SUSPENDED_DEPTH("depthsuspend", 8, 5),
NOTE("note", 23, 24),
PORTAL("portal", 24, 15),
ENCHANTMENT_TABLE("enchantmenttable", 25, 16),
FLAME("flame", 26, 18),
LAVA("lava", 27, 19),
FOOTSTEP("footstep", 28, 20),
CLOUD("cloud", 29, 23),
REDSTONE("reddust", 30, 24),
SNOWBALL("snowballpoof", 31, 25),
SNOW_SHOVEL("snowshovel", 32, 28),
WATER_DROP("droplet", 39, -1),
ITEM_TAKE("take", 40, -1),
MOB_APPEARANCE("mobappearance", 41, -1);
private String particle;
private int id;
private int legacyId;
private int legId;
ParticleType(String name, int id, int legacyId) {
this.name = name;
ParticleType(String particle, int id, int legId) {
this.particle = particle;
this.id = id;
this.legacyId = legacyId;
}
String getName() {
return name;
}
int getId() {
return id;
}
int getLegacyId() {
return legacyId;
this.legId = legId;
}
}
}

Loading…
Cancel
Save