From 7c5b21d9d3347037c5e29aaca1bdce3e57a93e3f Mon Sep 17 00:00:00 2001 From: Riley Park Date: Fri, 4 Mar 2022 13:19:57 -0800 Subject: [PATCH] Move Adventure patch up --- ...-option-to-load-extra-plugin-jars-no.patch | 2 +- patches/api/Adventure.patch | 59 ++----------------- patches/api/Timings-v2.patch | 34 ++++++++--- patches/server/Adventure.patch | 4 +- ...ading-permissions.yml-before-plugins.patch | 4 +- patches/server/Timings-v2.patch | 4 +- 6 files changed, 37 insertions(+), 70 deletions(-) diff --git a/patches/api/Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/api/Add-command-line-option-to-load-extra-plugin-jars-no.patch index eda518a0a1..f2da7dc7ab 100644 --- a/patches/api/Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ b/patches/api/Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/Server.java @@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; */ - public interface Server extends PluginMessageRecipient { + public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper + /** + * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded, diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 24108e5f47..da5eb72563 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -75,37 +75,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // workaround for https://github.com/gradle/gradle/issues/4046 inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset") doLast { -diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/co/aikar/timings/TimingsReportListener.java -+++ b/src/main/java/co/aikar/timings/TimingsReportListener.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - - @SuppressWarnings("WeakerAccess") --public class TimingsReportListener implements MessageCommandSender { -+public class TimingsReportListener implements net.kyori.adventure.audience.ForwardingAudience, MessageCommandSender { // Paper - private final List senders; - private final Runnable onDone; - private String timingsURL; -@@ -0,0 +0,0 @@ public class TimingsReportListener implements MessageCommandSender { - this.senders.add(Bukkit.getConsoleSender()); - } - } -+ -+ // Paper start -+ @Override -+ public void sendMessage(final @NotNull net.kyori.adventure.identity.Identity source, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { -+ net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type); -+ } -+ -+ @NotNull -+ @Override -+ public Iterable audiences() { -+ return this.senders; -+ } -+ // Paper end - } diff --git a/src/main/java/io/papermc/paper/chat/ChatRenderer.java b/src/main/java/io/papermc/paper/chat/ChatRenderer.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -844,8 +813,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper /** - * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded, -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { * Used for all administrative messages, such as an operator using a * command. *

@@ -1149,8 +1116,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); + // Paper end - void reportTimings(); // Paper Material toLegacy(Material material); + diff --git a/src/main/java/org/bukkit/Warning.java b/src/main/java/org/bukkit/Warning.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Warning.java @@ -1317,10 +1284,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected String usageMessage; private String permission; - private String permissionMessage; +- public org.spigotmc.CustomTimingsHandler timings; // Spigot + private net.kyori.adventure.text.Component permissionMessage; // Paper - public co.aikar.timings.Timing timings; // Paper - @NotNull public String getTimingName() {return getName();} // Paper + protected Command(@NotNull String name) { + this(name, "", "/" + name, new ArrayList()); @@ -0,0 +0,0 @@ public abstract class Command { if (permissionMessage == null) { @@ -1492,23 +1460,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } -diff --git a/src/main/java/org/bukkit/command/MessageCommandSender.java b/src/main/java/org/bukkit/command/MessageCommandSender.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/MessageCommandSender.java -+++ b/src/main/java/org/bukkit/command/MessageCommandSender.java -@@ -0,0 +0,0 @@ public interface MessageCommandSender extends CommandSender { - default String getName() { - throw new NotImplementedException(); - } -+ // Paper start -+ @Override -+ default net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component name() { -+ throw new NotImplementedException(); -+ } -+ // Paper end - - @Override - default boolean isOp() { diff --git a/src/main/java/org/bukkit/command/PluginCommandYamlParser.java b/src/main/java/org/bukkit/command/PluginCommandYamlParser.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/command/PluginCommandYamlParser.java @@ -2166,7 +2117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Deprecated // Paper public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) { throw new UnsupportedOperationException("Not supported yet."); - + } diff --git a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java diff --git a/patches/api/Timings-v2.patch b/patches/api/Timings-v2.patch index 88c7cc9b84..457577c6be 100644 --- a/patches/api/Timings-v2.patch +++ b/patches/api/Timings-v2.patch @@ -1893,13 +1893,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.command.RemoteConsoleCommandSender; + +import java.util.List; -+import java.util.UUID; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@SuppressWarnings("WeakerAccess") -+public class TimingsReportListener implements MessageCommandSender { ++public class TimingsReportListener implements net.kyori.adventure.audience.ForwardingAudience, MessageCommandSender { + private final List senders; + private final Runnable onDone; + private String timingsURL; @@ -1943,6 +1942,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override ++ public void sendMessage(final @NotNull net.kyori.adventure.identity.Identity source, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { ++ net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type); ++ } ++ ++ @NotNull ++ @Override ++ public Iterable audiences() { ++ return this.senders; ++ } ++ ++ @Override + public void sendMessage(@NotNull String message) { + senders.forEach((sender) -> sender.sendMessage(message)); + } @@ -2797,7 +2807,7 @@ diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Ser index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { +@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi throw new UnsupportedOperationException("Not supported yet."); } @@ -2828,9 +2838,9 @@ diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukk index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ import org.bukkit.plugin.PluginDescriptionFile; - @Deprecated - public interface UnsafeValues { +@@ -0,0 +0,0 @@ public interface UnsafeValues { + net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); + // Paper end + void reportTimings(); // Paper Material toLegacy(Material material); @@ -2883,8 +2893,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class Command { protected String usageMessage; private String permission; - private String permissionMessage; -- public org.spigotmc.CustomTimingsHandler timings; // Spigot + private net.kyori.adventure.text.Component permissionMessage; // Paper + public co.aikar.timings.Timing timings; // Paper + @NotNull public String getTimingName() {return getName();} // Paper @@ -2981,6 +2990,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return Bukkit.getServer(); + } + ++ // Paper start ++ @Override ++ default net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component name() { ++ throw new NotImplementedException(); ++ } ++ // Paper end ++ + @NotNull + @Override + default String getName() { @@ -3381,7 +3397,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ + @Deprecated // Paper public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) { throw new UnsupportedOperationException("Not supported yet."); + diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index e5b48a8d82..8ebb18b12c 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { - " - Length: " + timeSummary(Timings.getHistoryLength() / 20) + - " - Server Name: " + timingsServerName); + config.addDefault(path, def); + return config.getString(path, config.getString(path)); } + + public static boolean useDisplayNameInQuit = false; diff --git a/patches/server/Default-loading-permissions.yml-before-plugins.patch b/patches/server/Default-loading-permissions.yml-before-plugins.patch index a77670b1a3..ea7996f93d 100644 --- a/patches/server/Default-loading-permissions.yml-before-plugins.patch +++ b/patches/server/Default-loading-permissions.yml-before-plugins.patch @@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { - } - useDisplayNameInQuit = getBoolean("settings.use-display-name-in-quit-message", useDisplayNameInQuit); + " - Length: " + timeSummary(Timings.getHistoryLength() / 20) + + " - Server Name: " + timingsServerName); } + + public static boolean loadPermsBeforePlugins = true; diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch index 2ebd053190..bfe95f09a8 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -689,8 +689,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class PaperConfig { @@ -0,0 +0,0 @@ public class PaperConfig { - config.addDefault(path, def); - return config.getString(path, config.getString(path)); + } + useDisplayNameInQuit = getBoolean("settings.use-display-name-in-quit-message", useDisplayNameInQuit); } + + public static String timingsServerName;