Added config option ContactMojangServers which disables player skins, but stops the plugin from pinging Mojang servers.
Added reload command to reload the config. Tweaked a couple of things. Fixed isInvulnerable issue.
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -128,7 +128,7 @@ public class DisguiseAPI { | |||||||
|                                         } |                                         } | ||||||
|                                         watcherMethod.invoke(watcher, value); |                                         watcherMethod.invoke(watcher, value); | ||||||
|                                     } catch (Exception ex) { |                                     } catch (Exception ex) { | ||||||
|                                         ex.printStackTrace(); |                                         ex.printStackTrace(System.out); | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
| @@ -203,7 +203,7 @@ public class DisguiseAPI { | |||||||
|             DisguiseUtilities.addFutureDisguise(id, (TargetedDisguise) disguise); |             DisguiseUtilities.addFutureDisguise(id, (TargetedDisguise) disguise); | ||||||
|             return id; |             return id; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return -1; |         return -1; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -38,6 +38,7 @@ import org.bukkit.scheduler.BukkitRunnable; | |||||||
|  |  | ||||||
| import com.comphenix.protocol.ProtocolLibrary; | import com.comphenix.protocol.ProtocolLibrary; | ||||||
| import com.comphenix.protocol.events.PacketContainer; | import com.comphenix.protocol.events.PacketContainer; | ||||||
|  | import org.bukkit.scheduler.BukkitTask; | ||||||
|  |  | ||||||
| public class DisguiseListener implements Listener { | public class DisguiseListener implements Listener { | ||||||
|  |  | ||||||
| @@ -47,12 +48,13 @@ public class DisguiseListener implements Listener { | |||||||
|     private HashMap<String, BukkitRunnable> disguiseRunnable = new HashMap<>(); |     private HashMap<String, BukkitRunnable> disguiseRunnable = new HashMap<>(); | ||||||
|     private String latestVersion; |     private String latestVersion; | ||||||
|     private LibsDisguises plugin; |     private LibsDisguises plugin; | ||||||
|  |     private BukkitTask updaterTask; | ||||||
|  |  | ||||||
|     public DisguiseListener(LibsDisguises libsDisguises) { |     public DisguiseListener(LibsDisguises libsDisguises) { | ||||||
|         plugin = libsDisguises; |         plugin = libsDisguises; | ||||||
|         if (plugin.getConfig().getBoolean("NotifyUpdate")) { |         if (plugin.getConfig().getBoolean("NotifyUpdate")) { | ||||||
|             currentVersion = plugin.getDescription().getVersion(); |             currentVersion = plugin.getDescription().getVersion(); | ||||||
|             Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() { |             updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() { | ||||||
|                 public void run() { |                 public void run() { | ||||||
|                     try { |                     try { | ||||||
|                         UpdateChecker updateChecker = new UpdateChecker(); |                         UpdateChecker updateChecker = new UpdateChecker(); | ||||||
| @@ -78,6 +80,17 @@ public class DisguiseListener implements Listener { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     public void cleanup() { | ||||||
|  |         for (BukkitRunnable r : disguiseRunnable.values()) { | ||||||
|  |             r.cancel(); | ||||||
|  |         } | ||||||
|  |         for (Disguise d : disguiseEntity.values()) { | ||||||
|  |             d.removeDisguise(); | ||||||
|  |         } | ||||||
|  |         disguiseClone.clear(); | ||||||
|  |         updaterTask.cancel(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     private void checkPlayerCanBlowDisguise(Player entity) { |     private void checkPlayerCanBlowDisguise(Player entity) { | ||||||
|         Disguise[] disguises = DisguiseAPI.getDisguises(entity); |         Disguise[] disguises = DisguiseAPI.getDisguises(entity); | ||||||
|         if (disguises.length > 0) { |         if (disguises.length > 0) { | ||||||
| @@ -115,7 +128,7 @@ public class DisguiseListener implements Listener { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (InvocationTargetException e) { |         } catch (InvocationTargetException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -41,68 +41,34 @@ import org.bukkit.plugin.java.JavaPlugin; | |||||||
| import com.comphenix.protocol.wrappers.WrappedDataWatcher; | import com.comphenix.protocol.wrappers.WrappedDataWatcher; | ||||||
| import com.comphenix.protocol.wrappers.WrappedWatchableObject; | import com.comphenix.protocol.wrappers.WrappedWatchableObject; | ||||||
| import me.libraryaddict.disguise.utilities.Metrics; | import me.libraryaddict.disguise.utilities.Metrics; | ||||||
|  | import org.bukkit.event.HandlerList; | ||||||
|  |  | ||||||
| public class LibsDisguises extends JavaPlugin { | public class LibsDisguises extends JavaPlugin { | ||||||
|      |      | ||||||
|     public static LibsDisguises instance; //I'm sorry Sun MicroSystems and all mighty Java God |     public static LibsDisguises instance; //I'm sorry Sun MicroSystems and all mighty Java God | ||||||
|  |     private DisguiseListener listener; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void onEnable() { |     public void onEnable() { | ||||||
|         saveDefaultConfig(); |         saveDefaultConfig(); | ||||||
|         File configFile = new File(getDataFolder(), "config.yml"); |  | ||||||
|         InputStream stream = null; |  | ||||||
|         FileReader reader = null; |  | ||||||
|         try { |  | ||||||
|             stream = getClassLoader().getResource("config.yml").openStream(); |  | ||||||
|             String toWrite = read(new InputStreamReader(stream)); |  | ||||||
|             reader = new FileReader(configFile); |  | ||||||
|             String toRead = read(reader); |  | ||||||
|  |  | ||||||
|             if (!toRead.equals(toWrite)) { |  | ||||||
|                 try { |  | ||||||
|                     FileWriter writer = new FileWriter(configFile); |  | ||||||
|                     try { |  | ||||||
|                         writer.write(toWrite); |  | ||||||
|                     } finally { |  | ||||||
|                         writer.close(); |  | ||||||
|                     } |  | ||||||
|                 } catch (IOException e) { |  | ||||||
|                     e.printStackTrace(); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } catch (IOException e) { |  | ||||||
|             e.printStackTrace(); |  | ||||||
|         } finally { |  | ||||||
|             tryClose(stream); |  | ||||||
|             tryClose(reader); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         PacketsManager.init(this); |         PacketsManager.init(this); | ||||||
|         DisguiseUtilities.init(this); |         DisguiseUtilities.init(this); | ||||||
|         DisguiseConfig.initConfig(getConfig()); |         DisguiseConfig.initConfig(getConfig()); | ||||||
|  |  | ||||||
|         try { |  | ||||||
|             // Here I use reflection to set the plugin for Disguise.. |  | ||||||
|             // Kind of stupid but I don't want open API calls for a commonly used class. |  | ||||||
|             Field field = Disguise.class.getDeclaredField("plugin"); |  | ||||||
|             field.setAccessible(true); |  | ||||||
|             field.set(null, this); |  | ||||||
|         } catch (Exception ex) { |  | ||||||
|             ex.printStackTrace(); |  | ||||||
|         } |  | ||||||
|         PacketsManager.addPacketListeners(); |         PacketsManager.addPacketListeners(); | ||||||
|         DisguiseListener listener = new DisguiseListener(this); |         listener = new DisguiseListener(this); | ||||||
|         Bukkit.getPluginManager().registerEvents(listener, this); |         Bukkit.getPluginManager().registerEvents(listener, this); | ||||||
|         getCommand("disguise").setExecutor(new DisguiseCommand()); |         getCommand("disguise").setExecutor(new DisguiseCommand()); | ||||||
|         getCommand("undisguise").setExecutor(new UndisguiseCommand()); |         getCommand("undisguise").setExecutor(new UndisguiseCommand()); | ||||||
|         getCommand("disguiseplayer").setExecutor(new DisguisePlayerCommand()); |         getCommand("disguiseplayer").setExecutor(new DisguisePlayerCommand()); | ||||||
|         getCommand("undisguiseplayer").setExecutor(new UndisguisePlayerCommand()); |         getCommand("undisguiseplayer").setExecutor(new UndisguisePlayerCommand()); | ||||||
|         getCommand("undisguiseentity").setExecutor(new UndisguiseEntityCommand(listener)); |         getCommand("undisguiseentity").setExecutor(new UndisguiseEntityCommand()); | ||||||
|         getCommand("disguiseentity").setExecutor(new DisguiseEntityCommand(listener)); |         getCommand("disguiseentity").setExecutor(new DisguiseEntityCommand()); | ||||||
|         getCommand("disguiseradius").setExecutor(new DisguiseRadiusCommand(getConfig().getInt("DisguiseRadiusMax"))); |         getCommand("disguiseradius").setExecutor(new DisguiseRadiusCommand(getConfig().getInt("DisguiseRadiusMax"))); | ||||||
|         getCommand("undisguiseradius").setExecutor(new UndisguiseRadiusCommand(getConfig().getInt("UndisguiseRadiusMax"))); |         getCommand("undisguiseradius").setExecutor(new UndisguiseRadiusCommand(getConfig().getInt("UndisguiseRadiusMax"))); | ||||||
|         getCommand("disguisehelp").setExecutor(new DisguiseHelpCommand()); |         getCommand("disguisehelp").setExecutor(new DisguiseHelpCommand()); | ||||||
|         getCommand("disguiseclone").setExecutor(new DisguiseCloneCommand(listener)); |         getCommand("disguiseclone").setExecutor(new DisguiseCloneCommand()); | ||||||
|         getCommand("libsdisguises").setExecutor(new LibsDisguisesCommand()); |         getCommand("libsdisguises").setExecutor(new LibsDisguisesCommand()); | ||||||
|         registerValues(); |         registerValues(); | ||||||
|         instance = this; |         instance = this; | ||||||
| @@ -112,45 +78,13 @@ public class LibsDisguises extends JavaPlugin { | |||||||
|         } catch (IOException e) {} |         } catch (IOException e) {} | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     private String read(Reader reader) { |     /** | ||||||
|         String toWrite = ""; |      * Reloads the config with new config options. | ||||||
|         BufferedReader input = null; |      */ | ||||||
|  |     public void reload() { | ||||||
|         try { |         HandlerList.unregisterAll(listener); | ||||||
|             input = new BufferedReader(reader); |         reloadConfig(); | ||||||
|             String currentPath = ""; |         DisguiseConfig.initConfig(getConfig());                 | ||||||
|             String line; |  | ||||||
|  |  | ||||||
|             while ((line = input.readLine()) != null) { |  | ||||||
|                 if (line.replace(" ", "").startsWith("#")) { |  | ||||||
|                     toWrite += line; |  | ||||||
|                 } else if (line.contains(":")) { |  | ||||||
|                     if (line.substring(line.indexOf(":") + 1).equals("")) { |  | ||||||
|                         currentPath = line.substring(0, line.length() - 1) + "."; |  | ||||||
|                         toWrite += line; |  | ||||||
|                     } else { |  | ||||||
|                         if (!line.startsWith("  ")) { |  | ||||||
|                             currentPath = ""; |  | ||||||
|                         } |  | ||||||
|                         String obj = line.substring(0, line.indexOf(":")).replace(" ", ""); |  | ||||||
|                         Object value = getConfig().get(currentPath + obj); |  | ||||||
|                         if (value instanceof String) { |  | ||||||
|                             value = "'" + value + "'"; |  | ||||||
|                         } |  | ||||||
|                         toWrite += (currentPath.length() == 0 ? "" : "  ") + obj + ": " + value; |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|                 if (input.ready()) { |  | ||||||
|                     toWrite += "\n"; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } catch (Exception ex) { |  | ||||||
|             ex.printStackTrace(); |  | ||||||
|         } finally { |  | ||||||
|             tryClose(input); |  | ||||||
|             tryClose(reader); |  | ||||||
|         } |  | ||||||
|         return toWrite; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -312,7 +246,7 @@ public class LibsDisguises extends JavaPlugin { | |||||||
|                                     + "http://assets.comphenix.net/job/ProtocolLib/ and (LibsDisguises) http://ci.md-5.net/job/LibsDisguises/"); |                                     + "http://assets.comphenix.net/job/ProtocolLib/ and (LibsDisguises) http://ci.md-5.net/job/LibsDisguises/"); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -325,14 +259,7 @@ public class LibsDisguises extends JavaPlugin { | |||||||
|         return builder.toString(); |         return builder.toString(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void tryClose(Closeable input) { |     public DisguiseListener getListener() { | ||||||
|         if (input != null) { |         return listener; | ||||||
|             try { |  | ||||||
|                 input.close(); |  | ||||||
|             } catch (IOException e) { |  | ||||||
|                 e.printStackTrace(); |  | ||||||
|     } |     } | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ import java.util.HashMap; | |||||||
|  |  | ||||||
| import me.libraryaddict.disguise.DisguiseConfig; | import me.libraryaddict.disguise.DisguiseConfig; | ||||||
| import me.libraryaddict.disguise.DisguiseListener; | import me.libraryaddict.disguise.DisguiseListener; | ||||||
|  | import me.libraryaddict.disguise.LibsDisguises; | ||||||
| import me.libraryaddict.disguise.disguisetypes.DisguiseType; | import me.libraryaddict.disguise.disguisetypes.DisguiseType; | ||||||
| import me.libraryaddict.disguise.utilities.BaseDisguiseCommand; | import me.libraryaddict.disguise.utilities.BaseDisguiseCommand; | ||||||
|  |  | ||||||
| @@ -15,12 +16,6 @@ import org.bukkit.command.CommandSender; | |||||||
|  |  | ||||||
| public class DisguiseCloneCommand extends BaseDisguiseCommand { | public class DisguiseCloneCommand extends BaseDisguiseCommand { | ||||||
|  |  | ||||||
|     private DisguiseListener listener; |  | ||||||
|  |  | ||||||
|     public DisguiseCloneCommand(DisguiseListener listener) { |  | ||||||
|         this.listener = listener; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { |     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||||||
|         if (sender.getName().equals("CONSOLE")) { |         if (sender.getName().equals("CONSOLE")) { | ||||||
| @@ -48,7 +43,7 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand { | |||||||
|                     return true; |                     return true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             listener.setDisguiseClone(sender.getName(), new Boolean[] { doEquipment, doSneak, doSprint }); |             LibsDisguises.instance.getListener().setDisguiseClone(sender.getName(), new Boolean[] { doEquipment, doSneak, doSprint }); | ||||||
|             sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseCloneExpire() |             sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseCloneExpire() | ||||||
|                     + " seconds to grab the disguise reference!"); |                     + " seconds to grab the disguise reference!"); | ||||||
|         } else { |         } else { | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ public class DisguiseCommand extends BaseDisguiseCommand { | |||||||
|             } |             } | ||||||
|             return true; |             return true; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         if (DisguiseConfig.isNameOfPlayerShownAboveDisguise()) { |         if (DisguiseConfig.isNameOfPlayerShownAboveDisguise()) { | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ import java.util.HashMap; | |||||||
|  |  | ||||||
| import me.libraryaddict.disguise.DisguiseConfig; | import me.libraryaddict.disguise.DisguiseConfig; | ||||||
| import me.libraryaddict.disguise.DisguiseListener; | import me.libraryaddict.disguise.DisguiseListener; | ||||||
|  | import me.libraryaddict.disguise.LibsDisguises; | ||||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||||
| import me.libraryaddict.disguise.disguisetypes.DisguiseType; | import me.libraryaddict.disguise.disguisetypes.DisguiseType; | ||||||
| import me.libraryaddict.disguise.utilities.BaseDisguiseCommand; | import me.libraryaddict.disguise.utilities.BaseDisguiseCommand; | ||||||
| @@ -15,12 +16,6 @@ import org.bukkit.command.CommandSender; | |||||||
|  |  | ||||||
| public class DisguiseEntityCommand extends BaseDisguiseCommand { | public class DisguiseEntityCommand extends BaseDisguiseCommand { | ||||||
|  |  | ||||||
|     private DisguiseListener listener; |  | ||||||
|  |  | ||||||
|     public DisguiseEntityCommand(DisguiseListener listener) { |  | ||||||
|         this.listener = listener; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { |     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||||||
|         if (sender.getName().equals("CONSOLE")) { |         if (sender.getName().equals("CONSOLE")) { | ||||||
| @@ -36,10 +31,10 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand { | |||||||
|             } |             } | ||||||
|             return true; |             return true; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         listener.setDisguiseEntity(sender.getName(), disguise); |         LibsDisguises.instance.getListener().setDisguiseEntity(sender.getName(), disguise); | ||||||
|         sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseEntityExpire() |         sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseEntityExpire() | ||||||
|                 + " seconds to disguise it as a " + disguise.getType().toReadable() + "!"); |                 + " seconds to disguise it as a " + disguise.getType().toReadable() + "!"); | ||||||
|         return true; |         return true; | ||||||
|   | |||||||
| @@ -70,7 +70,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand { | |||||||
|             enumHelp.add(new EnumHelp("AnimalColor", "Animal colors", ChatColor.RED + "/disguisehelp AnimalColors " |             enumHelp.add(new EnumHelp("AnimalColor", "Animal colors", ChatColor.RED + "/disguisehelp AnimalColors " | ||||||
|                     + ChatColor.GREEN + "- View all the colors you can use for a animal color", AnimalColor.values())); |                     + ChatColor.GREEN + "- View all the colors you can use for a animal color", AnimalColor.values())); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         try { |         try { | ||||||
|             enumHelp.add(new EnumHelp("Art", "Arts", ChatColor.RED + "/disguisehelp Art " + ChatColor.GREEN |             enumHelp.add(new EnumHelp("Art", "Arts", ChatColor.RED + "/disguisehelp Art " + ChatColor.GREEN | ||||||
| @@ -107,7 +107,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand { | |||||||
|                     + ChatColor.GREEN + "- View all the potion effects you can set", enumReturns.toArray(new String[enumReturns |                     + ChatColor.GREEN + "- View all the potion effects you can set", enumReturns.toArray(new String[enumReturns | ||||||
|                     .size()]))); |                     .size()]))); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         try { |         try { | ||||||
|             enumHelp.add(new EnumHelp("Profession", "Villager professions", ChatColor.RED + "/disguisehelp Professions " |             enumHelp.add(new EnumHelp("Profession", "Villager professions", ChatColor.RED + "/disguisehelp Professions " | ||||||
| @@ -234,7 +234,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand { | |||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     } catch (Exception ex) { |                     } catch (Exception ex) { | ||||||
|                         ex.printStackTrace(); |                         ex.printStackTrace(System.out); | ||||||
|                     } |                     } | ||||||
|                     Collections.sort(methods, String.CASE_INSENSITIVE_ORDER); |                     Collections.sort(methods, String.CASE_INSENSITIVE_ORDER); | ||||||
|                     for (int i = 0; i < methods.size(); i++) { |                     for (int i = 0; i < methods.size(); i++) { | ||||||
|   | |||||||
| @@ -49,7 +49,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand { | |||||||
|             } |             } | ||||||
|             return true; |             return true; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) { |         if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) { | ||||||
|   | |||||||
| @@ -105,7 +105,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand { | |||||||
|             } |             } | ||||||
|             return true; |             return true; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|             return true; |             return true; | ||||||
|         } // Time to use it! |         } // Time to use it! | ||||||
|         int disguisedEntitys = 0; |         int disguisedEntitys = 0; | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| package me.libraryaddict.disguise.commands; | package me.libraryaddict.disguise.commands; | ||||||
|  |  | ||||||
|  | import me.libraryaddict.disguise.LibsDisguises; | ||||||
| import org.bukkit.Bukkit; | import org.bukkit.Bukkit; | ||||||
| import org.bukkit.ChatColor; | import org.bukkit.ChatColor; | ||||||
| import org.bukkit.command.Command; | import org.bukkit.command.Command; | ||||||
| @@ -10,11 +11,22 @@ public class LibsDisguisesCommand implements CommandExecutor { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { |     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||||||
|  |         if (args.length == 0) { | ||||||
|         sender.sendMessage(ChatColor.DARK_GREEN |         sender.sendMessage(ChatColor.DARK_GREEN | ||||||
|                 + "This server is running " |                 + "This server is running " | ||||||
|                 + "Lib's Disguises v." |                 + "Lib's Disguises v." | ||||||
|                 + Bukkit.getPluginManager().getPlugin("LibsDisguises").getDescription().getVersion() |                 + Bukkit.getPluginManager().getPlugin("LibsDisguises").getDescription().getVersion() | ||||||
|                 + "by libraryaddict, maintained by NavidK0"); |                 + " by libraryaddict, maintained by NavidK0.\n" | ||||||
|  |                 + "Use /libsdisguises reload to reload the config. All disguises will be blown by doing this."); | ||||||
|  |         } else if (args.length > 0) { | ||||||
|  |             if (args[0].equalsIgnoreCase("reload")) { | ||||||
|  |                 LibsDisguises.instance.reload(); | ||||||
|  |                 sender.sendMessage(ChatColor.GREEN + "[LibsDisguises] Reloaded config."); | ||||||
|  |                 return true; | ||||||
|  |             } else { | ||||||
|  |                 sender.sendMessage(ChatColor.RED + "[LibsDisguises] That command doesn't exist!"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package me.libraryaddict.disguise.commands; | package me.libraryaddict.disguise.commands; | ||||||
|  |  | ||||||
| import me.libraryaddict.disguise.DisguiseListener; | import me.libraryaddict.disguise.DisguiseListener; | ||||||
|  | import me.libraryaddict.disguise.LibsDisguises; | ||||||
|  |  | ||||||
| import org.bukkit.ChatColor; | import org.bukkit.ChatColor; | ||||||
| import org.bukkit.command.Command; | import org.bukkit.command.Command; | ||||||
| @@ -8,11 +9,6 @@ import org.bukkit.command.CommandExecutor; | |||||||
| import org.bukkit.command.CommandSender; | import org.bukkit.command.CommandSender; | ||||||
|  |  | ||||||
| public class UndisguiseEntityCommand implements CommandExecutor { | public class UndisguiseEntityCommand implements CommandExecutor { | ||||||
|     private DisguiseListener listener; |  | ||||||
|  |  | ||||||
|     public UndisguiseEntityCommand(DisguiseListener listener) { |  | ||||||
|         this.listener = listener; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { |     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||||||
| @@ -21,7 +17,7 @@ public class UndisguiseEntityCommand implements CommandExecutor { | |||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         if (sender.hasPermission("libsdisguises.undisguiseentity")) { |         if (sender.hasPermission("libsdisguises.undisguiseentity")) { | ||||||
|             listener.setDisguiseEntity(sender.getName(), null); |             LibsDisguises.instance.getListener().setDisguiseEntity(sender.getName(), null); | ||||||
|             sender.sendMessage(ChatColor.RED + "Right click a disguised entity to undisguise them!"); |             sender.sendMessage(ChatColor.RED + "Right click a disguised entity to undisguise them!"); | ||||||
|         } else |         } else | ||||||
|             sender.sendMessage(ChatColor.RED + "You are forbidden to use this command."); |             sender.sendMessage(ChatColor.RED + "You are forbidden to use this command."); | ||||||
|   | |||||||
| @@ -35,9 +35,9 @@ import com.comphenix.protocol.PacketType; | |||||||
| import com.comphenix.protocol.ProtocolLibrary; | import com.comphenix.protocol.ProtocolLibrary; | ||||||
| import com.comphenix.protocol.events.PacketContainer; | import com.comphenix.protocol.events.PacketContainer; | ||||||
| import com.comphenix.protocol.reflect.StructureModifier; | import com.comphenix.protocol.reflect.StructureModifier; | ||||||
|  | import me.libraryaddict.disguise.LibsDisguises; | ||||||
|  |  | ||||||
| public abstract class Disguise { | public abstract class Disguise { | ||||||
|     private static JavaPlugin plugin; |  | ||||||
|     private boolean disguiseInUse; |     private boolean disguiseInUse; | ||||||
|     private DisguiseType disguiseType; |     private DisguiseType disguiseType; | ||||||
|     private Entity entity; |     private Entity entity; | ||||||
| @@ -81,7 +81,7 @@ public abstract class Disguise { | |||||||
|             // Construct the FlagWatcher from the stored class |             // Construct the FlagWatcher from the stored class | ||||||
|             setWatcher((FlagWatcher) getType().getWatcherClass().getConstructor(Disguise.class).newInstance(this)); |             setWatcher((FlagWatcher) getType().getWatcherClass().getConstructor(Disguise.class).newInstance(this)); | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         // Set the disguise if its a baby or not |         // Set the disguise if its a baby or not | ||||||
|         if (!isAdult) { |         if (!isAdult) { | ||||||
| @@ -261,7 +261,7 @@ public abstract class Disguise { | |||||||
|                                         ProtocolLibrary.getProtocolManager().sendServerPacket((Player) getEntity(), |                                         ProtocolLibrary.getProtocolManager().sendServerPacket((Player) getEntity(), | ||||||
|                                                 selfLookPacket, false); |                                                 selfLookPacket, false); | ||||||
|                                     } catch (InvocationTargetException e) { |                                     } catch (InvocationTargetException e) { | ||||||
|                                         e.printStackTrace(); |                                         e.printStackTrace(System.out); | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
| @@ -287,7 +287,7 @@ public abstract class Disguise { | |||||||
|                                             false); |                                             false); | ||||||
|                                 } |                                 } | ||||||
|                             } catch (Exception e) { |                             } catch (Exception e) { | ||||||
|                                 e.printStackTrace(); |                                 e.printStackTrace(System.out); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                         // If we need to send a packet to update the exp position as it likes to gravitate client sided to |                         // If we need to send a packet to update the exp position as it likes to gravitate client sided to | ||||||
| @@ -307,12 +307,12 @@ public abstract class Disguise { | |||||||
|                                         ProtocolLibrary.getProtocolManager().sendServerPacket((Player) getEntity(), selfPacket, |                                         ProtocolLibrary.getProtocolManager().sendServerPacket((Player) getEntity(), selfPacket, | ||||||
|                                                 false); |                                                 false); | ||||||
|                                     } catch (InvocationTargetException e) { |                                     } catch (InvocationTargetException e) { | ||||||
|                                         e.printStackTrace(); |                                         e.printStackTrace(System.out); | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                         } catch (InvocationTargetException e) { |                         } catch (InvocationTargetException e) { | ||||||
|                             e.printStackTrace(); |                             e.printStackTrace(System.out); | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| @@ -707,7 +707,7 @@ public abstract class Disguise { | |||||||
|             // Just return. |             // Just return. | ||||||
|             if (!event.isCancelled()) { |             if (!event.isCancelled()) { | ||||||
|                 disguiseInUse = true; |                 disguiseInUse = true; | ||||||
|                 task = Bukkit.getScheduler().runTaskTimer(plugin, velocityRunnable, 1, 1); |                 task = Bukkit.getScheduler().runTaskTimer(LibsDisguises.instance, velocityRunnable, 1, 1); | ||||||
|                 // Stick the disguise in the disguises bin |                 // Stick the disguise in the disguises bin | ||||||
|                 DisguiseUtilities.addDisguise(entity.getUniqueId(), (TargetedDisguise) this); |                 DisguiseUtilities.addDisguise(entity.getUniqueId(), (TargetedDisguise) this); | ||||||
|                 if (isSelfDisguiseVisible() && getEntity() instanceof Player) { |                 if (isSelfDisguiseVisible() && getEntity() instanceof Player) { | ||||||
| @@ -716,7 +716,7 @@ public abstract class Disguise { | |||||||
|                 // Resend the disguised entity's packet |                 // Resend the disguised entity's packet | ||||||
|                 DisguiseUtilities.refreshTrackers((TargetedDisguise) this); |                 DisguiseUtilities.refreshTrackers((TargetedDisguise) this); | ||||||
|                 // If he is a player, then self disguise himself |                 // If he is a player, then self disguise himself | ||||||
|                 Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { |                 Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.instance, new Runnable() { | ||||||
|                     public void run() { |                     public void run() { | ||||||
|                         DisguiseUtilities.setupFakeDisguise(Disguise.this); |                         DisguiseUtilities.setupFakeDisguise(Disguise.this); | ||||||
|                     } |                     } | ||||||
|   | |||||||
| @@ -213,7 +213,7 @@ public enum DisguiseType { | |||||||
|                     disguiseType = DisguiseType.ZOMBIE_VILLAGER; |                     disguiseType = DisguiseType.ZOMBIE_VILLAGER; | ||||||
|                 } |                 } | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|         case HORSE: |         case HORSE: | ||||||
| @@ -221,7 +221,7 @@ public enum DisguiseType { | |||||||
|                 Object variant = getVariant.invoke(entity); |                 Object variant = getVariant.invoke(entity); | ||||||
|                 disguiseType = DisguiseType.valueOf(((Enum) variant).name()); |                 disguiseType = DisguiseType.valueOf(((Enum) variant).name()); | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|         case SKELETON: |         case SKELETON: | ||||||
| @@ -231,7 +231,7 @@ public enum DisguiseType { | |||||||
|                     disguiseType = DisguiseType.WITHER_SKELETON; |                     disguiseType = DisguiseType.WITHER_SKELETON; | ||||||
|                 } |                 } | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|         case GUARDIAN: |         case GUARDIAN: | ||||||
| @@ -240,7 +240,7 @@ public enum DisguiseType { | |||||||
|                     disguiseType = DisguiseType.ELDER_GUARDIAN; |                     disguiseType = DisguiseType.ELDER_GUARDIAN; | ||||||
|                 } |                 } | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|         default: |         default: | ||||||
|   | |||||||
| @@ -70,7 +70,7 @@ public class FlagWatcher { | |||||||
|         try { |         try { | ||||||
|             cloned = getClass().getConstructor(Disguise.class).newInstance(getDisguise()); |             cloned = getClass().getConstructor(Disguise.class).newInstance(getDisguise()); | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|             cloned = new FlagWatcher(getDisguise()); |             cloned = new FlagWatcher(getDisguise()); | ||||||
|         } |         } | ||||||
|         cloned.entityValues = (HashMap<Integer, Object>) entityValues.clone(); |         cloned.entityValues = (HashMap<Integer, Object>) entityValues.clone(); | ||||||
| @@ -267,7 +267,7 @@ public class FlagWatcher { | |||||||
|                 try { |                 try { | ||||||
|                     ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); |                     ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); | ||||||
|                 } catch (InvocationTargetException e) { |                 } catch (InvocationTargetException e) { | ||||||
|                     e.printStackTrace(); |                     e.printStackTrace(System.out); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -359,7 +359,7 @@ public class FlagWatcher { | |||||||
|                 try { |                 try { | ||||||
|                     ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); |                     ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); | ||||||
|                 } catch (InvocationTargetException e) { |                 } catch (InvocationTargetException e) { | ||||||
|                     e.printStackTrace(); |                     e.printStackTrace(System.out); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -154,9 +154,6 @@ public class PlayerDisguise extends TargetedDisguise { | |||||||
|  |  | ||||||
|     public PlayerDisguise setSkin(String skinToUse) { |     public PlayerDisguise setSkin(String skinToUse) { | ||||||
|         this.skinToUse = skinToUse; |         this.skinToUse = skinToUse; | ||||||
|         if (!LibsDisguises.instance.getConfig().getBoolean("ContactMojangServers")) { |  | ||||||
|             return this; |  | ||||||
|         } |  | ||||||
|         if (skinToUse == null) { |         if (skinToUse == null) { | ||||||
|             this.currentLookup = null; |             this.currentLookup = null; | ||||||
|             this.gameProfile = null; |             this.gameProfile = null; | ||||||
| @@ -164,6 +161,7 @@ public class PlayerDisguise extends TargetedDisguise { | |||||||
|             if (skinToUse.length() > 16) { |             if (skinToUse.length() > 16) { | ||||||
|                 this.skinToUse = skinToUse.substring(0, 16); |                 this.skinToUse = skinToUse.substring(0, 16); | ||||||
|             } |             } | ||||||
|  |             if (LibsDisguises.instance.getConfig().getBoolean("ContactMojangServers", true)) { | ||||||
|                 currentLookup = new LibsProfileLookup() { |                 currentLookup = new LibsProfileLookup() { | ||||||
|                     @Override |                     @Override | ||||||
|                     public void onLookup(WrappedGameProfile gameProfile) { |                     public void onLookup(WrappedGameProfile gameProfile) { | ||||||
| @@ -181,6 +179,7 @@ public class PlayerDisguise extends TargetedDisguise { | |||||||
|                     setSkin(gameProfile); |                     setSkin(gameProfile); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |         } | ||||||
|         return this; |         return this; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -197,10 +196,11 @@ public class PlayerDisguise extends TargetedDisguise { | |||||||
|             this.skinToUse = null; |             this.skinToUse = null; | ||||||
|             return this; |             return this; | ||||||
|         } |         } | ||||||
|  |         if (LibsDisguises.instance.getConfig().getBoolean("ContactMojangServers", true)) { | ||||||
|             Validate.notEmpty(gameProfile.getName(), "Name must be set"); |             Validate.notEmpty(gameProfile.getName(), "Name must be set"); | ||||||
|             this.skinToUse = gameProfile.getName(); |             this.skinToUse = gameProfile.getName(); | ||||||
|             this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(null, getName(), gameProfile); |             this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(null, getName(), gameProfile); | ||||||
|  |         } | ||||||
|         return this; |         return this; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ public class LivingWatcher extends FlagWatcher { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     private double maxHealth; |     private double maxHealth; | ||||||
| @@ -101,7 +101,7 @@ public class LivingWatcher extends FlagWatcher { | |||||||
|                 f4 += 1.0F; |                 f4 += 1.0F; | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         f1 = f1 / f4 * 255.0F; |         f1 = f1 / f4 * 255.0F; | ||||||
| @@ -160,7 +160,7 @@ public class LivingWatcher extends FlagWatcher { | |||||||
|                 try { |                 try { | ||||||
|                     ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false); |                     ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false); | ||||||
|                 } catch (InvocationTargetException e) { |                 } catch (InvocationTargetException e) { | ||||||
|                     e.printStackTrace(); |                     e.printStackTrace(System.out); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -117,7 +117,7 @@ public class PlayerWatcher extends LivingWatcher { | |||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } catch (Exception ex) { |                 } catch (Exception ex) { | ||||||
|                     ex.printStackTrace(); |                     ex.printStackTrace(System.out); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -95,7 +95,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor { | |||||||
|             try { |             try { | ||||||
|                 methods[methods.length - i--] = Disguise.class.getMethod(methodName, boolean.class); |                 methods[methods.length - i--] = Disguise.class.getMethod(methodName, boolean.class); | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return methods; |         return methods; | ||||||
| @@ -630,7 +630,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor { | |||||||
|                     storedEx = ex; |                     storedEx = ex; | ||||||
|                     methodToUse = null; |                     methodToUse = null; | ||||||
|                 } catch (Exception ex) { |                 } catch (Exception ex) { | ||||||
|                     ex.printStackTrace(); |                     ex.printStackTrace(System.out); | ||||||
|                     methodToUse = null; |                     methodToUse = null; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -64,7 +64,7 @@ public class ClassGetter { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -113,7 +113,7 @@ public class DisguiseUtilities { | |||||||
|             zChunk = bedChunk.getClass().getField("locZ"); |             zChunk = bedChunk.getClass().getField("locZ"); | ||||||
|             zChunk.setAccessible(true); |             zChunk.setAccessible(true); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -266,7 +266,7 @@ public class DisguiseUtilities { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -317,7 +317,7 @@ public class DisguiseUtilities { | |||||||
|                 xChunk.set(bedChunk, chunkX); |                 xChunk.set(bedChunk, chunkX); | ||||||
|                 zChunk.set(bedChunk, chunkZ); |                 zChunk.set(bedChunk, chunkZ); | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             // Make unload packets |             // Make unload packets | ||||||
|             try { |             try { | ||||||
| @@ -448,7 +448,7 @@ public class DisguiseUtilities { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return players; |         return players; | ||||||
|     } |     } | ||||||
| @@ -628,7 +628,7 @@ public class DisguiseUtilities { | |||||||
|                             try { |                             try { | ||||||
|                                 DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise); |                                 DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise); | ||||||
|                             } catch (Exception ex) { |                             } catch (Exception ex) { | ||||||
|                                 ex.printStackTrace(); |                                 ex.printStackTrace(System.out); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     }, 2); |                     }, 2); | ||||||
| @@ -652,7 +652,7 @@ public class DisguiseUtilities { | |||||||
|                                         try { |                                         try { | ||||||
|                                             updatePlayer.invoke(entityTrackerEntry, p); |                                             updatePlayer.invoke(entityTrackerEntry, p); | ||||||
|                                         } catch (Exception ex) { |                                         } catch (Exception ex) { | ||||||
|                                             ex.printStackTrace(); |                                             ex.printStackTrace(System.out); | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
|                                 }, 2); |                                 }, 2); | ||||||
| @@ -662,7 +662,7 @@ public class DisguiseUtilities { | |||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -693,7 +693,7 @@ public class DisguiseUtilities { | |||||||
|                                     try { |                                     try { | ||||||
|                                         updatePlayer.invoke(entityTrackerEntry, p); |                                         updatePlayer.invoke(entityTrackerEntry, p); | ||||||
|                                     } catch (Exception ex) { |                                     } catch (Exception ex) { | ||||||
|                                         ex.printStackTrace(); |                                         ex.printStackTrace(System.out); | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             }, 2); |                             }, 2); | ||||||
| @@ -701,7 +701,7 @@ public class DisguiseUtilities { | |||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -722,7 +722,7 @@ public class DisguiseUtilities { | |||||||
|                             try { |                             try { | ||||||
|                                 DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise); |                                 DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise); | ||||||
|                             } catch (Exception ex) { |                             } catch (Exception ex) { | ||||||
|                                 ex.printStackTrace(); |                                 ex.printStackTrace(System.out); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     }, 2); |                     }, 2); | ||||||
| @@ -746,7 +746,7 @@ public class DisguiseUtilities { | |||||||
|                                     try { |                                     try { | ||||||
|                                         updatePlayer.invoke(entityTrackerEntry, p); |                                         updatePlayer.invoke(entityTrackerEntry, p); | ||||||
|                                     } catch (Exception ex) { |                                     } catch (Exception ex) { | ||||||
|                                         ex.printStackTrace(); |                                         ex.printStackTrace(System.out); | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             }, 2); |                             }, 2); | ||||||
| @@ -754,7 +754,7 @@ public class DisguiseUtilities { | |||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -789,7 +789,7 @@ public class DisguiseUtilities { | |||||||
|             try { |             try { | ||||||
|                 ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); |                 ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             // Remove the fake entity ID from the disguise bin |             // Remove the fake entity ID from the disguise bin | ||||||
|             selfDisguised.remove(player.getUniqueId()); |             selfDisguised.remove(player.getUniqueId()); | ||||||
| @@ -803,7 +803,7 @@ public class DisguiseUtilities { | |||||||
|                     trackedPlayers.remove(ReflectionManager.getNmsEntity(player)); |                     trackedPlayers.remove(ReflectionManager.getNmsEntity(player)); | ||||||
|                 } |                 } | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             // Resend entity metadata else he will be invisible to himself until its resent |             // Resend entity metadata else he will be invisible to himself until its resent | ||||||
|             try { |             try { | ||||||
| @@ -815,7 +815,7 @@ public class DisguiseUtilities { | |||||||
|                                         WrappedDataWatcher.getEntityWatcher(player), true) |                                         WrappedDataWatcher.getEntityWatcher(player), true) | ||||||
|                                 .createPacket(player.getEntityId(), WrappedDataWatcher.getEntityWatcher(player), true)); |                                 .createPacket(player.getEntityId(), WrappedDataWatcher.getEntityWatcher(player), true)); | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             player.updateInventory(); |             player.updateInventory(); | ||||||
|         } |         } | ||||||
| @@ -864,7 +864,7 @@ public class DisguiseUtilities { | |||||||
|                 field.setAccessible(true); |                 field.setAccessible(true); | ||||||
|                 isMoving = field.getBoolean(entityTrackerEntry); |                 isMoving = field.getBoolean(entityTrackerEntry); | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|             // Send the velocity packets |             // Send the velocity packets | ||||||
|             if (isMoving) { |             if (isMoving) { | ||||||
| @@ -920,7 +920,7 @@ public class DisguiseUtilities { | |||||||
|                                 .createPacket(player.getEntityId(), mobEffect)); |                                 .createPacket(player.getEntityId(), mobEffect)); | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -948,13 +948,13 @@ public class DisguiseUtilities { | |||||||
|                                 ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false); |                                 ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false); | ||||||
|                             } |                             } | ||||||
|                         } catch (InvocationTargetException e) { |                         } catch (InvocationTargetException e) { | ||||||
|                             e.printStackTrace(); |                             e.printStackTrace(System.out); | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
|         } catch (InvocationTargetException e) { |         } catch (InvocationTargetException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -106,7 +106,7 @@ public class PacketsManager { | |||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } catch (Exception e) { |                 } catch (Exception e) { | ||||||
|                     e.printStackTrace(); |                     e.printStackTrace(System.out); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }; |         }; | ||||||
| @@ -372,7 +372,7 @@ public class PacketsManager { | |||||||
|                 newWatcher.setObject(watchableObject.getIndex(), watchableObject.getValue()); |                 newWatcher.setObject(watchableObject.getIndex(), watchableObject.getValue()); | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return newWatcher; |         return newWatcher; | ||||||
|     } |     } | ||||||
| @@ -571,7 +571,7 @@ public class PacketsManager { | |||||||
|                                                 obj = null; |                                                 obj = null; | ||||||
|                                             } |                                             } | ||||||
|                                         } catch (Exception e) { |                                         } catch (Exception e) { | ||||||
|                                             e.printStackTrace(); |                                             e.printStackTrace(System.out); | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
|                                     if (obj == null) { |                                     if (obj == null) { | ||||||
| @@ -587,7 +587,7 @@ public class PacketsManager { | |||||||
|                                                         .invoke(nmsEntity, DamageSource.GENERIC); |                                                         .invoke(nmsEntity, DamageSource.GENERIC); | ||||||
|                                             } |                                             } | ||||||
|                                         } catch (Exception ex) { |                                         } catch (Exception ex) { | ||||||
|                                             ex.printStackTrace(); |                                             ex.printStackTrace(System.out); | ||||||
|                                         } |                                         } | ||||||
|                                         soundType = entitySound.getType(soundName, !hasInvun); |                                         soundType = entitySound.getType(soundName, !hasInvun); | ||||||
|                                     } |                                     } | ||||||
| @@ -624,7 +624,7 @@ public class PacketsManager { | |||||||
|                                                         .invoke(step)); |                                                         .invoke(step)); | ||||||
|                                             } |                                             } | ||||||
|                                         } catch (Exception ex) { |                                         } catch (Exception ex) { | ||||||
|                                             ex.printStackTrace(); |                                             ex.printStackTrace(System.out); | ||||||
|                                         } |                                         } | ||||||
|                                         // There is no else statement. Because seriously. This should never be null. Unless |                                         // There is no else statement. Because seriously. This should never be null. Unless | ||||||
|                                         // someone is |                                         // someone is | ||||||
| @@ -704,7 +704,7 @@ public class PacketsManager { | |||||||
|                                         obj = null; |                                         obj = null; | ||||||
|                                     } |                                     } | ||||||
|                                 } catch (Exception e) { |                                 } catch (Exception e) { | ||||||
|                                     e.printStackTrace(); |                                     e.printStackTrace(System.out); | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                             if (obj == null) { |                             if (obj == null) { | ||||||
| @@ -745,7 +745,7 @@ public class PacketsManager { | |||||||
|                                         try { |                                         try { | ||||||
|                                             ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet); |                                             ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet); | ||||||
|                                         } catch (InvocationTargetException e) { |                                         } catch (InvocationTargetException e) { | ||||||
|                                             e.printStackTrace(); |                                             e.printStackTrace(System.out); | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
| @@ -787,7 +787,7 @@ public class PacketsManager { | |||||||
|                             try { |                             try { | ||||||
|                                 ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); |                                 ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); | ||||||
|                             } catch (InvocationTargetException e) { |                             } catch (InvocationTargetException e) { | ||||||
|                                 e.printStackTrace(); |                                 e.printStackTrace(System.out); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                         if (delayedPackets != null && delayedPackets.length > 0) { |                         if (delayedPackets != null && delayedPackets.length > 0) { | ||||||
| @@ -798,7 +798,7 @@ public class PacketsManager { | |||||||
|                                             ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); |                                             ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); | ||||||
|                                         } |                                         } | ||||||
|                                     } catch (InvocationTargetException e) { |                                     } catch (InvocationTargetException e) { | ||||||
|                                         e.printStackTrace(); |                                         e.printStackTrace(System.out); | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             }, 2); |                             }, 2); | ||||||
| @@ -828,7 +828,7 @@ public class PacketsManager { | |||||||
|                             try { |                             try { | ||||||
|                                 ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet); |                                 ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet); | ||||||
|                             } catch (InvocationTargetException e) { |                             } catch (InvocationTargetException e) { | ||||||
|                                 e.printStackTrace(); |                                 e.printStackTrace(System.out); | ||||||
|                             } |                             } | ||||||
|                         } else if (event.getPacketType() == PacketType.Play.Server.ANIMATION) { |                         } else if (event.getPacketType() == PacketType.Play.Server.ANIMATION) { | ||||||
|                             if (event.getPacket().getIntegers().read(1) != 2) { |                             if (event.getPacket().getIntegers().read(1) != 2) { | ||||||
| @@ -886,7 +886,7 @@ public class PacketsManager { | |||||||
|                                             ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, |                                             ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, | ||||||
|                                                     false); |                                                     false); | ||||||
|                                         } catch (InvocationTargetException e) { |                                         } catch (InvocationTargetException e) { | ||||||
|                                             e.printStackTrace(); |                                             e.printStackTrace(System.out); | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
| @@ -905,7 +905,7 @@ public class PacketsManager { | |||||||
|                                                 ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, |                                                 ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, | ||||||
|                                                         false); |                                                         false); | ||||||
|                                             } catch (InvocationTargetException e) { |                                             } catch (InvocationTargetException e) { | ||||||
|                                                 e.printStackTrace(); |                                                 e.printStackTrace(System.out); | ||||||
|                                             } |                                             } | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
| @@ -930,7 +930,7 @@ public class PacketsManager { | |||||||
|                                     try { |                                     try { | ||||||
|                                         ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); |                                         ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); | ||||||
|                                     } catch (InvocationTargetException e) { |                                     } catch (InvocationTargetException e) { | ||||||
|                                         e.printStackTrace(); |                                         e.printStackTrace(System.out); | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                                 org.bukkit.inventory.ItemStack newHeld = event.getPlayer().getInventory() |                                 org.bukkit.inventory.ItemStack newHeld = event.getPlayer().getInventory() | ||||||
| @@ -945,7 +945,7 @@ public class PacketsManager { | |||||||
|                                     try { |                                     try { | ||||||
|                                         ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); |                                         ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); | ||||||
|                                     } catch (InvocationTargetException e) { |                                     } catch (InvocationTargetException e) { | ||||||
|                                         e.printStackTrace(); |                                         e.printStackTrace(System.out); | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
| @@ -986,7 +986,7 @@ public class PacketsManager { | |||||||
|                                             ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, |                                             ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, | ||||||
|                                                     false); |                                                     false); | ||||||
|                                         } catch (InvocationTargetException e) { |                                         } catch (InvocationTargetException e) { | ||||||
|                                             e.printStackTrace(); |                                             e.printStackTrace(System.out); | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
|                                     // Else if its a hotbar slot |                                     // Else if its a hotbar slot | ||||||
| @@ -1004,7 +1004,7 @@ public class PacketsManager { | |||||||
|                                                 ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, |                                                 ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, | ||||||
|                                                         false); |                                                         false); | ||||||
|                                             } catch (InvocationTargetException e) { |                                             } catch (InvocationTargetException e) { | ||||||
|                                                 e.printStackTrace(); |                                                 e.printStackTrace(System.out); | ||||||
|                                             } |                                             } | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
| @@ -1219,13 +1219,13 @@ public class PacketsManager { | |||||||
|                                                 ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); |                                                 ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); | ||||||
|                                             } |                                             } | ||||||
|                                         } catch (InvocationTargetException e) { |                                         } catch (InvocationTargetException e) { | ||||||
|                                             e.printStackTrace(); |                                             e.printStackTrace(System.out); | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
|                                 }, 2); |                                 }, 2); | ||||||
|                             } |                             } | ||||||
|                         } catch (InvocationTargetException ex) { |                         } catch (InvocationTargetException ex) { | ||||||
|                             ex.printStackTrace(); |                             ex.printStackTrace(System.out); | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| @@ -1493,7 +1493,7 @@ public class PacketsManager { | |||||||
|  |  | ||||||
|             } |             } | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return packets == null ? null : new PacketContainer[][] { packets, delayedPackets }; |         return packets == null ? null : new PacketContainer[][] { packets, delayedPackets }; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -162,11 +162,11 @@ public class ReflectionManager { | |||||||
|                 System.out.println("[LibsDisguises] Loaded " + ForgeFieldMappings.size() + " Cauldron field mappings"); |                 System.out.println("[LibsDisguises] Loaded " + ForgeFieldMappings.size() + " Cauldron field mappings"); | ||||||
|                 System.out.println("[LibsDisguises] Loaded " + ForgeMethodMappings.size() + " Cauldron method mappings"); |                 System.out.println("[LibsDisguises] Loaded " + ForgeMethodMappings.size() + " Cauldron method mappings"); | ||||||
|             } catch (ClassNotFoundException e) { |             } catch (ClassNotFoundException e) { | ||||||
|                 e.printStackTrace(); |                 e.printStackTrace(System.out); | ||||||
|                 System.err |                 System.err | ||||||
|                         .println("Warning: Running on Cauldron server, but couldn't load mappings file. LibsDisguises will likely crash!"); |                         .println("Warning: Running on Cauldron server, but couldn't load mappings file. LibsDisguises will likely crash!"); | ||||||
|             } catch (IOException e) { |             } catch (IOException e) { | ||||||
|                 e.printStackTrace(); |                 e.printStackTrace(System.out); | ||||||
|                 System.err |                 System.err | ||||||
|                         .println("Warning: Running on Cauldron server, but couldn't load mappings file. LibsDisguises will likely crash!"); |                         .println("Warning: Running on Cauldron server, but couldn't load mappings file. LibsDisguises will likely crash!"); | ||||||
|             } |             } | ||||||
| @@ -187,7 +187,7 @@ public class ReflectionManager { | |||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } catch (Exception ex) { |             } catch (Exception ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         craftItemClass = getCraftClass("inventory.CraftItemStack"); |         craftItemClass = getCraftClass("inventory.CraftItemStack"); | ||||||
| @@ -221,7 +221,7 @@ public class ReflectionManager { | |||||||
|             } |             } | ||||||
|             return entityObject; |             return entityObject; | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -231,7 +231,7 @@ public class ReflectionManager { | |||||||
|             return getNmsClass("MobEffect").getConstructor(int.class, int.class, int.class, boolean.class, boolean.class) |             return getNmsClass("MobEffect").getConstructor(int.class, int.class, int.class, boolean.class, boolean.class) | ||||||
|                     .newInstance(id, duration, amplification, ambient, particles); |                     .newInstance(id, duration, amplification, ambient, particles); | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -279,7 +279,7 @@ public class ReflectionManager { | |||||||
|             return new FakeBoundingBox(x, y, z); |             return new FakeBoundingBox(x, y, z); | ||||||
|  |  | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -288,7 +288,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return (Entity) getNmsMethod("Entity", "getBukkitEntity").invoke(nmsEntity); |             return (Entity) getNmsMethod("Entity", "getBukkitEntity").invoke(nmsEntity); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -297,7 +297,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return (ItemStack) craftItemClass.getMethod("asBukkitCopy", getNmsClass("ItemStack")).invoke(null, nmsItem); |             return (ItemStack) craftItemClass.getMethod("asBukkitCopy", getNmsClass("ItemStack")).invoke(null, nmsItem); | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -310,7 +310,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return Class.forName("org.bukkit.craftbukkit." + getBukkitVersion() + "." + className); |             return Class.forName("org.bukkit.craftbukkit." + getBukkitVersion() + "." + className); | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -319,7 +319,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return (String) getCraftClass("CraftSound").getMethod("getSound", Sound.class).invoke(null, sound); |             return (String) getCraftClass("CraftSound").getMethod("getSound", Sound.class).invoke(null, sound); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -340,7 +340,7 @@ public class ReflectionManager { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -349,7 +349,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return getNmsClass("BlockPosition").getConstructor(int.class, int.class, int.class).newInstance(x, y, z); |             return getNmsClass("BlockPosition").getConstructor(int.class, int.class, int.class).newInstance(x, y, z); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -358,7 +358,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return (Enum) getNmsMethod("EnumDirection", "fromType2", int.class).invoke(null, direction); |             return (Enum) getNmsMethod("EnumDirection", "fromType2", int.class).invoke(null, direction); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -367,7 +367,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return (Enum) getNmsClass("PacketPlayOutPlayerInfo$EnumPlayerInfoAction").getEnumConstants()[action]; |             return (Enum) getNmsClass("PacketPlayOutPlayerInfo$EnumPlayerInfoAction").getEnumConstants()[action]; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -381,7 +381,7 @@ public class ReflectionManager { | |||||||
|                     .newInstance(playerInfoPacket, gameProfile.getHandle(), 0, |                     .newInstance(playerInfoPacket, gameProfile.getHandle(), 0, | ||||||
|                             getNmsClass("WorldSettings$EnumGamemode").getEnumConstants()[1], playerListName); |                             getNmsClass("WorldSettings$EnumGamemode").getEnumConstants()[1], playerListName); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -394,7 +394,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return new WrappedGameProfile(uuid != null ? uuid : UUID.randomUUID(), playerName); |             return new WrappedGameProfile(uuid != null ? uuid : UUID.randomUUID(), playerName); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -405,7 +405,7 @@ public class ReflectionManager { | |||||||
|             gameProfile.getProperties().putAll(profileWithSkin.getProperties()); |             gameProfile.getProperties().putAll(profileWithSkin.getProperties()); | ||||||
|             return gameProfile; |             return gameProfile; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -426,7 +426,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return Class.forName("net.minecraft.server." + getBukkitVersion() + "." + className); |             return Class.forName("net.minecraft.server." + getBukkitVersion() + "." + className); | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -435,7 +435,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return clazz.getConstructor(parameters); |             return clazz.getConstructor(parameters); | ||||||
|         } catch (NoSuchMethodException e) { |         } catch (NoSuchMethodException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -448,7 +448,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return getCraftClass("entity.CraftEntity").getMethod("getHandle").invoke(entity); |             return getCraftClass("entity.CraftEntity").getMethod("getHandle").invoke(entity); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -458,14 +458,14 @@ public class ReflectionManager { | |||||||
|             try { |             try { | ||||||
|                 return clazz.getField(ForgeFieldMappings.get(clazz.getName()).get(fieldName)); |                 return clazz.getField(ForgeFieldMappings.get(clazz.getName()).get(fieldName)); | ||||||
|             } catch (NoSuchFieldException ex) { |             } catch (NoSuchFieldException ex) { | ||||||
|                 ex.printStackTrace(); |                 ex.printStackTrace(System.out); | ||||||
|             } catch (NullPointerException ignored) { |             } catch (NullPointerException ignored) { | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         try { |         try { | ||||||
|             return clazz.getField(fieldName); |             return clazz.getField(fieldName); | ||||||
|         } catch (NoSuchFieldException e) { |         } catch (NoSuchFieldException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -478,7 +478,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return craftItemClass.getMethod("asNMSCopy", ItemStack.class).invoke(null, itemstack); |             return craftItemClass.getMethod("asNMSCopy", ItemStack.class).invoke(null, itemstack); | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -493,14 +493,14 @@ public class ReflectionManager { | |||||||
|                 } |                 } | ||||||
|                 return clazz.getMethod(innerMap.get(sb.toString()), parameters); |                 return clazz.getMethod(innerMap.get(sb.toString()), parameters); | ||||||
|             } catch (NoSuchMethodException e) { |             } catch (NoSuchMethodException e) { | ||||||
|                 e.printStackTrace(); |                 e.printStackTrace(System.out); | ||||||
|             } catch (NullPointerException ignored) { |             } catch (NullPointerException ignored) { | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         try { |         try { | ||||||
|             return clazz.getMethod(methodName, parameters); |             return clazz.getMethod(methodName, parameters); | ||||||
|         } catch (NoSuchMethodException e) { |         } catch (NoSuchMethodException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -513,7 +513,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return (double) pingField.getInt(ReflectionManager.getNmsEntity(player)); |             return (double) pingField.getInt(ReflectionManager.getNmsEntity(player)); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return 0D; |         return 0D; | ||||||
|     } |     } | ||||||
| @@ -525,7 +525,7 @@ public class ReflectionManager { | |||||||
|             float height = (Float) getNmsMethod("Entity", "getHeadHeight").invoke(getNmsEntity(entity)); |             float height = (Float) getNmsMethod("Entity", "getHeadHeight").invoke(getNmsEntity(entity)); | ||||||
|             return new float[] { length, width, height }; |             return new float[] { length, width, height }; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -542,7 +542,7 @@ public class ReflectionManager { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -560,7 +560,7 @@ public class ReflectionManager { | |||||||
|         try { |         try { | ||||||
|             return getCraftClass("CraftWorld").getMethod("getHandle").invoke(world); |             return getCraftClass("CraftWorld").getMethod("getHandle").invoke(world); | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -585,7 +585,7 @@ public class ReflectionManager { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| @@ -615,7 +615,7 @@ public class ReflectionManager { | |||||||
|             Field check = getNmsField(connection.getClass(), "checkMovement"); |             Field check = getNmsField(connection.getClass(), "checkMovement"); | ||||||
|             check.setBoolean(connection, true); |             check.setBoolean(connection, true); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -626,7 +626,7 @@ public class ReflectionManager { | |||||||
|                     loc.getZ() - newBox.getZ(), loc.getX() + newBox.getX(), loc.getY() + newBox.getY(), loc.getZ() + newBox.getZ()); |                     loc.getZ() - newBox.getZ(), loc.getX() + newBox.getX(), loc.getY() + newBox.getY(), loc.getZ() + newBox.getZ()); | ||||||
|             setBoundingBoxMethod.invoke(getNmsEntity(entity), boundingBox); |             setBoundingBoxMethod.invoke(getNmsEntity(entity), boundingBox); | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             ex.printStackTrace(); |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user