Skip to content

Commit

Permalink
Add FeatureFlag API (#8952)
Browse files Browse the repository at this point in the history
* Add FeatureFlag API

* switch to index & move method

* fix test
  • Loading branch information
Machine-Maker authored Sep 7, 2024
1 parent a8e6a93 commit 925c3b9
Show file tree
Hide file tree
Showing 4 changed files with 762 additions and 10 deletions.
40 changes: 32 additions & 8 deletions patches/api/0270-Add-basic-Datapack-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f7
+
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index b558fa73dbcf3747690933e6aadf7061a0de2630..8a22c242a93b0e16e0bca583d0918bab695248b1 100644
index b558fa73dbcf3747690933e6aadf7061a0de2630..be68351555bde59a4e55bf1bad261e9f6bc9f704 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -328,9 +328,11 @@ public final class Bukkit {
Expand All @@ -81,7 +81,7 @@ index b558fa73dbcf3747690933e6aadf7061a0de2630..8a22c242a93b0e16e0bca583d0918bab
* @return the manager
*/
@NotNull
+ @Deprecated(forRemoval = true)
+ @Deprecated(forRemoval = true, since = "1.20")
public static DataPackManager getDataPackManager() {
return server.getDataPackManager();
}
Expand All @@ -100,8 +100,20 @@ index b558fa73dbcf3747690933e6aadf7061a0de2630..8a22c242a93b0e16e0bca583d0918bab
// Paper end

@NotNull
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index cc25734f3dcf6075eb44e39da01ed2f1b59b618e..2721ad40d6ba025caad16455f74f2350dcb7a4ff 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -5497,6 +5497,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
* @param world the world to check
* @return true if this material can be used in this World.
*/
+ @Deprecated(forRemoval = true, since = "1.20") // Paper
public boolean isEnabledByFeature(@NotNull World world) {
if (isItem()) {
return Bukkit.getDataPackManager().isEnabledByFeature(asItemType(), world);
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 42930006b6425b5d82233e4ffe7025ce5397b277..67b5cb7635c4251c259b1fb1ef50f99a0b2647e5 100644
index 42930006b6425b5d82233e4ffe7025ce5397b277..45693e6c02eac37eb609cd3c59253a949a6ca4c0 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -267,9 +267,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
Expand All @@ -112,7 +124,7 @@ index 42930006b6425b5d82233e4ffe7025ce5397b277..67b5cb7635c4251c259b1fb1ef50f99a
* @return the manager
*/
@NotNull
+ @Deprecated(forRemoval = true) // Paper
+ @Deprecated(forRemoval = true, since = "1.20") // Paper
public DataPackManager getDataPackManager();

/**
Expand All @@ -128,8 +140,20 @@ index 42930006b6425b5d82233e4ffe7025ce5397b277..67b5cb7635c4251c259b1fb1ef50f99a
+ io.papermc.paper.datapack.DatapackManager getDatapackManager();
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
index 976f701ed9b9873945a5628173c580e2e6873864..eea0351559a2835280713f5d5d1d430c7cf857a0 100644
--- a/src/main/java/org/bukkit/entity/EntityType.java
+++ b/src/main/java/org/bukkit/entity/EntityType.java
@@ -449,6 +449,7 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans
* @param world the world to check
* @return true if this EntityType can be used to spawn an Entity for this World.
*/
+ @Deprecated(forRemoval = true, since = "1.20") // Paper
public boolean isEnabledByFeature(@NotNull World world) {
return Bukkit.getDataPackManager().isEnabledByFeature(this, world);
}
diff --git a/src/main/java/org/bukkit/packs/DataPack.java b/src/main/java/org/bukkit/packs/DataPack.java
index ea03c51d51e015e69d3aaa795547033ceabff9e0..419f6bdbec5dc1c731fb0f93816a90f58a329021 100644
index ea03c51d51e015e69d3aaa795547033ceabff9e0..f51d59e6369c76e333fd9e58e711c2b6f245882d 100644
--- a/src/main/java/org/bukkit/packs/DataPack.java
+++ b/src/main/java/org/bukkit/packs/DataPack.java
@@ -9,7 +9,9 @@ import org.jetbrains.annotations.NotNull;
Expand All @@ -138,12 +162,12 @@ index ea03c51d51e015e69d3aaa795547033ceabff9e0..419f6bdbec5dc1c731fb0f93816a90f5
* @see <a href="https://minecraft.wiki/w/Data_pack">Minecraft wiki</a>
+ * @deprecated use {@link io.papermc.paper.datapack.Datapack}
*/
+@Deprecated(forRemoval = true) // Paper
+@Deprecated(forRemoval = true, since = "1.20") // Paper
public interface DataPack extends Keyed {

/**
diff --git a/src/main/java/org/bukkit/packs/DataPackManager.java b/src/main/java/org/bukkit/packs/DataPackManager.java
index aee6e828c6fac9b010356af1239a58b4579c1773..7d3694efc21c7bc3784207735bdd9fb27e69988a 100644
index aee6e828c6fac9b010356af1239a58b4579c1773..1b850e76a885f0da653d4b48db72e5f85ae72805 100644
--- a/src/main/java/org/bukkit/packs/DataPackManager.java
+++ b/src/main/java/org/bukkit/packs/DataPackManager.java
@@ -13,7 +13,9 @@ import org.jetbrains.annotations.Nullable;
Expand All @@ -152,7 +176,7 @@ index aee6e828c6fac9b010356af1239a58b4579c1773..7d3694efc21c7bc3784207735bdd9fb2
* Manager of data packs.
+ * @deprecated use {@link io.papermc.paper.datapack.DatapackManager}
*/
+@Deprecated(forRemoval = true) // Paper
+@Deprecated(forRemoval = true, since = "1.20") // Paper
public interface DataPackManager {

/**
Loading

0 comments on commit 925c3b9

Please sign in to comment.