mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
bunch of fixes and improvements
This commit is contained in:
parent
81f4405e26
commit
91b5de66bf
@ -4,6 +4,18 @@ Date: Wed, 30 Mar 2016 19:36:20 -0400
|
||||
Subject: [PATCH] MC Dev fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java b/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
|
||||
index a9617232c488a7a641b6657b265a5e42e77bc117..3d24fbca90bc7d8bdbac1be2176555c15ae75039 100644
|
||||
--- a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
|
||||
+++ b/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
|
||||
@@ -68,6 +68,6 @@ public class ItemInput {
|
||||
}
|
||||
|
||||
private String getItemName() {
|
||||
- return this.item.unwrapKey().map(ResourceKey::location).orElseGet(() -> "unknown[" + this.item + "]").toString();
|
||||
+ return this.item.unwrapKey().<Object>map(ResourceKey::location).orElseGet(() -> "unknown[" + this.item + "]").toString(); // Paper - decompile fix
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
index 478d2114fbd5c499a8adbf8b6cefcc8335e830dc..2074d4327f0c356c220f3a6a9761439e76a15fc3 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||||
|
@ -25,26 +25,10 @@ index ec34e402104d7a696ea95e0b11ee70189b678ab9..d9fc3c25bef251df6a53ee47ec224b07
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index b81a4204a85e5b431cd6137fd8b80e43779c97b7..03966f447354fb16a01442ff6c6257fa19461bcd 100644
|
||||
index b81a4204a85e5b431cd6137fd8b80e43779c97b7..eec5279ac4386132fa053c57889e32e6b8141614 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -154,6 +154,7 @@ public class Commands {
|
||||
public static final int LEVEL_ADMINS = 3;
|
||||
public static final int LEVEL_OWNERS = 4;
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher = new com.mojang.brigadier.CommandDispatcher();
|
||||
+ public final java.util.List<CommandNode<CommandSourceStack>> vanillaCommandNodes = new java.util.ArrayList<>(); // Paper - Add UnknownCommandEvent
|
||||
|
||||
public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) {
|
||||
this(); // CraftBukkit
|
||||
@@ -257,6 +258,7 @@ public class Commands {
|
||||
if (environment.includeIntegrated) {
|
||||
PublishCommand.register(this.dispatcher);
|
||||
}
|
||||
+ this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper - Add UnknownCommandEvent
|
||||
|
||||
// CraftBukkit start
|
||||
}
|
||||
@@ -331,7 +333,7 @@ public class Commands {
|
||||
@@ -331,7 +331,7 @@ public class Commands {
|
||||
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
||||
return "/" + s;
|
||||
});
|
||||
@ -53,7 +37,7 @@ index b81a4204a85e5b431cd6137fd8b80e43779c97b7..03966f447354fb16a01442ff6c6257fa
|
||||
|
||||
try {
|
||||
if (contextchain != null) {
|
||||
@@ -365,14 +367,23 @@ public class Commands {
|
||||
@@ -365,14 +365,18 @@ public class Commands {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -68,18 +52,13 @@ index b81a4204a85e5b431cd6137fd8b80e43779c97b7..03966f447354fb16a01442ff6c6257fa
|
||||
- commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage()));
|
||||
+ // Paper start - Add UnknownCommandEvent
|
||||
+ final net.kyori.adventure.text.TextComponent.Builder builder = net.kyori.adventure.text.Component.text();
|
||||
+ if ((parseresults.getContext().getNodes().isEmpty() || !this.vanillaCommandNodes.contains(parseresults.getContext().getNodes().get(0).getNode()))) {
|
||||
+ if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
|
||||
+ builder.append(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.unknownCommandMessage));
|
||||
+ }
|
||||
+ } else {
|
||||
+ // commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage()));
|
||||
+ builder.color(net.kyori.adventure.text.format.NamedTextColor.RED).append(io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(commandsyntaxexception.getRawMessage()));
|
||||
+ // Paper end - Add UnknownCommandEvent
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
MutableComponent ichatmutablecomponent = Component.empty().withStyle(ChatFormatting.GRAY).withStyle((chatmodifier) -> {
|
||||
@@ -391,7 +402,18 @@ public class Commands {
|
||||
@@ -391,7 +395,17 @@ public class Commands {
|
||||
}
|
||||
|
||||
ichatmutablecomponent.append((Component) Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC));
|
||||
@ -90,7 +69,6 @@ index b81a4204a85e5b431cd6137fd8b80e43779c97b7..03966f447354fb16a01442ff6c6257fa
|
||||
+ .append(net.kyori.adventure.text.Component.newline())
|
||||
+ .append(io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent));
|
||||
+ }
|
||||
+ }
|
||||
+ org.bukkit.event.command.UnknownCommandEvent event = new org.bukkit.event.command.UnknownCommandEvent(commandlistenerwrapper.getBukkitSender(), s, org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty() ? null : builder.build());
|
||||
+ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.message() != null) {
|
||||
@ -100,18 +78,10 @@ index b81a4204a85e5b431cd6137fd8b80e43779c97b7..03966f447354fb16a01442ff6c6257fa
|
||||
|
||||
return null;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index a7554f2028f93867360c27a51c9580a8b49f5b57..f351667cec83f39c28073e262b6c9b51873fb327 100644
|
||||
index a7554f2028f93867360c27a51c9580a8b49f5b57..c8b123f3df533d1c7889fe44a2a47fdd08c7f715 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -529,6 +529,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
node = clone;
|
||||
}
|
||||
+ dispatcher.vanillaCommandNodes.add(node); // Paper
|
||||
|
||||
dispatcher.getDispatcher().getRoot().addChild(node);
|
||||
} else {
|
||||
@@ -911,7 +912,13 @@ public final class CraftServer implements Server {
|
||||
@@ -911,7 +911,13 @@ public final class CraftServer implements Server {
|
||||
|
||||
// Spigot start
|
||||
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
|
||||
|
@ -80,10 +80,10 @@ index f6019435a90979ed6f966cc6e8288f05ff889d5e..ae0e3694f3971908cb472b1165d26492
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index f351667cec83f39c28073e262b6c9b51873fb327..bf61a439d81b481c6d27a3b399a3a08e96d3909c 100644
|
||||
index c8b123f3df533d1c7889fe44a2a47fdd08c7f715..e188d020d0cefbabbe0c720b26233203fd84bcb1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2251,7 +2251,7 @@ public final class CraftServer implements Server {
|
||||
@@ -2250,7 +2250,7 @@ public final class CraftServer implements Server {
|
||||
offers = this.tabCompleteChat(player, message);
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
|
||||
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index bf61a439d81b481c6d27a3b399a3a08e96d3909c..9d65bce391b00b78efed1e40a01fa2865c05e6fd 100644
|
||||
index e188d020d0cefbabbe0c720b26233203fd84bcb1..cbdfb4168f23bbbd37675da6dc88acb3191d88d6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1850,6 +1850,25 @@ public final class CraftServer implements Server {
|
||||
@@ -1849,6 +1849,25 @@ public final class CraftServer implements Server {
|
||||
return recipients.size();
|
||||
}
|
||||
|
||||
|
@ -33,10 +33,10 @@ index 0ffa25a6e41cc56e78c79e0cee45e3b811794129..1b47e228ad7365b31d6ddd8c572d3bc5
|
||||
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 9d65bce391b00b78efed1e40a01fa2865c05e6fd..af9140513970fc5c3797a170eab02de40048543c 100644
|
||||
index cbdfb4168f23bbbd37675da6dc88acb3191d88d6..9c673642b7c35bc3c443bd66fbcd278073eeccc2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -927,6 +927,7 @@ public final class CraftServer implements Server {
|
||||
@@ -926,6 +926,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
@ -44,7 +44,7 @@ index 9d65bce391b00b78efed1e40a01fa2865c05e6fd..af9140513970fc5c3797a170eab02de4
|
||||
this.reloadCount++;
|
||||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
||||
this.commandsConfiguration = YamlConfiguration.loadConfiguration(this.getCommandsConfigFile());
|
||||
@@ -1017,6 +1018,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1016,6 +1017,7 @@ public final class CraftServer implements Server {
|
||||
this.enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||
this.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.RELOAD));
|
||||
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
|
||||
|
@ -18,10 +18,10 @@ index 6d06b772ffb9d47d6a717462a4b2b494544e80ae..69ffd6ea2ce7c6d4f211c6081fcea79a
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index af9140513970fc5c3797a170eab02de40048543c..8254a5d2a72bf12b2f2600a99eb3058c6e76042a 100644
|
||||
index 9c673642b7c35bc3c443bd66fbcd278073eeccc2..4d1d7fc503225be0aabc99f0285cc6d306e034ef 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2834,6 +2834,16 @@ public final class CraftServer implements Server {
|
||||
@@ -2833,6 +2833,16 @@ public final class CraftServer implements Server {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions;
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,10 @@ commands if the server is restarting. Using the default async pool caused issues
|
||||
due to the shutdown logic generally being much later.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 03966f447354fb16a01442ff6c6257fa19461bcd..6383cdfe3e2b61314fee7f7236dc7df1c1e8bfb6 100644
|
||||
index eec5279ac4386132fa053c57889e32e6b8141614..b754c0b3e2cd878fca5f702daca64f837ec83451 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -460,6 +460,24 @@ public class Commands {
|
||||
@@ -452,6 +452,24 @@ public class Commands {
|
||||
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
|
||||
// CraftBukkit start
|
||||
// Register Vanilla commands into builtRoot as before
|
||||
@ -37,7 +37,7 @@ index 03966f447354fb16a01442ff6c6257fa19461bcd..6383cdfe3e2b61314fee7f7236dc7df1
|
||||
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
|
||||
RootCommandNode vanillaRoot = new RootCommandNode();
|
||||
|
||||
@@ -477,7 +495,14 @@ public class Commands {
|
||||
@@ -469,7 +487,14 @@ public class Commands {
|
||||
for (CommandNode node : rootcommandnode.getChildren()) {
|
||||
bukkit.add(node.getName());
|
||||
}
|
||||
|
@ -47,14 +47,14 @@ index 3370731ee064d2693b972a0765c13dd4fd69f66a..09d486a05179b9d878e1c33725b4e614
|
||||
+ // Paper end - Brigadier API
|
||||
}
|
||||
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||
index da6250df1c5f3385b683cffde47754bca4606f5e..d8142624f9f3a5909e7cc5665f1629a1a67dd302 100644
|
||||
index da6250df1c5f3385b683cffde47754bca4606f5e..14ccd0c8f721e9be7dca8a5dcb8ef95b5cd82731 100644
|
||||
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||
@@ -34,6 +34,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
||||
private final RedirectModifier<S> modifier;
|
||||
private final boolean forks;
|
||||
private Command<S> command;
|
||||
+ public LiteralCommandNode<CommandSourceStack> clientNode; // Paper - Brigadier API
|
||||
+ public CommandNode<CommandSourceStack> clientNode; // Paper - Brigadier API
|
||||
// CraftBukkit start
|
||||
public void removeCommand(String name) {
|
||||
this.children.remove(name);
|
||||
@ -99,10 +99,10 @@ index d9fc3c25bef251df6a53ee47ec224b07240a931c..2a22827f44dd0d524c22264447959a69
|
||||
public boolean hasPermission(int level) {
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 6383cdfe3e2b61314fee7f7236dc7df1c1e8bfb6..3b59f3d92d781c16825f6f67b725225256425d11 100644
|
||||
index b754c0b3e2cd878fca5f702daca64f837ec83451..f15c388434a0a501f86868de35cc138756975027 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -496,6 +496,7 @@ public class Commands {
|
||||
@@ -488,6 +488,7 @@ public class Commands {
|
||||
bukkit.add(node.getName());
|
||||
}
|
||||
// Paper start - Perf: Async command map building
|
||||
@ -110,7 +110,7 @@ index 6383cdfe3e2b61314fee7f7236dc7df1c1e8bfb6..3b59f3d92d781c16825f6f67b7252252
|
||||
net.minecraft.server.MinecraftServer.getServer().execute(() -> {
|
||||
runSync(player, bukkit, rootcommandnode);
|
||||
});
|
||||
@@ -503,6 +504,7 @@ public class Commands {
|
||||
@@ -495,6 +496,7 @@ public class Commands {
|
||||
|
||||
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
|
||||
// Paper end - Perf: Async command map building
|
||||
@ -118,7 +118,7 @@ index 6383cdfe3e2b61314fee7f7236dc7df1c1e8bfb6..3b59f3d92d781c16825f6f67b7252252
|
||||
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
||||
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -521,6 +523,11 @@ public class Commands {
|
||||
@@ -513,6 +515,11 @@ public class Commands {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 8254a5d2a72bf12b2f2600a99eb3058c6e76042a..d61aa8acdcbc08d131ecf1d385084e6c82663feb 100644
|
||||
index 4d1d7fc503225be0aabc99f0285cc6d306e034ef..0cf17dffced4d7317bbf12c87f3b9b7f1df358e8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2880,5 +2880,10 @@ public final class CraftServer implements Server {
|
||||
@@ -2879,5 +2879,10 @@ public final class CraftServer implements Server {
|
||||
profile.getProperties().putAll(((CraftPlayer) player).getHandle().getGameProfile().getProperties());
|
||||
return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile);
|
||||
}
|
||||
|
@ -184,10 +184,10 @@ index 91981ef15a9d8a46681f39ec8cf0f136f9931968..b260b197bc254d22a9fd0f1c2dd79993
|
||||
+ // Paper end - Add tick times API and /mspt command
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index d61aa8acdcbc08d131ecf1d385084e6c82663feb..86e9a0955df9ffd5421df4c4d25393ac7cb13aac 100644
|
||||
index 0cf17dffced4d7317bbf12c87f3b9b7f1df358e8..cf928e659570c0b091a6d36d9eddedee11353232 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2648,6 +2648,16 @@ public final class CraftServer implements Server {
|
||||
@@ -2647,6 +2647,16 @@ public final class CraftServer implements Server {
|
||||
return CraftMagicNumbers.INSTANCE;
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
|
||||
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 86e9a0955df9ffd5421df4c4d25393ac7cb13aac..e06b2821d29217aa6e043009cfc843da6e478a44 100644
|
||||
index cf928e659570c0b091a6d36d9eddedee11353232..15ff6476f1f86e3eac78f5cdcae9b71e124ee40f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2895,5 +2895,10 @@ public final class CraftServer implements Server {
|
||||
@@ -2894,5 +2894,10 @@ public final class CraftServer implements Server {
|
||||
public int getCurrentTick() {
|
||||
return net.minecraft.server.MinecraftServer.currentTick;
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index e06b2821d29217aa6e043009cfc843da6e478a44..87414dc4b6fc759a8d2b13f32207280551a215f4 100644
|
||||
index 15ff6476f1f86e3eac78f5cdcae9b71e124ee40f..2431f687fb0ad6c904448f47fad926b136cba815 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -579,6 +579,13 @@ public final class CraftServer implements Server {
|
||||
@@ -578,6 +578,13 @@ public final class CraftServer implements Server {
|
||||
return this.bukkitVersion;
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..479bb92d159f33c54c2d9c39d8a63aa9
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 3b59f3d92d781c16825f6f67b725225256425d11..2fb4660147294de9e9dec70bc3527327f2d859ee 100644
|
||||
index f15c388434a0a501f86868de35cc138756975027..5044a7dc120c8b040ee23365d2bf97e6180e3ee4 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -344,7 +344,7 @@ public class Commands {
|
||||
@@ -342,7 +342,7 @@ public class Commands {
|
||||
} catch (Exception exception) {
|
||||
MutableComponent ichatmutablecomponent = Component.literal(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
|
||||
|
||||
@ -105,10 +105,10 @@ index 970d1ddf0a014b47b0ac97440489706137324991..e4086bea596e5f5d71491e0b7ad650d7
|
||||
this.connection.disconnect(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 87414dc4b6fc759a8d2b13f32207280551a215f4..89749bd7f47afe9ddcb0f38d7d7a9fbd02077e30 100644
|
||||
index 2431f687fb0ad6c904448f47fad926b136cba815..c62936e7070d794aeac7e5175757aa045a6afcae 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1018,6 +1018,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1017,6 +1017,7 @@ public final class CraftServer implements Server {
|
||||
plugin.getDescription().getFullName(),
|
||||
"This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin"
|
||||
));
|
||||
|
@ -771,10 +771,10 @@ index 6667ecc4b7eded4e20a415cef1e1b1179e6710b8..16f9a98b8a939e5ca7e2dc04f87134a7
|
||||
LOOK,
|
||||
JUMP,
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 89749bd7f47afe9ddcb0f38d7d7a9fbd02077e30..3f29c1ba155ab3b145d241efb3f9274ef7a279e2 100644
|
||||
index c62936e7070d794aeac7e5175757aa045a6afcae..82d462fbc8936b70169ca3b55d488e1ef76aec40 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2908,5 +2908,11 @@ public final class CraftServer implements Server {
|
||||
@@ -2907,5 +2907,11 @@ public final class CraftServer implements Server {
|
||||
public boolean isStopping() {
|
||||
return net.minecraft.server.MinecraftServer.getServer().hasStopped();
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ index c0d467cc65c208aa1166a24dec753b1e2b3d995b..6da91e7236ee2d2a0bcbe1f3933b5624
|
||||
// CraftBukkit end
|
||||
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.shutdown(); // Paper - Plugin remapping
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3f29c1ba155ab3b145d241efb3f9274ef7a279e2..11c41e2a0887a59b7b3328b28628ce5958fc06d2 100644
|
||||
index 82d462fbc8936b70169ca3b55d488e1ef76aec40..a57322196c83b544062b671d93c8ae08563f902f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1029,6 +1029,31 @@ public final class CraftServer implements Server {
|
||||
@@ -1028,6 +1028,31 @@ public final class CraftServer implements Server {
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload
|
||||
}
|
||||
|
||||
|
@ -102,10 +102,10 @@ index 5bc22e58a6ddfc0a5459c68e99fdf1095f23f0d8..324229e960c6fdf3de2a8d5c0c5516e2
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 11c41e2a0887a59b7b3328b28628ce5958fc06d2..946ad5418950daf13e449233eac94c1311f3d926 100644
|
||||
index a57322196c83b544062b671d93c8ae08563f902f..3788f4ddac343d1bb0c96f2072a1e0fb574484f1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -967,8 +967,8 @@ public final class CraftServer implements Server {
|
||||
@@ -966,8 +966,8 @@ public final class CraftServer implements Server {
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
|
@ -22,7 +22,7 @@ wants it to collect even faster, they can restore that setting back to 1 instead
|
||||
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 946ad5418950daf13e449233eac94c1311f3d926..a22b146e2bfdeb66aca8abb5fb23ee5cd6306f4e 100644
|
||||
index 3788f4ddac343d1bb0c96f2072a1e0fb574484f1..0c7a3f0c3ae063d6fa0f76000826ebc3a49f5532 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -379,7 +379,7 @@ public final class CraftServer implements Server {
|
||||
@ -34,7 +34,7 @@ index 946ad5418950daf13e449233eac94c1311f3d926..a22b146e2bfdeb66aca8abb5fb23ee5c
|
||||
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
|
||||
this.loadIcon();
|
||||
|
||||
@@ -947,7 +947,7 @@ public final class CraftServer implements Server {
|
||||
@@ -946,7 +946,7 @@ public final class CraftServer implements Server {
|
||||
this.console.setMotd(config.motd);
|
||||
this.overrideSpawnLimits();
|
||||
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
|
||||
|
@ -9,7 +9,7 @@ to race conditions.
|
||||
Plus, .canUse we want to be safe for async anyways.
|
||||
|
||||
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||
index d8142624f9f3a5909e7cc5665f1629a1a67dd302..b02fb15c98ab873fa78635d7a23706ddff8cc94d 100644
|
||||
index 14ccd0c8f721e9be7dca8a5dcb8ef95b5cd82731..1f4963bf4681a771130abc1da179819626ecfc1f 100644
|
||||
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||
@@ -75,10 +75,10 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
||||
|
@ -18,7 +18,7 @@ index bf3785e3b347ebc1ce1e044c9db1a9d23c80f880..1fe34b2b160569b41ce87910eff56d59
|
||||
|
||||
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
index 233236733537e036d3a37a3102f3ca6b887d076f..da4fd07f75aefb53b03e40c668f6c4a23693ffcb 100644
|
||||
index 233236733537e036d3a37a3102f3ca6b887d076f..83f48d543eac94276ee4d7f7a4c21abdfa8eb8e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
@@ -144,12 +144,19 @@ public abstract class BaseFireBlock extends Block {
|
||||
@ -30,7 +30,7 @@ index 233236733537e036d3a37a3102f3ca6b887d076f..da4fd07f75aefb53b03e40c668f6c4a2
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) {
|
||||
+ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, @javax.annotation.Nullable net.minecraft.world.item.context.UseOnContext context) {
|
||||
+ // Paper end - UseOnContext param
|
||||
if (!oldState.is(state.getBlock())) {
|
||||
if (BaseFireBlock.inPortalDimension(world)) {
|
||||
@ -90,7 +90,7 @@ index 3e76f1baa321f1c2551a027a705bbeed48936e2b..24c2ec8e637373876a00bf292ac9318f
|
||||
this.getBlock().onPlace(this.asState(), world, pos, state, notify);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||
index 766884046e2c22da4cb99712ff09d1f439394523..935ae100d3672cf493ebb6a3e6f70442ea22219b 100644
|
||||
index 766884046e2c22da4cb99712ff09d1f439394523..af24467ee37cfc06f692b3b02e68f6cfbaaa8d59 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||
@@ -190,7 +190,14 @@ public class PortalShape {
|
||||
@ -103,7 +103,7 @@ index 766884046e2c22da4cb99712ff09d1f439394523..935ae100d3672cf493ebb6a3e6f70442
|
||||
+ return this.createPortalBlocks(null);
|
||||
+ }
|
||||
+
|
||||
+ public boolean createPortalBlocks(net.minecraft.world.item.context.UseOnContext useOnContext) {
|
||||
+ public boolean createPortalBlocks(@Nullable net.minecraft.world.item.context.UseOnContext useOnContext) {
|
||||
+ // Paper end - UseOnContext param
|
||||
org.bukkit.World bworld = this.level.getMinecraftWorld().getWorld();
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index a22b146e2bfdeb66aca8abb5fb23ee5cd6306f4e..99fa8f65801b1816b788fa42d49d6672bf331579 100644
|
||||
index 0c7a3f0c3ae063d6fa0f76000826ebc3a49f5532..1460060f2ff42ebaa7b2418b375ce661c73bd17f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1933,6 +1933,28 @@ public final class CraftServer implements Server {
|
||||
@@ -1932,6 +1932,28 @@ public final class CraftServer implements Server {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Empty commands shall not be dispatched
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 2fb4660147294de9e9dec70bc3527327f2d859ee..83091987b320171ef9071cbef6b10a1bd72d38e2 100644
|
||||
index 5044a7dc120c8b040ee23365d2bf97e6180e3ee4..43695b31cf23555d3d8a28b031ae6245f96ad1f7 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -290,6 +290,7 @@ public class Commands {
|
||||
@@ -288,6 +288,7 @@ public class Commands {
|
||||
command = event.getCommand();
|
||||
|
||||
String[] args = command.split(" ");
|
||||
|
@ -20,10 +20,10 @@ index 9801f78f1d44fd5a72fbdb319681b683e8fb85c4..1e720b96f0367652db6924b8654deaa9
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 99fa8f65801b1816b788fa42d49d6672bf331579..6debfd5866d4411ef8d51995bd07a0e2ece781b3 100644
|
||||
index 1460060f2ff42ebaa7b2418b375ce661c73bd17f..b9180b7552796331d09c3aef1e863a253180721d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1150,9 +1150,15 @@ public final class CraftServer implements Server {
|
||||
@@ -1149,9 +1149,15 @@ public final class CraftServer implements Server {
|
||||
File folder = new File(this.getWorldContainer(), name);
|
||||
World world = this.getWorld(name);
|
||||
|
||||
@ -41,7 +41,7 @@ index 99fa8f65801b1816b788fa42d49d6672bf331579..6debfd5866d4411ef8d51995bd07a0e2
|
||||
|
||||
if (folder.exists()) {
|
||||
Preconditions.checkArgument(folder.isDirectory(), "File (%s) exists and isn't a folder", name);
|
||||
@@ -1278,7 +1284,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1277,7 +1283,7 @@ public final class CraftServer implements Server {
|
||||
} else if (name.equals(levelName + "_the_end")) {
|
||||
worldKey = net.minecraft.world.level.Level.END;
|
||||
} else {
|
||||
@ -50,7 +50,7 @@ index 99fa8f65801b1816b788fa42d49d6672bf331579..6debfd5866d4411ef8d51995bd07a0e2
|
||||
}
|
||||
|
||||
// If set to not keep spawn in memory (changed from default) then adjust rule accordingly
|
||||
@@ -1374,6 +1380,15 @@ public final class CraftServer implements Server {
|
||||
@@ -1373,6 +1379,15 @@ public final class CraftServer implements Server {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Send empty commands if tab completion is disabled
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 83091987b320171ef9071cbef6b10a1bd72d38e2..8bc9da1a23a7bac65557114171f2f9391b0a32b0 100644
|
||||
index 43695b31cf23555d3d8a28b031ae6245f96ad1f7..3728b051b9eb9e9e06bc765a9a2fae7f45daf6ff 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -458,7 +458,12 @@ public class Commands {
|
||||
@@ -450,7 +450,12 @@ public class Commands {
|
||||
}
|
||||
|
||||
public void sendCommands(ServerPlayer player) {
|
||||
|
@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 6debfd5866d4411ef8d51995bd07a0e2ece781b3..507cad6ef11603924389956305908fd157043178 100644
|
||||
index b9180b7552796331d09c3aef1e863a253180721d..7c80d3290ee443ec79cf682be29d5ac1cbf3e381 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -305,6 +305,7 @@ public final class CraftServer implements Server {
|
||||
@ -111,7 +111,7 @@ index 6debfd5866d4411ef8d51995bd07a0e2ece781b3..507cad6ef11603924389956305908fd1
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -2976,5 +2978,11 @@ public final class CraftServer implements Server {
|
||||
@@ -2975,5 +2977,11 @@ public final class CraftServer implements Server {
|
||||
public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
|
||||
return mobGoals;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ public net.minecraft.world.item.enchantment.Enchantment definition
|
||||
Co-authored-by: Luis <luisc99@icloud.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
|
||||
index bb8a3e670924ebcce48669c5dce57e2df03fad77..bb45dde0fd91796d5fd83a5fd20f5f1d5ad63ee7 100644
|
||||
index bb8a3e670924ebcce48669c5dce57e2df03fad77..552f703f6b06895246de72501d01163d9f24dad2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
|
||||
@@ -71,7 +71,7 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine
|
||||
@ -21,29 +21,37 @@ index bb8a3e670924ebcce48669c5dce57e2df03fad77..bb45dde0fd91796d5fd83a5fd20f5f1d
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,6 +150,63 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine
|
||||
@@ -143,13 +143,70 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine
|
||||
// Paper start
|
||||
@Override
|
||||
public net.kyori.adventure.text.Component displayName(int level) {
|
||||
- return io.papermc.paper.adventure.PaperAdventure.asAdventure(getHandle().getFullname(level));
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.handle.getFullname(level));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String translationKey() {
|
||||
return this.handle.getDescriptionId();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isTradeable() {
|
||||
+ return handle.isTradeable();
|
||||
+ return this.handle.isTradeable();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isDiscoverable() {
|
||||
+ return handle.isDiscoverable();
|
||||
+ return this.handle.isDiscoverable();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getMinModifiedCost(int level) {
|
||||
+ return handle.getMinCost(level);
|
||||
+ return this.handle.getMinCost(level);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getMaxModifiedCost(int level) {
|
||||
+ return handle.getMaxCost(level);
|
||||
+ return this.handle.getMaxCost(level);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -53,12 +61,12 @@ index bb8a3e670924ebcce48669c5dce57e2df03fad77..bb45dde0fd91796d5fd83a5fd20f5f1d
|
||||
+
|
||||
+ @Override
|
||||
+ public float getDamageIncrease(int level, org.bukkit.entity.EntityCategory entityCategory) {
|
||||
+ return handle.getDamageBonus(level, guessEntityTypeFromEnchantmentCategory(entityCategory));
|
||||
+ return this.handle.getDamageBonus(level, this.guessEntityTypeFromEnchantmentCategory(entityCategory));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float getDamageIncrease(int level, org.bukkit.entity.EntityType entityType) {
|
||||
+ return handle.getDamageBonus(level, org.bukkit.craftbukkit.util.CraftMagicNumbers.getEntityTypes(entityType));
|
||||
+ return this.handle.getDamageBonus(level, org.bukkit.craftbukkit.util.CraftMagicNumbers.getEntityTypes(entityType));
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated(forRemoval = true)
|
||||
@ -80,7 +88,7 @@ index bb8a3e670924ebcce48669c5dce57e2df03fad77..bb45dde0fd91796d5fd83a5fd20f5f1d
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.Set<org.bukkit.inventory.EquipmentSlot> getActiveSlots() {
|
||||
+ return java.util.stream.Stream.of(handle.definition.slots()).map(org.bukkit.craftbukkit.CraftEquipmentSlot::getSlot).collect(java.util.stream.Collectors.toSet());
|
||||
+ return java.util.stream.Stream.of(this.handle.definition.slots()).map(org.bukkit.craftbukkit.CraftEquipmentSlot::getSlot).collect(java.util.stream.Collectors.toSet());
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityInsideBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
index da4fd07f75aefb53b03e40c668f6c4a23693ffcb..b18c1ca558e4005354ff42cde3056df9408f7fdc 100644
|
||||
index 83f48d543eac94276ee4d7f7a4c21abdfa8eb8e6..39a92a25c55fb16f1371b0dfe2fb94258e4b7f0d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
@@ -124,6 +124,7 @@ public abstract class BaseFireBlock extends Block {
|
||||
|
@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..a8e813ca89b033f061e695288b3383bd
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 507cad6ef11603924389956305908fd157043178..aab59a42af04971b5be4b6295700a1c50e1c964f 100644
|
||||
index 7c80d3290ee443ec79cf682be29d5ac1cbf3e381..7741acecf51040ba1faec4b22c0c0bfa8a2e4393 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -307,6 +307,7 @@ public final class CraftServer implements Server {
|
||||
|
@ -33,12 +33,12 @@ index 899008b2980d13f1be6280cd8cb959c53a29bebf..d5f7da3502575f6847f3c22ab0e94284
|
||||
private RedirectModifier<S> modifier = null;
|
||||
private boolean forks;
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 8bc9da1a23a7bac65557114171f2f9391b0a32b0..412c21ce2dcd772e525432efadff7e1340cb58e9 100644
|
||||
index 3728b051b9eb9e9e06bc765a9a2fae7f45daf6ff..779fee2f9b819124a01b9f8d2b7ed0d5f2accf6c 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -260,6 +260,13 @@ public class Commands {
|
||||
@@ -258,6 +258,13 @@ public class Commands {
|
||||
PublishCommand.register(this.dispatcher);
|
||||
}
|
||||
this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper - Add UnknownCommandEvent
|
||||
|
||||
+ // Paper start - Vanilla command permission fixes
|
||||
+ for (final CommandNode<CommandSourceStack> node : this.dispatcher.getRoot().getChildren()) {
|
||||
|
@ -278,10 +278,10 @@ index 58ea6a1f95a09c22125a8262b1b221004ebce0e4..ea6533c1ac218aa075da3401807a06fc
|
||||
BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index aab59a42af04971b5be4b6295700a1c50e1c964f..382c5a9ad23523b830edc7c81767b13a49aca087 100644
|
||||
index 7741acecf51040ba1faec4b22c0c0bfa8a2e4393..e85e866994247b77772937ef81507041db303071 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2298,6 +2298,11 @@ public final class CraftServer implements Server {
|
||||
@@ -2297,6 +2297,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public int getSpawnLimit(SpawnCategory spawnCategory) {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 382c5a9ad23523b830edc7c81767b13a49aca087..8136688a2a4da9d6190d67c0936e210b23ec5126 100644
|
||||
index e85e866994247b77772937ef81507041db303071..b1a75994eba329c3171a005815dd7d363006fb34 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2483,6 +2483,90 @@ public final class CraftServer implements Server {
|
||||
@@ -2482,6 +2482,90 @@ public final class CraftServer implements Server {
|
||||
return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME));
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,10 @@ index 718a455aa70999a339cccc51d6fc4bb689c2c27b..0a206b9ff1ad235fa0805ad635c1a6ca
|
||||
biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 8136688a2a4da9d6190d67c0936e210b23ec5126..3807291dc0e40e7247167162225c4f63ea992161 100644
|
||||
index b1a75994eba329c3171a005815dd7d363006fb34..608face15b7a016699e997083042be304908cc68 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1275,7 +1275,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1274,7 +1274,7 @@ public final class CraftServer implements Server {
|
||||
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
|
||||
LevelStem worlddimension = iregistry.get(actualDimension);
|
||||
|
||||
|
@ -122,10 +122,10 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3807291dc0e40e7247167162225c4f63ea992161..7d5109e0d4a75f977954b68e50eeaab46dd15b5d 100644
|
||||
index 608face15b7a016699e997083042be304908cc68..ee0c69d1d1b931d23761461fc8cc3d214aa77330 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2129,6 +2129,13 @@ public final class CraftServer implements Server {
|
||||
@@ -2128,6 +2128,13 @@ public final class CraftServer implements Server {
|
||||
return this.console.console;
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit
|
||||
Copies appropriate checks from CraftWorld#getSpawnLimit
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 7d5109e0d4a75f977954b68e50eeaab46dd15b5d..b1f141e3056e2187b164c6cba6707a30dd92fdf1 100644
|
||||
index ee0c69d1d1b931d23761461fc8cc3d214aa77330..55c87d97e42113786409db4c368c0f68cf0c4c17 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2306,6 +2306,8 @@ public final class CraftServer implements Server {
|
||||
@@ -2305,6 +2305,8 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
public int getSpawnLimit(SpawnCategory spawnCategory) {
|
||||
// Paper start - Add mobcaps commands
|
||||
|
@ -46,10 +46,10 @@ index 0000000000000000000000000000000000000000..e7d9fd2702a1ce96596580fff8f5ee4f
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index b1f141e3056e2187b164c6cba6707a30dd92fdf1..ec6dd3cd685421e24293c4b6a3a01c5dd37cc620 100644
|
||||
index 55c87d97e42113786409db4c368c0f68cf0c4c17..df76c08b76e6e31414ccbb184557560b660f96a0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2734,6 +2734,15 @@ public final class CraftServer implements Server {
|
||||
@@ -2733,6 +2733,15 @@ public final class CraftServer implements Server {
|
||||
return (org.bukkit.Tag<T>) new CraftEntityTag(BuiltInRegistries.ENTITY_TYPE, entityTagKey);
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ index b1f141e3056e2187b164c6cba6707a30dd92fdf1..ec6dd3cd685421e24293c4b6a3a01c5d
|
||||
default -> throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@@ -2766,6 +2775,13 @@ public final class CraftServer implements Server {
|
||||
@@ -2765,6 +2774,13 @@ public final class CraftServer implements Server {
|
||||
net.minecraft.core.Registry<EntityType<?>> entityTags = BuiltInRegistries.ENTITY_TYPE;
|
||||
return entityTags.getTags().map(pair -> (org.bukkit.Tag<T>) new CraftEntityTag(entityTags, pair.getFirst())).collect(ImmutableList.toImmutableList());
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ index afa1b531620fe15e76a48b39b830c199a8a0e702..af5c6893859530f65724869d18b6677e
|
||||
|
||||
if (worlddata.getCustomBossEvents() != null) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ec6dd3cd685421e24293c4b6a3a01c5dd37cc620..e25dc948bfd59b8d0a9350c0ffe496f53d042ab8 100644
|
||||
index df76c08b76e6e31414ccbb184557560b660f96a0..f4ac614b94d519659d884b779defad81f317e90a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1301,10 +1301,11 @@ public final class CraftServer implements Server {
|
||||
@@ -1300,10 +1300,11 @@ public final class CraftServer implements Server {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ index 3ebfd564d4bbf00da5919e966f3d047285845640..887957ce1ddc2f32569405642f35df46
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index e25dc948bfd59b8d0a9350c0ffe496f53d042ab8..7c4ee28eb7c40e4b629cf355cfaa95fe93d66bc2 100644
|
||||
index f4ac614b94d519659d884b779defad81f317e90a..9b9d78c4673b07845ff4ca78425ecb3aade3b039 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -308,6 +308,7 @@ public final class CraftServer implements Server {
|
||||
@ -301,7 +301,7 @@ index e25dc948bfd59b8d0a9350c0ffe496f53d042ab8..7c4ee28eb7c40e4b629cf355cfaa95fe
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
}
|
||||
|
||||
@@ -3100,5 +3102,9 @@ public final class CraftServer implements Server {
|
||||
@@ -3099,5 +3101,9 @@ public final class CraftServer implements Server {
|
||||
return datapackManager;
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Fix saving in unloadWorld
|
||||
Change savingDisabled to false to ensure ServerLevel's saving logic gets called when unloadWorld is called with save = true
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 7c4ee28eb7c40e4b629cf355cfaa95fe93d66bc2..e52461063786b65802838588d68233b33b67b173 100644
|
||||
index 9b9d78c4673b07845ff4ca78425ecb3aade3b039..a45c56a72d5f19946d05e961d2a44f3d1456681e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1350,7 +1350,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1349,7 +1349,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
try {
|
||||
if (save) {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] WorldCreator#keepSpawnLoaded
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index e52461063786b65802838588d68233b33b67b173..b0628876e4a6885e966f1839b7804af77a4b8d71 100644
|
||||
index a45c56a72d5f19946d05e961d2a44f3d1456681e..d1b8d0952d571200589e9f613c50393a41bf0804 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1293,7 +1293,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1292,7 +1292,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
// If set to not keep spawn in memory (changed from default) then adjust rule accordingly
|
||||
|
@ -45,10 +45,10 @@ index 18a73cc12615ecc7e61e8f96e6d8a3aa2ffe6e1f..0775e9259c5b465306adf6b9d7ffc404
|
||||
this.profiler.popPush("connection");
|
||||
MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index b0628876e4a6885e966f1839b7804af77a4b8d71..a18b7ec6b65dc1cfbcd5cfa64f4e2260d820aa3c 100644
|
||||
index d1b8d0952d571200589e9f613c50393a41bf0804..a84ef01a0c6c73dae27850044fea6d763e972107 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -887,6 +887,11 @@ public final class CraftServer implements Server {
|
||||
@@ -886,6 +886,11 @@ public final class CraftServer implements Server {
|
||||
return new ArrayList<World>(this.worlds.values());
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ index b0628876e4a6885e966f1839b7804af77a4b8d71..a18b7ec6b65dc1cfbcd5cfa64f4e2260
|
||||
public DedicatedPlayerList getHandle() {
|
||||
return this.playerList;
|
||||
}
|
||||
@@ -1147,6 +1152,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1146,6 +1151,7 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
public World createWorld(WorldCreator creator) {
|
||||
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
|
||||
@ -68,7 +68,7 @@ index b0628876e4a6885e966f1839b7804af77a4b8d71..a18b7ec6b65dc1cfbcd5cfa64f4e2260
|
||||
Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
|
||||
|
||||
String name = creator.name();
|
||||
@@ -1323,6 +1329,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1322,6 +1328,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public boolean unloadWorld(World world, boolean save) {
|
||||
|
@ -20,10 +20,10 @@ index e40069d937de5fd00741ae6873abeecc46b93732..552f7ab11dc09fa69034f009235cb224
|
||||
Date date = new Date();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index a18b7ec6b65dc1cfbcd5cfa64f4e2260d820aa3c..43321751c51a4fa77db1983bdc281d25454807dc 100644
|
||||
index a84ef01a0c6c73dae27850044fea6d763e972107..8d9a027b2d54f0896a196baa6bf02074d14e15f8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1892,7 +1892,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1891,7 +1891,7 @@ public final class CraftServer implements Server {
|
||||
// Paper end
|
||||
Set<CommandSender> recipients = new HashSet<>();
|
||||
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Fix suggest command message for brigadier syntax exceptions
|
||||
This is a bug accidentally introduced in upstream CB
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 412c21ce2dcd772e525432efadff7e1340cb58e9..4114e2b148baf9ddc489eed11fed4aacd0eab401 100644
|
||||
index 779fee2f9b819124a01b9f8d2b7ed0d5f2accf6c..3d6e19c2078a87983a849e6d627cba0609a556cc 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -395,7 +395,7 @@ public class Commands {
|
||||
@@ -388,7 +388,7 @@ public class Commands {
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
MutableComponent ichatmutablecomponent = Component.empty().withStyle(ChatFormatting.GRAY).withStyle((chatmodifier) -> {
|
||||
|
@ -228,10 +228,10 @@ index c44a15fc358c28345302b1bf37fc4b111a77fe0e..3333cb70744dc7ef8b181d332b63766a
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 43321751c51a4fa77db1983bdc281d25454807dc..5e6419480e0ca56a79ea555ddca0c99565e3f070 100644
|
||||
index 8d9a027b2d54f0896a196baa6bf02074d14e15f8..3618f7b808ccf7a0d6569225ae6ebd4972b51746 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -816,7 +816,7 @@ public final class CraftServer implements Server {
|
||||
@@ -815,7 +815,7 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
public long getConnectionThrottle() {
|
||||
// Spigot Start - Automatically set connection throttle for bungee configurations
|
||||
|
@ -21,7 +21,7 @@ index 4b54b3e121508fb1590654123e86c6c5de54a755..0a4069e6c544deb0ad576350ec371fe1
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
index b18c1ca558e4005354ff42cde3056df9408f7fdc..139d65d2dfb48857415dc2a350204862031f83c9 100644
|
||||
index 39a92a25c55fb16f1371b0dfe2fb94258e4b7f0d..784767e5a5c49b023df24496418fb16857d9d700 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||
@@ -134,6 +134,10 @@ public abstract class BaseFireBlock extends Block {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't enforce icanhasbukkit default if alias block exists
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 5e6419480e0ca56a79ea555ddca0c99565e3f070..ce4ba4c38e0e4968226ff35c4273cdbf7767d9c9 100644
|
||||
index 3618f7b808ccf7a0d6569225ae6ebd4972b51746..fb41a9da32c91d40e771a3c070d03a785a222b13 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -354,7 +354,11 @@ public final class CraftServer implements Server {
|
||||
|
@ -41,10 +41,10 @@ index f3c83bb20a73b489f1fb6bacb69388902b1b6fe7..3c0d2332207ba638faaaa4280bce18c3
|
||||
// CraftBukkit end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 4114e2b148baf9ddc489eed11fed4aacd0eab401..60406cb01c5a409ba6fe98677a5cc332effaebea 100644
|
||||
index 3d6e19c2078a87983a849e6d627cba0609a556cc..e1aa1e1f23512fc7d2267ff8e75358b67cb419a3 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -299,16 +299,7 @@ public class Commands {
|
||||
@@ -297,16 +297,7 @@ public class Commands {
|
||||
String[] args = command.split(" ");
|
||||
if (args.length == 0) return; // Paper - empty commands shall not be dispatched
|
||||
|
||||
|
@ -1251,7 +1251,7 @@ index 16f36d1bfe6458f9aa935cdc63066c082bc83f8e..638aeef75dc5f7ab8b8e050118a7c709
|
||||
public void setLevelCallback(EntityInLevelCallback changeListener) {
|
||||
this.levelCallback = changeListener;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ce4ba4c38e0e4968226ff35c4273cdbf7767d9c9..7e925d50e7adcc8b9c988fe7eb8c8d343f17ce58 100644
|
||||
index fb41a9da32c91d40e771a3c070d03a785a222b13..fcc0fb4bd1a6c7206dee1aa389a017c7faa4e893 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -310,6 +310,76 @@ public final class CraftServer implements Server {
|
||||
|
@ -39,10 +39,10 @@ index 0246db4a1f6eb168fa88260282311fee2ebb6014..ea04eb049e16d1027d15f9863d1fcd16
|
||||
Iterator iterator1 = this.players.iterator();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 7e925d50e7adcc8b9c988fe7eb8c8d343f17ce58..86427c6d559f3dbc505e58bcea9d0419e89598f2 100644
|
||||
index fcc0fb4bd1a6c7206dee1aa389a017c7faa4e893..cc64a5f15b478779bf6798c4533737facc979f08 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1143,6 +1143,18 @@ public final class CraftServer implements Server {
|
||||
@@ -1142,6 +1142,18 @@ public final class CraftServer implements Server {
|
||||
ReloadCommand.reload(this.console);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ index 7e925d50e7adcc8b9c988fe7eb8c8d343f17ce58..86427c6d559f3dbc505e58bcea9d0419
|
||||
private void loadIcon() {
|
||||
this.icon = new CraftIconCache(null);
|
||||
try {
|
||||
@@ -1522,6 +1534,13 @@ public final class CraftServer implements Server {
|
||||
@@ -1521,6 +1533,13 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public boolean addRecipe(Recipe recipe) {
|
||||
@ -75,7 +75,7 @@ index 7e925d50e7adcc8b9c988fe7eb8c8d343f17ce58..86427c6d559f3dbc505e58bcea9d0419
|
||||
CraftRecipe toAdd;
|
||||
if (recipe instanceof CraftRecipe) {
|
||||
toAdd = (CraftRecipe) recipe;
|
||||
@@ -1551,6 +1570,11 @@ public final class CraftServer implements Server {
|
||||
@@ -1550,6 +1569,11 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
}
|
||||
toAdd.addToCraftingManager();
|
||||
@ -87,7 +87,7 @@ index 7e925d50e7adcc8b9c988fe7eb8c8d343f17ce58..86427c6d559f3dbc505e58bcea9d0419
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1731,10 +1755,23 @@ public final class CraftServer implements Server {
|
||||
@@ -1730,10 +1754,23 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public boolean removeRecipe(NamespacedKey recipeKey) {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Use correct seed on api world load
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 86427c6d559f3dbc505e58bcea9d0419e89598f2..605f88a01e374fd588fd7856ac8e48be3ba8dc95 100644
|
||||
index cc64a5f15b478779bf6798c4533737facc979f08..6b94ae36f535e58d0ff780985d7cc5dc0494b105 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1365,7 +1365,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1364,7 +1364,7 @@ public final class CraftServer implements Server {
|
||||
net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistrycustom_dimension, this.console.options.has("recreateRegionFiles"));
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 605f88a01e374fd588fd7856ac8e48be3ba8dc95..b328af2ca94865c335a1945d8ebb6d2fd20a7117 100644
|
||||
index 6b94ae36f535e58d0ff780985d7cc5dc0494b105..b1cfc6f5a2511e9bb145442dfb765951a1ee0fca 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1970,6 +1970,11 @@ public final class CraftServer implements Server {
|
||||
@@ -1969,6 +1969,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
ServerLevel worldServer = ((CraftWorld) world).getHandle();
|
||||
Location structureLocation = world.locateNearestStructure(location, structureType, radius, findUnexplored);
|
||||
@ -20,7 +20,7 @@ index 605f88a01e374fd588fd7856ac8e48be3ba8dc95..b328af2ca94865c335a1945d8ebb6d2f
|
||||
BlockPos structurePosition = CraftLocation.toBlockPosition(structureLocation);
|
||||
|
||||
// Create map with trackPlayer = true, unlimitedTracking = true
|
||||
@@ -1980,6 +1985,31 @@ public final class CraftServer implements Server {
|
||||
@@ -1979,6 +1984,31 @@ public final class CraftServer implements Server {
|
||||
|
||||
return CraftItemStack.asBukkitCopy(stack);
|
||||
}
|
||||
|
@ -707,10 +707,10 @@ index 2e96308696e131f3f013469a395e5ddda2c5d529..65a66e484c1c39c5f41d97db52f31c67
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index b328af2ca94865c335a1945d8ebb6d2fd20a7117..ac1b9efed90af19198d43d5308698601bf6720d7 100644
|
||||
index b1cfc6f5a2511e9bb145442dfb765951a1ee0fca..b9ad8446d702f729673d75dd6978b9db820f380b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1018,6 +1018,11 @@ public final class CraftServer implements Server {
|
||||
@@ -1017,6 +1017,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] improve BanList types
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ac1b9efed90af19198d43d5308698601bf6720d7..68e13fa7021b0f9b889ff0b94623a31644c0616e 100644
|
||||
index b9ad8446d702f729673d75dd6978b9db820f380b..271b376d51479a2adc42b41bb252e60234ddee5e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2223,6 +2223,21 @@ public final class CraftServer implements Server {
|
||||
@@ -2222,6 +2222,21 @@ public final class CraftServer implements Server {
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -21612,10 +21612,10 @@ index 7dae8d91b74cc7df0745f0c121e3bea09b8d0b6d..1e2530c9e5212b6d2bdbc94817beddb4
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 68e13fa7021b0f9b889ff0b94623a31644c0616e..a17582292c2cdbc2b692071919500853cf9a7990 100644
|
||||
index 271b376d51479a2adc42b41bb252e60234ddee5e..277a92c32e9f22974442b833700bc0f70bdb976a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1407,7 +1407,6 @@ public final class CraftServer implements Server {
|
||||
@@ -1406,7 +1406,6 @@ public final class CraftServer implements Server {
|
||||
// Paper - Put world into worldlist before initing the world; move up
|
||||
|
||||
this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal);
|
||||
@ -21623,7 +21623,7 @@ index 68e13fa7021b0f9b889ff0b94623a31644c0616e..a17582292c2cdbc2b692071919500853
|
||||
|
||||
this.pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
|
||||
return internal.getWorld();
|
||||
@@ -1452,7 +1451,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1451,7 +1450,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
handle.getChunkSource().close(save);
|
||||
@ -21632,7 +21632,7 @@ index 68e13fa7021b0f9b889ff0b94623a31644c0616e..a17582292c2cdbc2b692071919500853
|
||||
handle.convertable.close();
|
||||
} catch (Exception ex) {
|
||||
this.getLogger().log(Level.SEVERE, null, ex);
|
||||
@@ -2488,7 +2487,7 @@ public final class CraftServer implements Server {
|
||||
@@ -2487,7 +2486,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public boolean isPrimaryThread() {
|
||||
|
@ -1573,10 +1573,10 @@ index 1e2530c9e5212b6d2bdbc94817beddb4247dac73..82b4bd669c57b18fb0b443bcd9449502
|
||||
private static final byte[] EMPTY_LIGHT = new byte[2048];
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index a17582292c2cdbc2b692071919500853cf9a7990..9ab9a8a41a70626ead8fce71c7e9a32e562bb722 100644
|
||||
index 277a92c32e9f22974442b833700bc0f70bdb976a..dd546e0680496d0626972b61b0eb183b07df0e6e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2659,7 +2659,7 @@ public final class CraftServer implements Server {
|
||||
@@ -2658,7 +2658,7 @@ public final class CraftServer implements Server {
|
||||
public ChunkGenerator.ChunkData createChunkData(World world) {
|
||||
Preconditions.checkArgument(world != null, "World cannot be null");
|
||||
ServerLevel handle = ((CraftWorld) world).getHandle();
|
||||
|
@ -35,10 +35,10 @@ index 3c0d2332207ba638faaaa4280bce18c334a01271..e6c7f62ed379a78645933670299e4fcd
|
||||
+ // Paper end - tell clients to ask server for suggestions for EntityArguments
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 60406cb01c5a409ba6fe98677a5cc332effaebea..a0702dccbb07c79febe2e65a2ff82c4436c09f12 100644
|
||||
index e1aa1e1f23512fc7d2267ff8e75358b67cb419a3..aa2fca6917fb67fe0e9ba067d11487c3a274f675 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -525,6 +525,7 @@ public class Commands {
|
||||
@@ -517,6 +517,7 @@ public class Commands {
|
||||
private void fillUsableCommands(CommandNode<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
|
||||
Iterator iterator = tree.getChildren().iterator();
|
||||
|
||||
@ -46,7 +46,7 @@ index 60406cb01c5a409ba6fe98677a5cc332effaebea..a0702dccbb07c79febe2e65a2ff82c44
|
||||
while (iterator.hasNext()) {
|
||||
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
||||
// Paper start - Brigadier API
|
||||
@@ -551,6 +552,12 @@ public class Commands {
|
||||
@@ -543,6 +544,12 @@ public class Commands {
|
||||
|
||||
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
|
||||
requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));
|
||||
|
@ -365,10 +365,10 @@ index 249705ec1b8b692ef1d7fec34a04918afe6486bc..f6e3b745fc417354380d4a969f83aee4
|
||||
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 9ab9a8a41a70626ead8fce71c7e9a32e562bb722..4ebefdee4bac018da066f07155a6074ac9aaa57d 100644
|
||||
index dd546e0680496d0626972b61b0eb183b07df0e6e..05e304f9fc8d0291fa779da589bd060ef4165b49 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1366,9 +1366,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1365,9 +1365,7 @@ public final class CraftServer implements Server {
|
||||
worlddata.checkName(name);
|
||||
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified());
|
||||
|
||||
@ -379,7 +379,7 @@ index 9ab9a8a41a70626ead8fce71c7e9a32e562bb722..4ebefdee4bac018da066f07155a6074a
|
||||
|
||||
long j = BiomeManager.obfuscateSeed(worlddata.worldGenOptions().seed()); // Paper - use world seed
|
||||
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
|
||||
@@ -1379,6 +1377,13 @@ public final class CraftServer implements Server {
|
||||
@@ -1378,6 +1376,13 @@ public final class CraftServer implements Server {
|
||||
biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Properly handle pdc and custom tags in ItemMeta
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 549d06b83b195c0a0207d18850b98d1e6e611460..bf0870590fcf5c502cd986047efec9f754faf9a7 100644
|
||||
index 549d06b83b195c0a0207d18850b98d1e6e611460..d70cd1f87753c0ba9ea18198906b5fba5a7d5813 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -369,6 +369,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@ -30,8 +30,8 @@ index 549d06b83b195c0a0207d18850b98d1e6e611460..bf0870590fcf5c502cd986047efec9f7
|
||||
|
||||
if (this.customTag != null) {
|
||||
itemTag.put(CraftMetaItem.CUSTOM_DATA, CustomData.of(this.customTag));
|
||||
+ this.customTag.remove(CraftMetaItem.BUKKIT_CUSTOM_TAG.BUKKIT);
|
||||
+ if (this.customTag.isEmpty()) this.customTag = null;
|
||||
+ this.customTag.remove(CraftMetaItem.BUKKIT_CUSTOM_TAG.BUKKIT); // Paper - remove PDC from custom tag
|
||||
+ if (this.customTag.isEmpty()) this.customTag = null; // Paper - reset custom tag if empty
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] handle converting old serialized names to new names
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index bf0870590fcf5c502cd986047efec9f754faf9a7..ee760d45c8e95c4f5a973254da7531d355aa5fee 100644
|
||||
index d70cd1f87753c0ba9ea18198906b5fba5a7d5813..5730cd7dc888e2946a57d7667e0f0e7826600f05 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -490,7 +490,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Deep clone nbt tags in PDC
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index ee760d45c8e95c4f5a973254da7531d355aa5fee..9c813ebe1d9e735368006f48c72db62fdbdf96f7 100644
|
||||
index 5730cd7dc888e2946a57d7667e0f0e7826600f05..80070ddd196ec212bc45f15ea098c7148b05b2e9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -284,7 +284,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 26 Apr 2024 21:33:20 -0700
|
||||
Subject: [PATCH] Don't lose removed data components in ItemMeta
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 80070ddd196ec212bc45f15ea098c7148b05b2e9..94e9213414ec08794e875c23c300bfae5dcc877e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -174,6 +174,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return this;
|
||||
}
|
||||
|
||||
+ // Paper start - support removing component types
|
||||
+ <T> Applicator remove(DataComponentType<T> type) {
|
||||
+ this.builder.remove(type);
|
||||
+ return this;
|
||||
+ }
|
||||
+ // Paper end - support removing component types
|
||||
+
|
||||
DataComponentPatch build() {
|
||||
return this.builder.build();
|
||||
}
|
||||
@@ -380,7 +387,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
Set<Map.Entry<DataComponentType<?>, Optional<?>>> keys = tag.entrySet();
|
||||
for (Map.Entry<DataComponentType<?>, Optional<?>> key : keys) {
|
||||
- if (!CraftMetaItem.getHandledTags().contains(key.getKey())) {
|
||||
+ if (key.getValue().isEmpty()) {
|
||||
+ this.unhandledTags.remove(key.getKey());
|
||||
+ } else if (!CraftMetaItem.getHandledTags().contains(key.getKey())) {
|
||||
key.getValue().ifPresentOrElse((value) -> {
|
||||
this.unhandledTags.set((DataComponentType) key.getKey(), value);
|
||||
}, () -> {
|
||||
@@ -778,9 +787,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
}
|
||||
|
||||
for (Map.Entry<DataComponentType<?>, Optional<?>> e : this.unhandledTags.build().entrySet()) {
|
||||
- e.getValue().ifPresent((value) -> {
|
||||
+ e.getValue().ifPresentOrElse((value) -> {
|
||||
itemTag.builder.set((DataComponentType) e.getKey(), value);
|
||||
- });
|
||||
+ }, () -> itemTag.remove(e.getKey()));
|
||||
}
|
||||
|
||||
if (!this.persistentDataContainer.isEmpty()) {
|
218
patches/server/1042-Add-experimental-improved-give-command.patch
Normal file
218
patches/server/1042-Add-experimental-improved-give-command.patch
Normal file
@ -0,0 +1,218 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 26 Apr 2024 23:15:27 -0700
|
||||
Subject: [PATCH] Add experimental improved give command
|
||||
|
||||
Supports removing data components from itemstacks
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/arguments/item/ItemArgument.java b/src/main/java/net/minecraft/commands/arguments/item/ItemArgument.java
|
||||
index d76296c6d53065aecb010d8ea682c9acd7365f17..4c3749deebb7d5c35f3977814f1d7b0307198b1e 100644
|
||||
--- a/src/main/java/net/minecraft/commands/arguments/item/ItemArgument.java
|
||||
+++ b/src/main/java/net/minecraft/commands/arguments/item/ItemArgument.java
|
||||
@@ -16,7 +16,12 @@ public class ItemArgument implements ArgumentType<ItemInput> {
|
||||
private final ItemParser parser;
|
||||
|
||||
public ItemArgument(CommandBuildContext commandRegistryAccess) {
|
||||
- this.parser = new ItemParser(commandRegistryAccess);
|
||||
+ // Paper start - support component removals
|
||||
+ this(commandRegistryAccess, false);
|
||||
+ }
|
||||
+ public ItemArgument(CommandBuildContext commandRegistryAccess, boolean allowRemovals) {
|
||||
+ this.parser = new ItemParser(commandRegistryAccess, allowRemovals);
|
||||
+ // Paper end - support component removals
|
||||
}
|
||||
|
||||
public static ItemArgument item(CommandBuildContext commandRegistryAccess) {
|
||||
diff --git a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java b/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
|
||||
index 3d24fbca90bc7d8bdbac1be2176555c15ae75039..94ea5f0b1913ffa03794d231a6768dd786dc9697 100644
|
||||
--- a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
|
||||
+++ b/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
|
||||
@@ -25,8 +25,15 @@ public class ItemInput {
|
||||
);
|
||||
private final Holder<Item> item;
|
||||
private final DataComponentMap components;
|
||||
+ @javax.annotation.Nullable private final net.minecraft.core.component.DataComponentPatch patch; // Paper
|
||||
|
||||
public ItemInput(Holder<Item> item, DataComponentMap components) {
|
||||
+ // Paper start
|
||||
+ this(item, components, null);
|
||||
+ }
|
||||
+ public ItemInput(Holder<Item> item, DataComponentMap components, @javax.annotation.Nullable final net.minecraft.core.component.DataComponentPatch patch) {
|
||||
+ this.patch = patch;
|
||||
+ // Paper end
|
||||
this.item = item;
|
||||
this.components = components;
|
||||
}
|
||||
@@ -37,7 +44,13 @@ public class ItemInput {
|
||||
|
||||
public ItemStack createItemStack(int amount, boolean checkOverstack) throws CommandSyntaxException {
|
||||
ItemStack itemStack = new ItemStack(this.item, amount);
|
||||
- itemStack.applyComponents(this.components);
|
||||
+ // Paper start - support component removals
|
||||
+ if (this.patch != null) {
|
||||
+ itemStack.applyComponents(this.patch);
|
||||
+ } else {
|
||||
+ itemStack.applyComponents(this.components);
|
||||
+ }
|
||||
+ // Paper end - support component removals
|
||||
if (checkOverstack && amount > itemStack.getMaxStackSize()) {
|
||||
throw ERROR_STACK_TOO_BIG.create(this.getItemName(), itemStack.getMaxStackSize());
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/commands/arguments/item/ItemParser.java b/src/main/java/net/minecraft/commands/arguments/item/ItemParser.java
|
||||
index 5347a96be3bfbbd2963747ba4b5f222215d80371..f306c27f3242084f2cc39393e302bbdd0b228db2 100644
|
||||
--- a/src/main/java/net/minecraft/commands/arguments/item/ItemParser.java
|
||||
+++ b/src/main/java/net/minecraft/commands/arguments/item/ItemParser.java
|
||||
@@ -59,8 +59,15 @@ public class ItemParser {
|
||||
static final Function<SuggestionsBuilder, CompletableFuture<Suggestions>> SUGGEST_NOTHING = SuggestionsBuilder::buildFuture;
|
||||
final HolderLookup.RegistryLookup<Item> items;
|
||||
final DynamicOps<Tag> registryOps;
|
||||
+ final boolean allowRemoves; // Paper - support component removals
|
||||
|
||||
public ItemParser(HolderLookup.Provider registriesLookup) {
|
||||
+ // Paper start - support component removals
|
||||
+ this(registriesLookup, false);
|
||||
+ }
|
||||
+ public ItemParser(HolderLookup.Provider registriesLookup, boolean allowRemoves) {
|
||||
+ this.allowRemoves = allowRemoves;
|
||||
+ // Paper end - support component removals
|
||||
this.items = registriesLookup.lookupOrThrow(Registries.ITEM);
|
||||
this.registryOps = registriesLookup.createSerializationContext(NbtOps.INSTANCE);
|
||||
}
|
||||
@@ -68,6 +75,7 @@ public class ItemParser {
|
||||
public ItemParser.ItemResult parse(StringReader reader) throws CommandSyntaxException {
|
||||
final MutableObject<Holder<Item>> mutableObject = new MutableObject<>();
|
||||
final DataComponentMap.Builder builder = DataComponentMap.builder();
|
||||
+ final net.minecraft.core.component.DataComponentPatch.Builder patchBuilder = net.minecraft.core.component.DataComponentPatch.builder(); // Paper - support component removals
|
||||
this.parse(reader, new ItemParser.Visitor() {
|
||||
@Override
|
||||
public void visitItem(Holder<Item> item) {
|
||||
@@ -77,12 +85,19 @@ public class ItemParser {
|
||||
@Override
|
||||
public <T> void visitComponent(DataComponentType<T> type, T value) {
|
||||
builder.set(type, value);
|
||||
+ // Paper start - support component removals
|
||||
+ patchBuilder.set(type, value);
|
||||
+ }
|
||||
+ @Override
|
||||
+ public <T> void visitComponentRemove(final DataComponentType<T> type) {
|
||||
+ patchBuilder.remove(type);
|
||||
+ // Paper end - support component removals
|
||||
}
|
||||
});
|
||||
Holder<Item> holder = Objects.requireNonNull(mutableObject.getValue(), "Parser gave no item");
|
||||
DataComponentMap dataComponentMap = builder.build();
|
||||
validateComponents(reader, holder, dataComponentMap);
|
||||
- return new ItemParser.ItemResult(holder, dataComponentMap);
|
||||
+ return new ItemParser.ItemResult(holder, dataComponentMap, this.allowRemoves ? patchBuilder.build() : null); // Paper - support component removals
|
||||
}
|
||||
|
||||
private static void validateComponents(StringReader reader, Holder<Item> item, DataComponentMap components) throws CommandSyntaxException {
|
||||
@@ -116,7 +131,7 @@ public class ItemParser {
|
||||
return suggestionsVisitor.resolveSuggestions(builder, stringReader);
|
||||
}
|
||||
|
||||
- public static record ItemResult(Holder<Item> item, DataComponentMap components) {
|
||||
+ public static record ItemResult(Holder<Item> item, DataComponentMap components, @javax.annotation.Nullable net.minecraft.core.component.DataComponentPatch patch) { // Paper
|
||||
}
|
||||
|
||||
class State {
|
||||
@@ -154,17 +169,28 @@ public class ItemParser {
|
||||
|
||||
while (this.reader.canRead() && this.reader.peek() != ']') {
|
||||
this.reader.skipWhitespace();
|
||||
+ boolean removing = ItemParser.this.allowRemoves && this.reader.canRead() && this.reader.peek() == '!';
|
||||
+ if (removing) {
|
||||
+ this.reader.skip();
|
||||
+ this.visitor.visitSuggestions(builder -> this.suggestComponentAssignment(builder, false));
|
||||
+ }
|
||||
DataComponentType<?> dataComponentType = readComponentType(this.reader);
|
||||
if (!set.add(dataComponentType)) {
|
||||
throw ItemParser.ERROR_REPEATED_COMPONENT.create(dataComponentType);
|
||||
}
|
||||
|
||||
+ // Paper start - support component removals
|
||||
+ if (removing) {
|
||||
+ this.visitor.visitComponentRemove(dataComponentType);
|
||||
+ } else {
|
||||
+ // Paper end - support component removals
|
||||
this.visitor.visitSuggestions(this::suggestAssignment);
|
||||
this.reader.skipWhitespace();
|
||||
this.reader.expect('=');
|
||||
this.visitor.visitSuggestions(ItemParser.SUGGEST_NOTHING);
|
||||
this.reader.skipWhitespace();
|
||||
this.readComponent(dataComponentType);
|
||||
+ } // Paper - support component removals
|
||||
this.reader.skipWhitespace();
|
||||
this.visitor.visitSuggestions(this::suggestNextOrEndComponents);
|
||||
if (!this.reader.canRead() || this.reader.peek() != ',') {
|
||||
@@ -239,12 +265,18 @@ public class ItemParser {
|
||||
}
|
||||
|
||||
private CompletableFuture<Suggestions> suggestComponentAssignment(SuggestionsBuilder builder) {
|
||||
+ // Paper start - support component removals
|
||||
+ return this.suggestComponentAssignment(builder, true);
|
||||
+ }
|
||||
+ private CompletableFuture<Suggestions> suggestComponentAssignment(SuggestionsBuilder builder, boolean suggestRemove) {
|
||||
+ if (suggestRemove) builder.suggest("!", Component.literal("Remove a data component"));
|
||||
+ // Paper end - support component removals
|
||||
String string = builder.getRemaining().toLowerCase(Locale.ROOT);
|
||||
SharedSuggestionProvider.filterResources(BuiltInRegistries.DATA_COMPONENT_TYPE.entrySet(), string, entry -> entry.getKey().location(), entry -> {
|
||||
DataComponentType<?> dataComponentType = entry.getValue();
|
||||
if (dataComponentType.codec() != null) {
|
||||
ResourceLocation resourceLocation = entry.getKey().location();
|
||||
- builder.suggest(resourceLocation.toString() + "=");
|
||||
+ builder.suggest(resourceLocation.toString() + (suggestRemove ? "=" : "")); // Paper - support component removals
|
||||
}
|
||||
});
|
||||
return builder.buildFuture();
|
||||
@@ -270,6 +302,7 @@ public class ItemParser {
|
||||
|
||||
default <T> void visitComponent(DataComponentType<T> type, T value) {
|
||||
}
|
||||
+ default <T> void visitComponentRemove(DataComponentType<T> type) {} // Paper
|
||||
|
||||
default void visitSuggestions(Function<SuggestionsBuilder, CompletableFuture<Suggestions>> suggestor) {
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
index 0d9de4c61c7b26a6ff37c12fde629161fd0c3d5a..c738bbfa73888a0caed507e02f5c113f681e5cc2 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -34,6 +34,38 @@ public class GiveCommand {
|
||||
})).then(net.minecraft.commands.Commands.argument("count", IntegerArgumentType.integer(1)).executes((commandcontext) -> {
|
||||
return GiveCommand.giveItem((CommandSourceStack) commandcontext.getSource(), ItemArgument.getItem(commandcontext, "item"), EntityArgument.getPlayers(commandcontext, "targets"), IntegerArgumentType.getInteger(commandcontext, "count"));
|
||||
})))));
|
||||
+ // Paper start - support component removals with a custom pgive command
|
||||
+ final com.mojang.brigadier.tree.CommandNode<net.minecraft.commands.CommandSourceStack> node = net.minecraft.commands.Commands
|
||||
+ .literal("pgive").requires((commandlistenerwrapper) -> commandlistenerwrapper.hasPermission(2))
|
||||
+ .then(net.minecraft.commands.Commands.argument("targets", EntityArgument.players())
|
||||
+ .then(net.minecraft.commands.Commands.argument("item", new ItemArgument(commandRegistryAccess, true)).executes((commandcontext) -> {
|
||||
+ return GiveCommand.giveItem((CommandSourceStack) commandcontext.getSource(), ItemArgument.getItem(commandcontext, "item"), EntityArgument.getPlayers(commandcontext, "targets"), 1);
|
||||
+ })
|
||||
+ .then(net.minecraft.commands.Commands.argument("count", IntegerArgumentType.integer(1)).executes((commandcontext) -> {
|
||||
+ return GiveCommand.giveItem((CommandSourceStack) commandcontext.getSource(), ItemArgument.getItem(commandcontext, "item"), EntityArgument.getPlayers(commandcontext, "targets"), IntegerArgumentType.getInteger(commandcontext, "count"));
|
||||
+ }))
|
||||
+ )
|
||||
+ ).build();
|
||||
+ setClientNodes(node);
|
||||
+ dispatcher.getRoot().addChild(node);
|
||||
+ }
|
||||
+ static void setClientNodes(com.mojang.brigadier.tree.CommandNode<net.minecraft.commands.CommandSourceStack> node) {
|
||||
+ if (node instanceof com.mojang.brigadier.tree.ArgumentCommandNode<net.minecraft.commands.CommandSourceStack,?> argumentNode) {
|
||||
+ if (argumentNode.getType() instanceof ItemArgument) {
|
||||
+ node.clientNode = new com.mojang.brigadier.tree.ArgumentCommandNode<>(
|
||||
+ argumentNode.getName(),
|
||||
+ com.mojang.brigadier.arguments.StringArgumentType.greedyString(),
|
||||
+ argumentNode.getCommand(),
|
||||
+ argumentNode.getRequirement(),
|
||||
+ argumentNode.getRedirect(),
|
||||
+ argumentNode.getRedirectModifier(),
|
||||
+ argumentNode.isFork(),
|
||||
+ (ctx, builder) -> builder.buildFuture()
|
||||
+ );
|
||||
+ }
|
||||
+ }
|
||||
+ node.getChildren().forEach(GiveCommand::setClientNodes);
|
||||
+ // Paper end - support component removals with a custom pgive command
|
||||
}
|
||||
|
||||
private static int giveItem(CommandSourceStack source, ItemInput item, Collection<ServerPlayer> targets, int count) throws CommandSyntaxException {
|
Loading…
Reference in New Issue
Block a user