Readd last API patch (with TODO)
This commit is contained in:
parent
bcf52fe5fd
commit
348c855096
301 changed files with 42 additions and 44 deletions
169
patches/api/0400-API-for-updating-recipes-on-clients.patch
Normal file
169
patches/api/0400-API-for-updating-recipes-on-clients.patch
Normal file
|
@ -0,0 +1,169 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 17:25:54 -0700
|
||||
Subject: [PATCH] API for updating recipes on clients
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 50efe16bb80c618c3dfae03b70c8c165183af8ec..52c601328bbf5c1642aa620c8bb466a9d2d231be 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1004,6 +1004,26 @@ public final class Bukkit {
|
||||
server.reloadData();
|
||||
}
|
||||
|
||||
+ // Paper start - update reloadable data
|
||||
+ /**
|
||||
+ * Updates all advancement, tag, and recipe data for all connected clients.
|
||||
+ * Useful for updating clients to new advancements/recipes/tags.
|
||||
+ * @see #updateRecipes()
|
||||
+ */
|
||||
+ public static void updateResources() {
|
||||
+ server.updateResources();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Updates recipe data and the recipe book for all connected clients. Useful for
|
||||
+ * updating clients to new recipes.
|
||||
+ * @see #updateResources()
|
||||
+ */
|
||||
+ public static void updateRecipes() {
|
||||
+ server.updateRecipes();
|
||||
+ }
|
||||
+ // Paper end - update reloadable data
|
||||
+
|
||||
/**
|
||||
* Returns the primary logger associated with this server instance.
|
||||
*
|
||||
@@ -1064,6 +1084,20 @@ public final class Bukkit {
|
||||
return server.addRecipe(recipe);
|
||||
}
|
||||
|
||||
+ // Paper start - method to send recipes immediately
|
||||
+ /**
|
||||
+ * Adds a recipe to the crafting manager.
|
||||
+ *
|
||||
+ * @param recipe the recipe to add
|
||||
+ * @param resendRecipes true to update the client with the full set of recipes
|
||||
+ * @return true if the recipe was added, false if it wasn't for some reason
|
||||
+ */
|
||||
+ @Contract("null, _ -> false")
|
||||
+ public static boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes) {
|
||||
+ return server.addRecipe(recipe, resendRecipes);
|
||||
+ }
|
||||
+ // Paper end - method to send recipes immediately
|
||||
+
|
||||
/**
|
||||
* Get a list of all recipes for a given item. The stack size is ignored
|
||||
* in comparisons. If the durability is -1, it will match any data value.
|
||||
@@ -1255,6 +1289,24 @@ public final class Bukkit {
|
||||
return server.removeRecipe(key);
|
||||
}
|
||||
|
||||
+ // Paper start - method to resend recipes
|
||||
+ /**
|
||||
+ * Remove a recipe from the server.
|
||||
+ * <p>
|
||||
+ * <b>Note that removing a recipe may cause permanent loss of data
|
||||
+ * associated with that recipe (eg whether it has been discovered by
|
||||
+ * players).</b>
|
||||
+ *
|
||||
+ * @param key NamespacedKey of recipe to remove.
|
||||
+ * @param resendRecipes true to update all clients on the new recipe list.
|
||||
+ * Will only update if a recipe was actually removed
|
||||
+ * @return True if recipe was removed
|
||||
+ */
|
||||
+ public static boolean removeRecipe(@NotNull NamespacedKey key, boolean resendRecipes) {
|
||||
+ return server.removeRecipe(key, resendRecipes);
|
||||
+ }
|
||||
+ // Paper end - method to resend recipes
|
||||
+
|
||||
/**
|
||||
* Gets a list of command aliases defined in the server properties.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 1b8d6a3333a4fa9155b79644e683e2343c134e12..8ba2fbaab7428a42b506fd000fbc162f68ddaed1 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -853,6 +853,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public void reloadData();
|
||||
|
||||
+ // Paper start - update reloadable data
|
||||
+ /**
|
||||
+ * Updates all advancement, tag, and recipe data to all connected clients.
|
||||
+ * Useful for updating clients to new advancements/recipes/tags.
|
||||
+ * @see #updateRecipes()
|
||||
+ */
|
||||
+ void updateResources();
|
||||
+
|
||||
+ /**
|
||||
+ * Updates recipe data and the recipe book to each player. Useful for
|
||||
+ * updating clients to new recipes.
|
||||
+ * @see #updateResources()
|
||||
+ */
|
||||
+ void updateRecipes();
|
||||
+ // Paper end - update reloadable data
|
||||
+
|
||||
/**
|
||||
* Returns the primary logger associated with this server instance.
|
||||
*
|
||||
@@ -894,15 +910,34 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
public boolean dispatchCommand(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException;
|
||||
|
||||
/**
|
||||
- * Adds a recipe to the crafting manager.
|
||||
+ * Adds a recipe to the crafting manager. Recipes added with
|
||||
+ * this method won't be sent to the client automatically. Use
|
||||
+ * {@link #updateRecipes()} or {@link #updateResources()} to
|
||||
+ * update clients to new recipes added.
|
||||
+ * <p>
|
||||
+ * Player's still have to discover recipes via {@link Player#discoverRecipe(NamespacedKey)}
|
||||
+ * before seeing them in their recipe book.
|
||||
*
|
||||
* @param recipe the recipe to add
|
||||
* @return true if the recipe was added, false if it wasn't for some
|
||||
* reason
|
||||
+ * @see #addRecipe(Recipe, boolean)
|
||||
*/
|
||||
@Contract("null -> false")
|
||||
public boolean addRecipe(@Nullable Recipe recipe);
|
||||
|
||||
+ // Paper start - method to send recipes immediately
|
||||
+ /**
|
||||
+ * Adds a recipe to the crafting manager.
|
||||
+ *
|
||||
+ * @param recipe the recipe to add
|
||||
+ * @param resendRecipes true to update the client with the full set of recipes
|
||||
+ * @return true if the recipe was added, false if it wasn't for some reason
|
||||
+ */
|
||||
+ @Contract("null, _ -> false")
|
||||
+ boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes);
|
||||
+ // Paper end - method to send recipes immediately
|
||||
+
|
||||
/**
|
||||
* Get a list of all recipes for a given item. The stack size is ignored
|
||||
* in comparisons. If the durability is -1, it will match any data value.
|
||||
@@ -1071,6 +1106,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public boolean removeRecipe(@NotNull NamespacedKey key);
|
||||
|
||||
+ // Paper start - method to resend recipes
|
||||
+ /**
|
||||
+ * Remove a recipe from the server.
|
||||
+ * <p>
|
||||
+ * <b>Note that removing a recipe may cause permanent loss of data
|
||||
+ * associated with that recipe (eg whether it has been discovered by
|
||||
+ * players).</b>
|
||||
+ *
|
||||
+ * @param key NamespacedKey of recipe to remove.
|
||||
+ * @param resendRecipes true to update all clients on the new recipe list.
|
||||
+ * Will only update if a recipe was actually removed
|
||||
+ * @return True if recipe was removed
|
||||
+ */
|
||||
+ boolean removeRecipe(@NotNull NamespacedKey key, boolean resendRecipes);
|
||||
+ // Paper end - method to resend recipes
|
||||
+
|
||||
/**
|
||||
* Gets a list of command aliases defined in the server properties.
|
||||
*
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 50efe16bb80c618c3dfae03b70c8c165183af8ec..85ad1f7f0de9a6f9048981c3ee509b42ddbeef1a 100644
|
||||
index 52c601328bbf5c1642aa620c8bb466a9d2d231be..c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -949,9 +949,6 @@ public final class Bukkit {
|
||||
|
@ -84,7 +84,7 @@ index 50efe16bb80c618c3dfae03b70c8c165183af8ec..85ad1f7f0de9a6f9048981c3ee509b42
|
|||
/**
|
||||
* Reloads the server, refreshing settings and plugin information.
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 1b8d6a3333a4fa9155b79644e683e2343c134e12..640ef81d204f480f4af83d420c7e968ce569a38d 100644
|
||||
index 8ba2fbaab7428a42b506fd000fbc162f68ddaed1..50ffca9bccfb582d58ccb13f0decf66e5d91aef3 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -817,16 +817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
@ -70,10 +70,10 @@ index a77c0411a68a9bad33ddfb335b7a996a843e478c..739d9d3ec789e58c10c8d818a9ca59ce
|
|||
/**
|
||||
* Banned player names
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 85ad1f7f0de9a6f9048981c3ee509b42ddbeef1a..2d466b308b2f8bd31c50f5d05416eadf20c9cb71 100644
|
||||
index c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2..e20e4239a5a1f952e1c70e899549989d5e42f73c 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1611,11 +1611,27 @@ public final class Bukkit {
|
||||
@@ -1663,11 +1663,27 @@ public final class Bukkit {
|
||||
* @param <T> The ban target
|
||||
*
|
||||
* @return a ban list of the specified type
|
||||
|
@ -102,10 +102,10 @@ index 85ad1f7f0de9a6f9048981c3ee509b42ddbeef1a..2d466b308b2f8bd31c50f5d05416eadf
|
|||
/**
|
||||
* Gets a set containing all player operators.
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 640ef81d204f480f4af83d420c7e968ce569a38d..20750c09d819d62f32491db8672936b929e1098e 100644
|
||||
index 50ffca9bccfb582d58ccb13f0decf66e5d91aef3..6246251caf2c6f025c824b8e7a944b8d48751fa1 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1374,10 +1374,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -1425,10 +1425,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @param <T> The ban target
|
||||
*
|
||||
* @return a ban list of the specified type
|
Loading…
Add table
Add a link
Reference in a new issue