PaperMC/patches/api/0491-move-methods-to-DiscoveredDatapack.patch

163 lines
4.6 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 23 Sep 2024 16:04:31 -0700
Subject: [PATCH] move methods to DiscoveredDatapack
diff --git a/src/main/java/io/papermc/paper/datapack/Datapack.java b/src/main/java/io/papermc/paper/datapack/Datapack.java
index 436606dd81ff666d8378c41f45bbb6a674a477dd..073eaecc77c372c9d73a11a1e374be181d2de353 100644
--- a/src/main/java/io/papermc/paper/datapack/Datapack.java
+++ b/src/main/java/io/papermc/paper/datapack/Datapack.java
@@ -1,60 +1,16 @@
package io.papermc.paper.datapack;
-import java.util.Set;
import net.kyori.adventure.text.Component;
-import org.bukkit.FeatureFlag;
import org.checkerframework.checker.nullness.qual.NonNull;
+import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
-import org.jetbrains.annotations.Unmodifiable;
/**
* This is a snapshot of a datapack on the server. It
* won't be updated as datapacks are updated.
*/
-public interface Datapack {
-
- /**
- * Gets the name/id of this datapack.
- *
- * @return the name of the pack
- */
- @Contract(pure = true)
- @NonNull String getName();
-
- /**
- * Gets the title component of this datapack.
- *
- * @return the title
- */
- @NonNull Component getTitle();
-
- /**
- * Gets the description component of this datapack.
- *
- * @return the description
- */
- @NonNull Component getDescription();
-
- /**
- * Gets if this datapack is required to be enabled.
- *
- * @return true if the pack is required
- */
- boolean isRequired();
-
- /**
- * Gets the compatibility status of this pack.
- *
- * @return the compatibility of the pack
- */
- @NonNull Compatibility getCompatibility();
-
- /**
- * Gets the set of required features for this datapack.
- *
- * @return the set of required features
- */
- @NonNull @Unmodifiable Set<FeatureFlag> getRequiredFeatures();
+@ApiStatus.NonExtendable
+public interface Datapack extends DiscoveredDatapack {
/**
* Gets the enabled state of this pack.
@@ -73,13 +29,6 @@ public interface Datapack {
*/
void setEnabled(boolean enabled);
- /**
- * Gets the source for this datapack.
- *
- * @return the pack source
- */
- @NonNull DatapackSource getSource();
-
/**
* Computes the component vanilla Minecraft uses
* to display this datapack. Includes the {@link #getSource()},
diff --git a/src/main/java/io/papermc/paper/datapack/DiscoveredDatapack.java b/src/main/java/io/papermc/paper/datapack/DiscoveredDatapack.java
index f0ec90fd08e984995fd3fe48ae3219ce08e2d40a..8e1da7c41d7060a089c8b8c90f00e3bb47440bda 100644
--- a/src/main/java/io/papermc/paper/datapack/DiscoveredDatapack.java
+++ b/src/main/java/io/papermc/paper/datapack/DiscoveredDatapack.java
@@ -1,8 +1,67 @@
package io.papermc.paper.datapack;
+import java.util.Set;
+import net.kyori.adventure.text.Component;
+import org.bukkit.FeatureFlag;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Unmodifiable;
+
+/**
+ * This is a snapshot of a discovered datapack on the server. It
+ * won't be updated as datapacks are updated.
+ */
+@ApiStatus.NonExtendable
public interface DiscoveredDatapack {
- String getName();
+ /**
+ * Gets the name/id of this datapack.
+ *
+ * @return the name of the pack
+ */
+ @Contract(pure = true)
+ @NonNull String getName();
+
+ /**
+ * Gets the title component of this datapack.
+ *
+ * @return the title
+ */
+ @NonNull Component getTitle();
+
+ /**
+ * Gets the description component of this datapack.
+ *
+ * @return the description
+ */
+ @NonNull Component getDescription();
+
+ /**
+ * Gets if this datapack is required to be enabled.
+ *
+ * @return true if the pack is required
+ */
+ boolean isRequired();
+
+ /**
+ * Gets the compatibility status of this pack.
+ *
+ * @return the compatibility of the pack
+ */
+ Datapack.@NonNull Compatibility getCompatibility();
+
+ /**
+ * Gets the set of required features for this datapack.
+ *
+ * @return the set of required features
+ */
+ @NonNull @Unmodifiable Set<FeatureFlag> getRequiredFeatures();
- Datapack.Compatibility getCompatibility();
+ /**
+ * Gets the source for this datapack.
+ *
+ * @return the pack source
+ */
+ @NonNull DatapackSource getSource();
}