mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-13 19:25:49 -07:00
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/commands/CommandDispatcher.java
|
||||
+++ b/net/minecraft/commands/CommandDispatcher.java
|
||||
@@ -106,6 +106,14 @@
|
||||
@@ -109,6 +109,14 @@
|
||||
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class CommandDispatcher {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -117,6 +125,7 @@
|
||||
@@ -120,6 +128,7 @@
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher = new com.mojang.brigadier.CommandDispatcher();
|
||||
|
||||
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype, CommandBuildContext commandbuildcontext) {
|
||||
@@ -23,7 +23,7 @@
|
||||
CommandAdvancement.register(this.dispatcher);
|
||||
CommandAttribute.register(this.dispatcher);
|
||||
CommandExecute.register(this.dispatcher, commandbuildcontext);
|
||||
@@ -201,16 +210,68 @@
|
||||
@@ -204,6 +213,11 @@
|
||||
CommandPublish.register(this.dispatcher);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
this.dispatcher.setConsumer((commandcontext, flag, i) -> {
|
||||
((CommandListenerWrapper) commandcontext.getSource()).onCommandComplete(commandcontext, flag, i);
|
||||
});
|
||||
@@ -216,12 +230,59 @@
|
||||
return new ParseResults(commandcontextbuilder1, parseresults.getReader(), parseresults.getExceptions());
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -70,30 +72,31 @@
|
||||
+ }
|
||||
+
|
||||
+ String newCommand = joiner.join(args);
|
||||
+ return this.performCommand(sender, newCommand, newCommand);
|
||||
+ return this.performPrefixedCommand(sender, newCommand, newCommand);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public int performPrefixedCommand(CommandListenerWrapper commandlistenerwrapper, String s) {
|
||||
- return this.performCommand(commandlistenerwrapper, s.startsWith("/") ? s.substring(1) : s);
|
||||
+ // CraftBukkit start
|
||||
+ return this.performPrefixedCommand(commandlistenerwrapper, s, s);
|
||||
+ }
|
||||
+
|
||||
+ public int performPrefixedCommand(CommandListenerWrapper commandlistenerwrapper, String s, String label) {
|
||||
+ return this.performCommand(commandlistenerwrapper, s.startsWith("/") ? s.substring(1) : s, label);
|
||||
s = s.startsWith("/") ? s.substring(1) : s;
|
||||
- return this.performCommand(this.dispatcher.parse(s, commandlistenerwrapper), s);
|
||||
+ return this.performCommand(this.dispatcher.parse(s, commandlistenerwrapper), s, label);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public int performCommand(CommandListenerWrapper commandlistenerwrapper, String s) {
|
||||
+ return this.performCommand(commandlistenerwrapper, s, s);
|
||||
public int performCommand(ParseResults<CommandListenerWrapper> parseresults, String s) {
|
||||
+ return this.performCommand(parseresults, s, s);
|
||||
+ }
|
||||
+
|
||||
+ public int performCommand(CommandListenerWrapper commandlistenerwrapper, String s, String label) { // CraftBukkit
|
||||
StringReader stringreader = new StringReader(s);
|
||||
+ public int performCommand(ParseResults<CommandListenerWrapper> parseresults, String s, String label) { // CraftBukkit
|
||||
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) parseresults.getContext().getSource();
|
||||
|
||||
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
||||
@@ -235,7 +296,7 @@
|
||||
@@ -246,7 +307,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
|
||||
@@ -102,7 +105,7 @@
|
||||
});
|
||||
|
||||
if (j > 10) {
|
||||
@@ -285,11 +346,36 @@
|
||||
@@ -296,11 +357,36 @@
|
||||
}
|
||||
|
||||
public void sendCommands(EntityPlayer entityplayer) {
|
||||
@@ -140,7 +143,7 @@
|
||||
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -300,7 +386,7 @@
|
||||
@@ -311,7 +397,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
@@ -149,7 +152,7 @@
|
||||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -323,7 +409,7 @@
|
||||
@@ -334,7 +420,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user