Update to Minecraft 1.19.1

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-07-28 04:00:00 +10:00
parent 7c33b52741
commit f8db65033c
41 changed files with 654 additions and 579 deletions

View File

@@ -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()));
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/commands/CommandListenerWrapper.java
+++ b/net/minecraft/commands/CommandListenerWrapper.java
@@ -35,6 +35,8 @@
@@ -38,6 +38,8 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
@@ -9,15 +9,15 @@
public class CommandListenerWrapper implements ICompletionProvider {
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(IChatBaseComponent.translatable("permissions.requires.player"));
@@ -54,6 +56,7 @@
private final ArgumentAnchor.Anchor anchor;
@@ -58,6 +60,7 @@
private final Vec2F rotation;
private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer;
+ 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) -> {
@@ -163,9 +166,23 @@
@@ -172,9 +175,23 @@
@Override
public boolean hasPermission(int i) {
@@ -41,7 +41,7 @@
public Vec3D getPosition() {
return this.worldPosition;
}
@@ -255,7 +272,7 @@
@@ -300,7 +317,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -50,7 +50,7 @@
entityplayer.sendSystemMessage(ichatmutablecomponent);
}
}
@@ -323,4 +340,10 @@
@@ -368,4 +385,10 @@
public IRegistryCustom registryAccess() {
return this.server.registryAccess();
}