diff --git a/.gradle/2.2.1/taskArtifacts/cache.properties.lock b/.gradle/2.2.1/taskArtifacts/cache.properties.lock index a699e1f0..d213237a 100644 Binary files a/.gradle/2.2.1/taskArtifacts/cache.properties.lock and b/.gradle/2.2.1/taskArtifacts/cache.properties.lock differ diff --git a/.gradle/2.2.1/taskArtifacts/fileHashes.bin b/.gradle/2.2.1/taskArtifacts/fileHashes.bin index 6e6c5bff..b91ba843 100644 Binary files a/.gradle/2.2.1/taskArtifacts/fileHashes.bin and b/.gradle/2.2.1/taskArtifacts/fileHashes.bin differ diff --git a/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin b/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin index 58fa38cd..39d90df4 100644 Binary files a/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin and b/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin differ diff --git a/.gradle/2.2.1/taskArtifacts/outputFileStates.bin b/.gradle/2.2.1/taskArtifacts/outputFileStates.bin index d494556d..495bf379 100644 Binary files a/.gradle/2.2.1/taskArtifacts/outputFileStates.bin and b/.gradle/2.2.1/taskArtifacts/outputFileStates.bin differ diff --git a/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin b/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin index ff8c24e1..c0243cac 100644 Binary files a/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin and b/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin differ diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java b/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java index c31fd821..d522c411 100644 --- a/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java +++ b/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java @@ -128,7 +128,7 @@ public class DisguiseAPI { } watcherMethod.invoke(watcher, value); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } } @@ -203,7 +203,7 @@ public class DisguiseAPI { DisguiseUtilities.addFutureDisguise(id, (TargetedDisguise) disguise); return id; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return -1; } diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseListener.java b/src/main/java/me/libraryaddict/disguise/DisguiseListener.java index 7828f2d2..309bc647 100644 --- a/src/main/java/me/libraryaddict/disguise/DisguiseListener.java +++ b/src/main/java/me/libraryaddict/disguise/DisguiseListener.java @@ -38,6 +38,7 @@ import org.bukkit.scheduler.BukkitRunnable; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; +import org.bukkit.scheduler.BukkitTask; public class DisguiseListener implements Listener { @@ -47,12 +48,13 @@ public class DisguiseListener implements Listener { private HashMap disguiseRunnable = new HashMap<>(); private String latestVersion; private LibsDisguises plugin; + private BukkitTask updaterTask; public DisguiseListener(LibsDisguises libsDisguises) { plugin = libsDisguises; if (plugin.getConfig().getBoolean("NotifyUpdate")) { currentVersion = plugin.getDescription().getVersion(); - Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() { + updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() { public void run() { try { UpdateChecker updateChecker = new UpdateChecker(); @@ -77,6 +79,17 @@ public class DisguiseListener implements Listener { // 20 ticks * 60 seconds * 60 minutes * 6 hours } } + + 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) { Disguise[] disguises = DisguiseAPI.getDisguises(entity); @@ -115,7 +128,7 @@ public class DisguiseListener implements Listener { } } } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } diff --git a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java index 9a18a838..21695a03 100644 --- a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java +++ b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java @@ -41,68 +41,34 @@ import org.bukkit.plugin.java.JavaPlugin; import com.comphenix.protocol.wrappers.WrappedDataWatcher; import com.comphenix.protocol.wrappers.WrappedWatchableObject; import me.libraryaddict.disguise.utilities.Metrics; +import org.bukkit.event.HandlerList; public class LibsDisguises extends JavaPlugin { public static LibsDisguises instance; //I'm sorry Sun MicroSystems and all mighty Java God + private DisguiseListener listener; @Override public void onEnable() { 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); DisguiseUtilities.init(this); 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(); - DisguiseListener listener = new DisguiseListener(this); + listener = new DisguiseListener(this); Bukkit.getPluginManager().registerEvents(listener, this); getCommand("disguise").setExecutor(new DisguiseCommand()); getCommand("undisguise").setExecutor(new UndisguiseCommand()); getCommand("disguiseplayer").setExecutor(new DisguisePlayerCommand()); getCommand("undisguiseplayer").setExecutor(new UndisguisePlayerCommand()); - getCommand("undisguiseentity").setExecutor(new UndisguiseEntityCommand(listener)); - getCommand("disguiseentity").setExecutor(new DisguiseEntityCommand(listener)); + getCommand("undisguiseentity").setExecutor(new UndisguiseEntityCommand()); + getCommand("disguiseentity").setExecutor(new DisguiseEntityCommand()); getCommand("disguiseradius").setExecutor(new DisguiseRadiusCommand(getConfig().getInt("DisguiseRadiusMax"))); getCommand("undisguiseradius").setExecutor(new UndisguiseRadiusCommand(getConfig().getInt("UndisguiseRadiusMax"))); getCommand("disguisehelp").setExecutor(new DisguiseHelpCommand()); - getCommand("disguiseclone").setExecutor(new DisguiseCloneCommand(listener)); + getCommand("disguiseclone").setExecutor(new DisguiseCloneCommand()); getCommand("libsdisguises").setExecutor(new LibsDisguisesCommand()); registerValues(); instance = this; @@ -111,46 +77,14 @@ public class LibsDisguises extends JavaPlugin { metrics.start(); } catch (IOException e) {} } - - private String read(Reader reader) { - String toWrite = ""; - BufferedReader input = null; - - try { - input = new BufferedReader(reader); - String currentPath = ""; - 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; + + /** + * Reloads the config with new config options. + */ + public void reload() { + HandlerList.unregisterAll(listener); + reloadConfig(); + DisguiseConfig.initConfig(getConfig()); } /** @@ -312,7 +246,7 @@ public class LibsDisguises extends JavaPlugin { + "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(); } - private void tryClose(Closeable input) { - if (input != null) { - try { - input.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } + public DisguiseListener getListener() { + return listener; } - } diff --git a/src/main/java/me/libraryaddict/disguise/commands/DisguiseCloneCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseCloneCommand.java index 54124509..ae4cfe63 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/DisguiseCloneCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/DisguiseCloneCommand.java @@ -5,6 +5,7 @@ import java.util.HashMap; import me.libraryaddict.disguise.DisguiseConfig; import me.libraryaddict.disguise.DisguiseListener; +import me.libraryaddict.disguise.LibsDisguises; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import me.libraryaddict.disguise.utilities.BaseDisguiseCommand; @@ -15,12 +16,6 @@ import org.bukkit.command.CommandSender; public class DisguiseCloneCommand extends BaseDisguiseCommand { - private DisguiseListener listener; - - public DisguiseCloneCommand(DisguiseListener listener) { - this.listener = listener; - } - @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender.getName().equals("CONSOLE")) { @@ -48,7 +43,7 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand { 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() + " seconds to grab the disguise reference!"); } else { diff --git a/src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java index 6c647006..4604c214 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java @@ -33,7 +33,7 @@ public class DisguiseCommand extends BaseDisguiseCommand { } return true; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); return true; } if (DisguiseConfig.isNameOfPlayerShownAboveDisguise()) { diff --git a/src/main/java/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java index 7e01edc5..8c1d250b 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java @@ -5,6 +5,7 @@ import java.util.HashMap; import me.libraryaddict.disguise.DisguiseConfig; import me.libraryaddict.disguise.DisguiseListener; +import me.libraryaddict.disguise.LibsDisguises; import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import me.libraryaddict.disguise.utilities.BaseDisguiseCommand; @@ -15,12 +16,6 @@ import org.bukkit.command.CommandSender; public class DisguiseEntityCommand extends BaseDisguiseCommand { - private DisguiseListener listener; - - public DisguiseEntityCommand(DisguiseListener listener) { - this.listener = listener; - } - @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender.getName().equals("CONSOLE")) { @@ -36,10 +31,10 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand { } return true; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); 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() + " seconds to disguise it as a " + disguise.getType().toReadable() + "!"); return true; diff --git a/src/main/java/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java index 4602ba77..01f0a270 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java @@ -70,7 +70,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand { 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())); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } try { 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 .size()]))); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } try { enumHelp.add(new EnumHelp("Profession", "Villager professions", ChatColor.RED + "/disguisehelp Professions " @@ -234,7 +234,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } Collections.sort(methods, String.CASE_INSENSITIVE_ORDER); for (int i = 0; i < methods.size(); i++) { diff --git a/src/main/java/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java index 33d7486b..342d8006 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java @@ -49,7 +49,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand { } return true; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); return true; } if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) { diff --git a/src/main/java/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java index 32b33b05..d7941e83 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java @@ -105,7 +105,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand { } return true; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); return true; } // Time to use it! int disguisedEntitys = 0; diff --git a/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java b/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java index 25da418e..b052433c 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java @@ -1,5 +1,6 @@ package me.libraryaddict.disguise.commands; +import me.libraryaddict.disguise.LibsDisguises; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -10,11 +11,22 @@ public class LibsDisguisesCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + if (args.length == 0) { sender.sendMessage(ChatColor.DARK_GREEN + "This server is running " + "Lib's Disguises v." + 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; } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java b/src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java index 9807b7c7..8bc52e65 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java @@ -1,6 +1,7 @@ package me.libraryaddict.disguise.commands; import me.libraryaddict.disguise.DisguiseListener; +import me.libraryaddict.disguise.LibsDisguises; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -8,11 +9,6 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; public class UndisguiseEntityCommand implements CommandExecutor { - private DisguiseListener listener; - - public UndisguiseEntityCommand(DisguiseListener listener) { - this.listener = listener; - } @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { @@ -21,7 +17,7 @@ public class UndisguiseEntityCommand implements CommandExecutor { return true; } 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!"); } else sender.sendMessage(ChatColor.RED + "You are forbidden to use this command."); diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index 6a492c6e..376d25c3 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -35,9 +35,9 @@ import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.reflect.StructureModifier; +import me.libraryaddict.disguise.LibsDisguises; public abstract class Disguise { - private static JavaPlugin plugin; private boolean disguiseInUse; private DisguiseType disguiseType; private Entity entity; @@ -54,7 +54,7 @@ public abstract class Disguise { private boolean velocitySent = DisguiseConfig.isVelocitySent(); private boolean viewSelfDisguise = DisguiseConfig.isViewDisguises(); private FlagWatcher watcher; - + @Override public abstract Disguise clone(); @@ -81,7 +81,7 @@ public abstract class Disguise { // Construct the FlagWatcher from the stored class setWatcher((FlagWatcher) getType().getWatcherClass().getConstructor(Disguise.class).newInstance(this)); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } // Set the disguise if its a baby or not if (!isAdult) { @@ -261,7 +261,7 @@ public abstract class Disguise { ProtocolLibrary.getProtocolManager().sendServerPacket((Player) getEntity(), selfLookPacket, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } @@ -287,7 +287,7 @@ public abstract class Disguise { false); } } 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 @@ -307,12 +307,12 @@ public abstract class Disguise { ProtocolLibrary.getProtocolManager().sendServerPacket((Player) getEntity(), selfPacket, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } @@ -707,7 +707,7 @@ public abstract class Disguise { // Just return. if (!event.isCancelled()) { 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 DisguiseUtilities.addDisguise(entity.getUniqueId(), (TargetedDisguise) this); if (isSelfDisguiseVisible() && getEntity() instanceof Player) { @@ -716,7 +716,7 @@ public abstract class Disguise { // Resend the disguised entity's packet DisguiseUtilities.refreshTrackers((TargetedDisguise) this); // 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() { DisguiseUtilities.setupFakeDisguise(Disguise.this); } @@ -730,4 +730,4 @@ public abstract class Disguise { public boolean stopDisguise() { return removeDisguise(); } -} \ No newline at end of file +} diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java index b811f723..43407153 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java @@ -213,7 +213,7 @@ public enum DisguiseType { disguiseType = DisguiseType.ZOMBIE_VILLAGER; } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } break; case HORSE: @@ -221,7 +221,7 @@ public enum DisguiseType { Object variant = getVariant.invoke(entity); disguiseType = DisguiseType.valueOf(((Enum) variant).name()); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } break; case SKELETON: @@ -231,7 +231,7 @@ public enum DisguiseType { disguiseType = DisguiseType.WITHER_SKELETON; } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } break; case GUARDIAN: @@ -240,7 +240,7 @@ public enum DisguiseType { disguiseType = DisguiseType.ELDER_GUARDIAN; } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } break; default: diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index a16a4348..70d3391b 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -70,7 +70,7 @@ public class FlagWatcher { try { cloned = getClass().getConstructor(Disguise.class).newInstance(getDisguise()); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); cloned = new FlagWatcher(getDisguise()); } cloned.entityValues = (HashMap) entityValues.clone(); @@ -267,7 +267,7 @@ public class FlagWatcher { try { ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } @@ -359,7 +359,7 @@ public class FlagWatcher { try { ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 20453cba..f776555c 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -154,9 +154,6 @@ public class PlayerDisguise extends TargetedDisguise { public PlayerDisguise setSkin(String skinToUse) { this.skinToUse = skinToUse; - if (!LibsDisguises.instance.getConfig().getBoolean("ContactMojangServers")) { - return this; - } if (skinToUse == null) { this.currentLookup = null; this.gameProfile = null; @@ -164,21 +161,23 @@ public class PlayerDisguise extends TargetedDisguise { if (skinToUse.length() > 16) { this.skinToUse = skinToUse.substring(0, 16); } - currentLookup = new LibsProfileLookup() { - @Override - public void onLookup(WrappedGameProfile gameProfile) { - if (currentLookup == this && gameProfile != null) { - setSkin(gameProfile); - if (!gameProfile.getProperties().isEmpty() && DisguiseUtilities.isDisguiseInUse(PlayerDisguise.this)) { - DisguiseUtilities.refreshTrackers(PlayerDisguise.this); + if (LibsDisguises.instance.getConfig().getBoolean("ContactMojangServers", true)) { + currentLookup = new LibsProfileLookup() { + @Override + public void onLookup(WrappedGameProfile gameProfile) { + if (currentLookup == this && gameProfile != null) { + setSkin(gameProfile); + if (!gameProfile.getProperties().isEmpty() && DisguiseUtilities.isDisguiseInUse(PlayerDisguise.this)) { + DisguiseUtilities.refreshTrackers(PlayerDisguise.this); + } + currentLookup = null; } - currentLookup = null; } + }; + WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup); + if (gameProfile != null) { + setSkin(gameProfile); } - }; - WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup); - if (gameProfile != null) { - setSkin(gameProfile); } } return this; @@ -197,10 +196,11 @@ public class PlayerDisguise extends TargetedDisguise { this.skinToUse = null; return this; } - - Validate.notEmpty(gameProfile.getName(), "Name must be set"); - this.skinToUse = gameProfile.getName(); - this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(null, getName(), gameProfile); + if (LibsDisguises.instance.getConfig().getBoolean("ContactMojangServers", true)) { + Validate.notEmpty(gameProfile.getName(), "Name must be set"); + this.skinToUse = gameProfile.getName(); + this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(null, getName(), gameProfile); + } return this; } diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java index d15c6395..36288cc9 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java @@ -41,7 +41,7 @@ public class LivingWatcher extends FlagWatcher { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } private double maxHealth; @@ -101,7 +101,7 @@ public class LivingWatcher extends FlagWatcher { f4 += 1.0F; } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } f1 = f1 / f4 * 255.0F; @@ -160,7 +160,7 @@ public class LivingWatcher extends FlagWatcher { try { ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java index 6cd3206e..8fe68611 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java @@ -117,7 +117,7 @@ public class PlayerWatcher extends LivingWatcher { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java index bc20d45e..d54cb250 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java @@ -95,7 +95,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor { try { methods[methods.length - i--] = Disguise.class.getMethod(methodName, boolean.class); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } return methods; @@ -630,7 +630,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor { storedEx = ex; methodToUse = null; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); methodToUse = null; } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/ClassGetter.java b/src/main/java/me/libraryaddict/disguise/utilities/ClassGetter.java index 3990089c..6e1f6aa5 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/ClassGetter.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/ClassGetter.java @@ -64,7 +64,7 @@ public class ClassGetter { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index e9982bc3..ee323cd7 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -113,7 +113,7 @@ public class DisguiseUtilities { zChunk = bedChunk.getClass().getField("locZ"); zChunk.setAccessible(true); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } @@ -266,7 +266,7 @@ public class DisguiseUtilities { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } @@ -317,7 +317,7 @@ public class DisguiseUtilities { xChunk.set(bedChunk, chunkX); zChunk.set(bedChunk, chunkZ); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } // Make unload packets try { @@ -448,7 +448,7 @@ public class DisguiseUtilities { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return players; } @@ -628,7 +628,7 @@ public class DisguiseUtilities { try { DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } }, 2); @@ -652,7 +652,7 @@ public class DisguiseUtilities { try { updatePlayer.invoke(entityTrackerEntry, p); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } }, 2); @@ -662,7 +662,7 @@ public class DisguiseUtilities { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } } @@ -693,7 +693,7 @@ public class DisguiseUtilities { try { updatePlayer.invoke(entityTrackerEntry, p); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } }, 2); @@ -701,7 +701,7 @@ public class DisguiseUtilities { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } } @@ -722,7 +722,7 @@ public class DisguiseUtilities { try { DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } }, 2); @@ -746,7 +746,7 @@ public class DisguiseUtilities { try { updatePlayer.invoke(entityTrackerEntry, p); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } }, 2); @@ -754,7 +754,7 @@ public class DisguiseUtilities { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } } @@ -789,7 +789,7 @@ public class DisguiseUtilities { try { ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } // Remove the fake entity ID from the disguise bin selfDisguised.remove(player.getUniqueId()); @@ -803,7 +803,7 @@ public class DisguiseUtilities { trackedPlayers.remove(ReflectionManager.getNmsEntity(player)); } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } // Resend entity metadata else he will be invisible to himself until its resent try { @@ -815,7 +815,7 @@ public class DisguiseUtilities { WrappedDataWatcher.getEntityWatcher(player), true) .createPacket(player.getEntityId(), WrappedDataWatcher.getEntityWatcher(player), true)); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } player.updateInventory(); } @@ -864,7 +864,7 @@ public class DisguiseUtilities { field.setAccessible(true); isMoving = field.getBoolean(entityTrackerEntry); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } // Send the velocity packets if (isMoving) { @@ -920,7 +920,7 @@ public class DisguiseUtilities { .createPacket(player.getEntityId(), mobEffect)); } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } @@ -948,13 +948,13 @@ public class DisguiseUtilities { ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false); } } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } }); } } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/main/java/me/libraryaddict/disguise/utilities/PacketsManager.java index 2fe8978b..e04cde40 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -106,7 +106,7 @@ public class PacketsManager { } } } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } }; @@ -114,7 +114,7 @@ public class PacketsManager { // Now I call this and the main listener is registered! setupMainPacketsListener(); } - + /** * Construct the packets I need to spawn in the disguise */ @@ -372,7 +372,7 @@ public class PacketsManager { newWatcher.setObject(watchableObject.getIndex(), watchableObject.getValue()); } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return newWatcher; } @@ -571,7 +571,7 @@ public class PacketsManager { obj = null; } } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } if (obj == null) { @@ -587,7 +587,7 @@ public class PacketsManager { .invoke(nmsEntity, DamageSource.GENERIC); } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } soundType = entitySound.getType(soundName, !hasInvun); } @@ -624,7 +624,7 @@ public class PacketsManager { .invoke(step)); } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } // There is no else statement. Because seriously. This should never be null. Unless // someone is @@ -704,7 +704,7 @@ public class PacketsManager { obj = null; } } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } if (obj == null) { @@ -745,7 +745,7 @@ public class PacketsManager { try { ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } @@ -787,7 +787,7 @@ public class PacketsManager { try { ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } if (delayedPackets != null && delayedPackets.length > 0) { @@ -798,7 +798,7 @@ public class PacketsManager { ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); } } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } }, 2); @@ -828,7 +828,7 @@ public class PacketsManager { try { ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } else if (event.getPacketType() == PacketType.Play.Server.ANIMATION) { if (event.getPacket().getIntegers().read(1) != 2) { @@ -886,7 +886,7 @@ public class PacketsManager { ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } @@ -905,7 +905,7 @@ public class PacketsManager { ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } @@ -930,7 +930,7 @@ public class PacketsManager { try { ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } org.bukkit.inventory.ItemStack newHeld = event.getPlayer().getInventory() @@ -945,7 +945,7 @@ public class PacketsManager { try { ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } @@ -986,7 +986,7 @@ public class PacketsManager { ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } // Else if its a hotbar slot @@ -1004,7 +1004,7 @@ public class PacketsManager { ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet, false); } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } } @@ -1219,13 +1219,13 @@ public class PacketsManager { ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); } } catch (InvocationTargetException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } } }, 2); } } catch (InvocationTargetException ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } } @@ -1493,7 +1493,7 @@ public class PacketsManager { } } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return packets == null ? null : new PacketContainer[][] { packets, delayedPackets }; } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/ReflectionManager.java b/src/main/java/me/libraryaddict/disguise/utilities/ReflectionManager.java index fb6b1897..9aaa871b 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/ReflectionManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/ReflectionManager.java @@ -162,11 +162,11 @@ public class ReflectionManager { System.out.println("[LibsDisguises] Loaded " + ForgeFieldMappings.size() + " Cauldron field mappings"); System.out.println("[LibsDisguises] Loaded " + ForgeMethodMappings.size() + " Cauldron method mappings"); } catch (ClassNotFoundException e) { - e.printStackTrace(); + e.printStackTrace(System.out); System.err .println("Warning: Running on Cauldron server, but couldn't load mappings file. LibsDisguises will likely crash!"); } catch (IOException e) { - e.printStackTrace(); + e.printStackTrace(System.out); System.err .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) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } } craftItemClass = getCraftClass("inventory.CraftItemStack"); @@ -221,7 +221,7 @@ public class ReflectionManager { } return entityObject; } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -231,7 +231,7 @@ public class ReflectionManager { return getNmsClass("MobEffect").getConstructor(int.class, int.class, int.class, boolean.class, boolean.class) .newInstance(id, duration, amplification, ambient, particles); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -279,7 +279,7 @@ public class ReflectionManager { return new FakeBoundingBox(x, y, z); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -288,7 +288,7 @@ public class ReflectionManager { try { return (Entity) getNmsMethod("Entity", "getBukkitEntity").invoke(nmsEntity); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -297,7 +297,7 @@ public class ReflectionManager { try { return (ItemStack) craftItemClass.getMethod("asBukkitCopy", getNmsClass("ItemStack")).invoke(null, nmsItem); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -310,7 +310,7 @@ public class ReflectionManager { try { return Class.forName("org.bukkit.craftbukkit." + getBukkitVersion() + "." + className); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -319,7 +319,7 @@ public class ReflectionManager { try { return (String) getCraftClass("CraftSound").getMethod("getSound", Sound.class).invoke(null, sound); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -340,7 +340,7 @@ public class ReflectionManager { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -349,7 +349,7 @@ public class ReflectionManager { try { return getNmsClass("BlockPosition").getConstructor(int.class, int.class, int.class).newInstance(x, y, z); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -358,7 +358,7 @@ public class ReflectionManager { try { return (Enum) getNmsMethod("EnumDirection", "fromType2", int.class).invoke(null, direction); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -367,7 +367,7 @@ public class ReflectionManager { try { return (Enum) getNmsClass("PacketPlayOutPlayerInfo$EnumPlayerInfoAction").getEnumConstants()[action]; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -381,7 +381,7 @@ public class ReflectionManager { .newInstance(playerInfoPacket, gameProfile.getHandle(), 0, getNmsClass("WorldSettings$EnumGamemode").getEnumConstants()[1], playerListName); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -394,7 +394,7 @@ public class ReflectionManager { try { return new WrappedGameProfile(uuid != null ? uuid : UUID.randomUUID(), playerName); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -405,7 +405,7 @@ public class ReflectionManager { gameProfile.getProperties().putAll(profileWithSkin.getProperties()); return gameProfile; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -426,7 +426,7 @@ public class ReflectionManager { try { return Class.forName("net.minecraft.server." + getBukkitVersion() + "." + className); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -435,7 +435,7 @@ public class ReflectionManager { try { return clazz.getConstructor(parameters); } catch (NoSuchMethodException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -448,7 +448,7 @@ public class ReflectionManager { try { return getCraftClass("entity.CraftEntity").getMethod("getHandle").invoke(entity); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -458,14 +458,14 @@ public class ReflectionManager { try { return clazz.getField(ForgeFieldMappings.get(clazz.getName()).get(fieldName)); } catch (NoSuchFieldException ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } catch (NullPointerException ignored) { } } try { return clazz.getField(fieldName); } catch (NoSuchFieldException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -478,7 +478,7 @@ public class ReflectionManager { try { return craftItemClass.getMethod("asNMSCopy", ItemStack.class).invoke(null, itemstack); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -493,14 +493,14 @@ public class ReflectionManager { } return clazz.getMethod(innerMap.get(sb.toString()), parameters); } catch (NoSuchMethodException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } catch (NullPointerException ignored) { } } try { return clazz.getMethod(methodName, parameters); } catch (NoSuchMethodException e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -513,7 +513,7 @@ public class ReflectionManager { try { return (double) pingField.getInt(ReflectionManager.getNmsEntity(player)); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return 0D; } @@ -525,7 +525,7 @@ public class ReflectionManager { float height = (Float) getNmsMethod("Entity", "getHeadHeight").invoke(getNmsEntity(entity)); return new float[] { length, width, height }; } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -542,7 +542,7 @@ public class ReflectionManager { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -560,7 +560,7 @@ public class ReflectionManager { try { return getCraftClass("CraftWorld").getMethod("getHandle").invoke(world); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(System.out); } return null; } @@ -585,7 +585,7 @@ public class ReflectionManager { } } } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } return null; } @@ -615,7 +615,7 @@ public class ReflectionManager { Field check = getNmsField(connection.getClass(), "checkMovement"); check.setBoolean(connection, true); } 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()); setBoundingBoxMethod.invoke(getNmsEntity(entity), boundingBox); } catch (Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(System.out); } }