mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
[ci skip] move custom brig exception to paper package
This commit is contained in:
parent
c848b33030
commit
8fa3b24907
1 changed files with 8 additions and 6 deletions
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
try {
|
||||
child.parse(reader, context);
|
||||
+ // Paper start - Handle non-recoverable exceptions
|
||||
+ } catch (final com.mojang.brigadier.exceptions.TagParseCommandSyntaxException e) {
|
||||
+ } catch (final io.papermc.paper.brigadier.TagParseCommandSyntaxException e) {
|
||||
+ stop = true;
|
||||
+ throw e;
|
||||
+ // Paper end - Handle non-recoverable exceptions
|
||||
|
@ -32,15 +32,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
continue;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/com/mojang/brigadier/exceptions/TagParseCommandSyntaxException.java b/src/main/java/com/mojang/brigadier/exceptions/TagParseCommandSyntaxException.java
|
||||
diff --git a/src/main/java/io/papermc/paper/brigadier/TagParseCommandSyntaxException.java b/src/main/java/io/papermc/paper/brigadier/TagParseCommandSyntaxException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/mojang/brigadier/exceptions/TagParseCommandSyntaxException.java
|
||||
+++ b/src/main/java/io/papermc/paper/brigadier/TagParseCommandSyntaxException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.mojang.brigadier.exceptions;
|
||||
+package io.papermc.paper.brigadier;
|
||||
+
|
||||
+import com.mojang.brigadier.LiteralMessage;
|
||||
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
+import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
+import net.minecraft.network.chat.Component;
|
||||
+
|
||||
+public final class TagParseCommandSyntaxException extends CommandSyntaxException {
|
||||
|
@ -118,7 +120,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private void increaseDepth() throws CommandSyntaxException {
|
||||
+ this.depth++;
|
||||
+ if (this.depth > 512) {
|
||||
+ throw new com.mojang.brigadier.exceptions.TagParseCommandSyntaxException("NBT tag is too complex, depth > 512");
|
||||
+ throw new io.papermc.paper.brigadier.TagParseCommandSyntaxException("NBT tag is too complex, depth > 512");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
@ -205,7 +207,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
+ // Paper start - Handle non-recoverable exceptions
|
||||
+ if (!parseresults.getExceptions().isEmpty()
|
||||
+ && parseresults.getExceptions().values().stream().anyMatch(e -> e instanceof com.mojang.brigadier.exceptions.TagParseCommandSyntaxException)) {
|
||||
+ && parseresults.getExceptions().values().stream().anyMatch(e -> e instanceof io.papermc.paper.brigadier.TagParseCommandSyntaxException)) {
|
||||
+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM);
|
||||
+ return;
|
||||
+ }
|
||||
|
|
Loading…
Reference in a new issue