Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-04 23:30:24 +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:
Ursprung
b1b35fe025
Commit
704c876772
@ -1,5 +1,6 @@
|
|||||||
package us.myles.ViaVersion.commands;
|
package us.myles.ViaVersion.commands;
|
||||||
|
|
||||||
|
import io.netty.util.ResourceLeakDetector;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -42,6 +43,13 @@ public class ViaVersionCommand implements CommandExecutor {
|
|||||||
} else if (args[0].equalsIgnoreCase("debug")) {
|
} else if (args[0].equalsIgnoreCase("debug")) {
|
||||||
plugin.setDebug(!plugin.isDebug());
|
plugin.setDebug(!plugin.isDebug());
|
||||||
sender.sendMessage(color("&6Debug mode is now " + (plugin.isDebug() ? "&aenabled" : "&cdisabled")));
|
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")) {
|
} else if (args[0].equalsIgnoreCase("dontbugme")) {
|
||||||
boolean newValue = !plugin.getConfig().getBoolean("checkforupdates", true);
|
boolean newValue = !plugin.getConfig().getBoolean("checkforupdates", true);
|
||||||
plugin.getConfig().set("checkforupdates", newValue);
|
plugin.getConfig().set("checkforupdates", newValue);
|
||||||
@ -62,7 +70,7 @@ public class ViaVersionCommand implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendHelp(CommandSender sender){
|
public void sendHelp(CommandSender sender) {
|
||||||
sender.sendMessage(color("&aViaVersion &c" + ViaVersion.getInstance().getVersion()));
|
sender.sendMessage(color("&aViaVersion &c" + ViaVersion.getInstance().getVersion()));
|
||||||
sender.sendMessage(color("&6Commands:"));
|
sender.sendMessage(color("&6Commands:"));
|
||||||
sender.sendMessage(color("&2/viaversion list &7- &6Shows lists of all 1.9 clients and 1.8 clients."));
|
sender.sendMessage(color("&2/viaversion list &7- &6Shows lists of all 1.9 clients and 1.8 clients."));
|
||||||
|
@ -47,6 +47,8 @@ public class ViaDecodeHandler extends ByteToMessageDecoder {
|
|||||||
if (e.getCause() instanceof Exception) {
|
if (e.getCause() instanceof Exception) {
|
||||||
throw (Exception) e.getCause();
|
throw (Exception) e.getCause();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
bytebuf.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren