mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 20:23:53 -07:00
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/commands/CommandDispatcher.java
|
||||
+++ b/net/minecraft/commands/CommandDispatcher.java
|
||||
@@ -107,6 +107,14 @@
|
||||
@@ -106,6 +106,14 @@
|
||||
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -15,21 +15,18 @@
|
||||
public class CommandDispatcher {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -118,6 +126,7 @@
|
||||
@@ -117,6 +125,7 @@
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher = new com.mojang.brigadier.CommandDispatcher();
|
||||
|
||||
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype) {
|
||||
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype, CommandBuildContext commandbuildcontext) {
|
||||
+ this(); // CraftBukkit
|
||||
CommandAdvancement.register(this.dispatcher);
|
||||
CommandAttribute.register(this.dispatcher);
|
||||
CommandExecute.register(this.dispatcher);
|
||||
@@ -204,17 +213,63 @@
|
||||
CommandExecute.register(this.dispatcher, commandbuildcontext);
|
||||
@@ -201,16 +210,68 @@
|
||||
CommandPublish.register(this.dispatcher);
|
||||
}
|
||||
|
||||
this.dispatcher.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
|
||||
- CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", new Object[]{this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection});
|
||||
+ // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", new Object[]{this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection}); // CraftBukkit
|
||||
});
|
||||
+ // CraftBukkit start
|
||||
+ }
|
||||
+
|
||||
@@ -73,32 +70,39 @@
|
||||
+ }
|
||||
+
|
||||
+ String newCommand = joiner.join(args);
|
||||
+ return this.performCommand(sender, newCommand, newCommand, false);
|
||||
+ return this.performCommand(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);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public int performCommand(CommandListenerWrapper commandlistenerwrapper, String s) {
|
||||
+ return this.performCommand(commandlistenerwrapper, s, s, true);
|
||||
+ return this.performCommand(commandlistenerwrapper, s, s);
|
||||
+ }
|
||||
+
|
||||
+ public int performCommand(CommandListenerWrapper commandlistenerwrapper, String s, String label, boolean stripSlash) {
|
||||
+ public int performCommand(CommandListenerWrapper commandlistenerwrapper, String s, String label) { // CraftBukkit
|
||||
StringReader stringreader = new StringReader(s);
|
||||
|
||||
- if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
+ if (stripSlash && stringreader.canRead() && stringreader.peek() == '/') {
|
||||
+ // CraftBukkit end
|
||||
stringreader.skip();
|
||||
}
|
||||
|
||||
@@ -238,7 +293,7 @@
|
||||
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
||||
@@ -235,7 +296,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
|
||||
- return chatmodifier.withClickEvent(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s));
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
|
||||
- return chatmodifier.withClickEvent(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, "/" + s));
|
||||
+ return chatmodifier.withClickEvent(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
|
||||
});
|
||||
|
||||
if (j > 10) {
|
||||
@@ -288,11 +343,36 @@
|
||||
@@ -285,11 +346,36 @@
|
||||
}
|
||||
|
||||
public void sendCommands(EntityPlayer entityplayer) {
|
||||
@@ -136,7 +140,7 @@
|
||||
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -303,7 +383,7 @@
|
||||
@@ -300,7 +386,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
@@ -145,7 +149,7 @@
|
||||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -326,7 +406,7 @@
|
||||
@@ -323,7 +409,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/commands/CommandListenerWrapper.java
|
||||
+++ b/net/minecraft/commands/CommandListenerWrapper.java
|
||||
@@ -37,6 +37,8 @@
|
||||
@@ -35,6 +35,8 @@
|
||||
import net.minecraft.world.phys.Vec2F;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
+
|
||||
public class CommandListenerWrapper implements ICompletionProvider {
|
||||
|
||||
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.player"));
|
||||
@@ -55,6 +57,7 @@
|
||||
private final ResultConsumer<CommandListenerWrapper> consumer;
|
||||
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(IChatBaseComponent.translatable("permissions.requires.player"));
|
||||
@@ -54,6 +56,7 @@
|
||||
private final ArgumentAnchor.Anchor anchor;
|
||||
private final Vec2F rotation;
|
||||
private final CommandSigningContext signingContext;
|
||||
+ public volatile CommandNode currentCommand; // CraftBukkit
|
||||
|
||||
public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) {
|
||||
this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> {
|
||||
@@ -155,9 +158,23 @@
|
||||
@@ -163,9 +166,23 @@
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(int i) {
|
||||
@@ -41,16 +41,16 @@
|
||||
public Vec3D getPosition() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
@@ -219,7 +236,7 @@
|
||||
@@ -255,7 +272,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
- if (entityplayer != this.source && this.server.getPlayerList().isOp(entityplayer.getGameProfile())) {
|
||||
+ if (entityplayer != this.source && entityplayer.getBukkitEntity().hasPermission("minecraft.admin.command_feedback")) { // CraftBukkit
|
||||
entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.NIL_UUID);
|
||||
entityplayer.sendSystemMessage(ichatmutablecomponent);
|
||||
}
|
||||
}
|
||||
@@ -287,4 +304,10 @@
|
||||
@@ -323,4 +340,10 @@
|
||||
public IRegistryCustom registryAccess() {
|
||||
return this.server.registryAccess();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/commands/ICommandListener.java
|
||||
+++ b/net/minecraft/commands/ICommandListener.java
|
||||
@@ -23,6 +23,13 @@
|
||||
@@ -22,6 +22,13 @@
|
||||
public boolean shouldInformAdmins() {
|
||||
return false;
|
||||
}
|
||||
@@ -13,8 +13,8 @@
|
||||
+ // CraftBukkit end
|
||||
};
|
||||
|
||||
void sendMessage(IChatBaseComponent ichatbasecomponent, UUID uuid);
|
||||
@@ -36,4 +43,6 @@
|
||||
void sendSystemMessage(IChatBaseComponent ichatbasecomponent);
|
||||
@@ -35,4 +42,6 @@
|
||||
default boolean alwaysAccepts() {
|
||||
return false;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/commands/arguments/ArgumentEntity.java
|
||||
+++ b/net/minecraft/commands/arguments/ArgumentEntity.java
|
||||
@@ -95,9 +95,15 @@
|
||||
@@ -94,9 +94,15 @@
|
||||
}
|
||||
|
||||
public EntitySelector parse(StringReader stringreader) throws CommandSyntaxException {
|
||||
|
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
|
||||
+++ b/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
|
||||
@@ -61,7 +61,7 @@
|
||||
};
|
||||
@@ -68,7 +68,7 @@
|
||||
private final StringReader reader;
|
||||
private final boolean forTesting;
|
||||
private final boolean allowNbt;
|
||||
- private final Map<IBlockState<?>, Comparable<?>> properties = Maps.newHashMap();
|
||||
+ private final Map<IBlockState<?>, Comparable<?>> properties = Maps.newLinkedHashMap(); // CraftBukkit - stable
|
||||
private final Map<String, String> vagueProperties = Maps.newHashMap();
|
||||
private MinecraftKey id = new MinecraftKey("");
|
||||
private BlockStateList<Block, IBlockData> definition;
|
||||
@@ -230,7 +230,7 @@
|
||||
@Nullable
|
||||
@@ -284,7 +284,7 @@
|
||||
Iterator iterator = iblockstate.getPossibleValues().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -17,8 +17,8 @@
|
||||
+ T t0 = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
|
||||
if (t0 instanceof Integer) {
|
||||
suggestionsbuilder.suggest((Integer) t0);
|
||||
@@ -493,7 +493,7 @@
|
||||
Integer integer = (Integer) t0;
|
||||
@@ -556,7 +556,7 @@
|
||||
Optional<T> optional = iblockstate.getValue(s);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
@@ -27,7 +27,7 @@
|
||||
this.properties.put(iblockstate, (Comparable) optional.get());
|
||||
} else {
|
||||
this.reader.setCursor(i);
|
||||
@@ -527,7 +527,7 @@
|
||||
@@ -592,7 +592,7 @@
|
||||
private static <T extends Comparable<T>> void appendProperty(StringBuilder stringbuilder, IBlockState<T> iblockstate, Comparable<?> comparable) {
|
||||
stringbuilder.append(iblockstate.getName());
|
||||
stringbuilder.append('=');
|
||||
@@ -35,4 +35,4 @@
|
||||
+ stringbuilder.append(iblockstate.getName((T) comparable)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public CompletableFuture<Suggestions> fillSuggestions(SuggestionsBuilder suggestionsbuilder, IRegistry<Block> iregistry) {
|
||||
public static record a(IBlockData blockState, Map<IBlockState<?>, Comparable<?>> properties, @Nullable NBTTagCompound nbt) {
|
||||
|
Reference in New Issue
Block a user