move tab completion exploit fix to nexus
This commit is contained in:
1 parent
dd178d699b
commit
a9b8c91195
1 file changed
-30
@@ -61,36 +61,6 @@ public class ServerGamePacketListenerMixin {
|
||||
}
|
||||
}
|
||||
|
||||
@Unique private static final String[] ABUSABLE_SEQUENCES = { "@", "[", "nbt", "=", "{", "}", "]" };
|
||||
|
||||
@Inject(method = "handleCustomCommandSuggestions", at = @At("HEAD"), cancellable = true)
|
||||
private void fixSuggestionsCrash(ServerboundCommandSuggestionPacket serverboundCommandSuggestionPacket, CallbackInfo ci) {
|
||||
final String text = serverboundCommandSuggestionPacket.getCommand();
|
||||
int length = text.length();
|
||||
|
||||
if(this.player.hasPermissions(2)) return;
|
||||
|
||||
if (length > 256) {
|
||||
ci.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (length > 64) {
|
||||
final int index = text.indexOf(' ');
|
||||
if (index == -1 || index >= 64) {
|
||||
ci.cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (String sequence : ABUSABLE_SEQUENCES) {
|
||||
if (text.contains(sequence)) {
|
||||
ci.cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Thank you, our lord and saviour
|
||||
// _____ _ _____ _
|
||||
// | __ \(_) / ____| | |
|
||||
|
||||
Reference in new issue
Block a user