diff --git a/pom.xml b/pom.xml index 518a2e605..dc4cbd873 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion - 0.6.6-SNAPSHOT + 0.6.7-SNAPSHOT jar ViaVersion diff --git a/src/main/java/us/myles/ViaVersion/commands/ViaVersionCommand.java b/src/main/java/us/myles/ViaVersion/commands/ViaVersionCommand.java index ce426e474..17c3abe73 100644 --- a/src/main/java/us/myles/ViaVersion/commands/ViaVersionCommand.java +++ b/src/main/java/us/myles/ViaVersion/commands/ViaVersionCommand.java @@ -1,5 +1,6 @@ package us.myles.ViaVersion.commands; +import io.netty.util.ResourceLeakDetector; import lombok.RequiredArgsConstructor; import org.bukkit.Bukkit; import org.bukkit.command.Command; @@ -39,6 +40,13 @@ public class ViaVersionCommand implements CommandExecutor { } else if (args[0].equalsIgnoreCase("debug")) { plugin.setDebug(!plugin.isDebug()); sender.sendMessage(color("&6Debug mode is now " + (plugin.isDebug() ? "&aenabled" : "&cdisabled"))); + } else if (args[0].equalsIgnoreCase("displayleaks")) { + if (ResourceLeakDetector.getLevel() != ResourceLeakDetector.Level.ADVANCED) { + ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED); + } else { + ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); + } + sender.sendMessage(color("&6Leak detector is now " + (ResourceLeakDetector.getLevel() == ResourceLeakDetector.Level.ADVANCED ? "&aenabled" : "&cdisabled"))); } else if (args[0].equalsIgnoreCase("dontbugme")) { boolean newValue = !plugin.getConfig().getBoolean("checkforupdates", true); plugin.getConfig().set("checkforupdates", newValue); diff --git a/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java b/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java index 3381b2fd2..58b23889a 100644 --- a/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java +++ b/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java @@ -53,6 +53,8 @@ public class ViaDecodeHandler extends ByteToMessageDecoder { if (e.getCause() instanceof Exception) { throw (Exception) e.getCause(); } + } finally { + bytebuf.release(); } } }