3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

One line of code can make holes in the world, one line can fix them. (Fixes packet mem leak, also adds useful secret displayleaks command :) )

Dieser Commit ist enthalten in:
Myles 2016-03-19 20:45:07 +00:00
Ursprung b1b35fe025
Commit 704c876772
2 geänderte Dateien mit 11 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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;
@ -42,6 +43,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);
@ -62,7 +70,7 @@ public class ViaVersionCommand implements CommandExecutor {
return false;
}
public void sendHelp(CommandSender sender){
public void sendHelp(CommandSender sender) {
sender.sendMessage(color("&aViaVersion &c" + ViaVersion.getInstance().getVersion()));
sender.sendMessage(color("&6Commands:"));
sender.sendMessage(color("&2/viaversion list &7- &6Shows lists of all 1.9 clients and 1.8 clients."));

Datei anzeigen

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