Fix memory leak, add command. Merge from master

This commit is contained in:
Myles 2016-03-19 20:51:23 +00:00
commit a2f8f28010
3 changed files with 11 additions and 1 deletions

View File

@ -6,7 +6,7 @@
<groupId>us.myles</groupId>
<artifactId>viaversion</artifactId>
<version>0.6.6-SNAPSHOT</version>
<version>0.6.7-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ViaVersion</name>

View File

@ -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);

View File

@ -53,6 +53,8 @@ public class ViaDecodeHandler extends ByteToMessageDecoder {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
}
} finally {
bytebuf.release();
}
}
}