Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9861)

This commit is contained in:
Jake Potrebic
2023-10-26 14:56:40 -07:00
parent 5abcfb3d6b
commit 3a4d982c0f
19 changed files with 171 additions and 61 deletions

View File

@@ -100,7 +100,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.url = file.toURI().toURL();
this.libraryLoader = libraryLoader;
-
+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early
// Paper start
this.dependencyContext = dependencyContext;

View File

@@ -503,8 +503,8 @@ diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/P
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java
@@ -0,0 +0,0 @@ public enum Particle {
return dataType;
@@ -0,0 +0,0 @@ public enum Particle implements Keyed {
return key;
}
+ // Paper start - Particle API expansion
@@ -518,6 +518,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return new com.destroystokyo.paper.ParticleBuilder(this);
+ }
+ // Paper end
+
/**
* Options which can be applied to redstone dust particles - a particle
* color and size.

View File

@@ -108,8 +108,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @param name Name of the world that will be created
*/
public WorldCreator(@NotNull String name) {
- if (name == null) {
- throw new IllegalArgumentException("World name cannot be null");
- Preconditions.checkArgument(name != null, "World name cannot be null");
+ // Paper start
+ this(name, getWorldKey(name));
+ }
@@ -124,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return NamespacedKey.minecraft("the_end");
+ } else {
+ return NamespacedKey.minecraft(name.toLowerCase(java.util.Locale.ENGLISH).replace(" ", "_"));
}
+ }
+ }
- this.name = name;

View File

@@ -132,10 +132,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*
* @param namespace namespace
* @param key key
- * @deprecated should never be used by plugins, for internal use only!!
- * @apiNote should never be used by plugins, for internal use only!!
+ * @see #NamespacedKey(Plugin, String)
*/
- @Deprecated
- @ApiStatus.Internal
public NamespacedKey(@NotNull String namespace, @NotNull String key) {
Preconditions.checkArgument(namespace != null && isValidNamespace(namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace);
Preconditions.checkArgument(key != null && isValidKey(key), "Invalid key. Must be [a-z0-9/._-]: %s", key);
@@ -155,6 +155,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public enum NetherWartsState {
/**
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java
@@ -0,0 +0,0 @@ public enum Particle implements Keyed {
BLOCK_CRACK("block", BlockData.class),
/**
* Uses {@link BlockData} as DataType
+ * @deprecated use {@link #BLOCK_CRACK}
*/
+ @Deprecated // Paper
BLOCK_DUST("block", BlockData.class, false),
WATER_DROP("rain"),
MOB_APPEARANCE("elder_guardian"),
@@ -0,0 +0,0 @@ public enum Particle implements Keyed {
// ----- Legacy Separator -----
/**
* Uses {@link MaterialData} as DataType
+ * @deprecated {@link MaterialData} is deprecated API
*/
+ @Deprecated // Paper
LEGACY_BLOCK_CRACK(null, MaterialData.class, false),
/**
* Uses {@link MaterialData} as DataType
+ * @deprecated {@link MaterialData} is deprecated API
*/
+ @Deprecated // Paper
LEGACY_BLOCK_DUST(null, MaterialData.class, false),
/**
* Uses {@link MaterialData} as DataType
+ * @deprecated {@link MaterialData} is deprecated API
*/
+ @Deprecated // Paper
LEGACY_FALLING_DUST(null, MaterialData.class, false);
private final NamespacedKey key;
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Registry.java

View File

@@ -74,25 +74,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @param z Z-coordinate (0-15)
* @return temperature at given coordinate
*/
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java
@@ -0,0 +0,0 @@ public enum Particle {
SCRAPE,
SONIC_BOOM,
SCULK_SOUL,
+ /**
+ * Uses {@link Float} as DataType, representing the angle the particle displays at in radians
+ */
SCULK_CHARGE(Float.class),
SCULK_CHARGE_POP,
+ /**
+ * Uses {@link Integer} as DataType, representing the delay in ticks until the particle shows up
+ */
SHRIEK(Integer.class),
CHERRY_LEAVES,
EGG_CRACK,
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/RegionAccessor.java

View File

@@ -2130,14 +2130,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.url = file.toURI().toURL();
this.libraryLoader = libraryLoader;
+
+ // Paper start
+ this.dependencyContext = dependencyContext;
+ this.classLoaderGroup = io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage.instance().registerSpigotGroup(this);
+ // Paper end
+
Class<?> jarClass;
try {
Class<?> jarClass;
try {
jarClass = Class.forName(description.getMain(), true, this);
@@ -0,0 +0,0 @@ final class PluginClassLoader extends URLClassLoader {
return findResources(name);
}

View File

@@ -12,17 +12,63 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private boolean generateStructures = true;
private String generatorSettings = "";
private boolean hardcore = false;
- private boolean keepSpawnInMemory = true;
+ private net.kyori.adventure.util.TriState keepSpawnLoaded = net.kyori.adventure.util.TriState.NOT_SET; // Paper
/**
* Creates an empty WorldCreationOptions for the given world name
@@ -0,0 +0,0 @@ public class WorldCreator {
type = world.getWorldType();
generateStructures = world.canGenerateStructures();
hardcore = world.isHardcore();
- keepSpawnInMemory = world.getKeepSpawnInMemory();
+ this.keepSpawnLoaded = net.kyori.adventure.util.TriState.byBoolean(world.getKeepSpawnInMemory()); // Paper
return this;
}
@@ -0,0 +0,0 @@ public class WorldCreator {
generateStructures = creator.generateStructures();
generatorSettings = creator.generatorSettings();
hardcore = creator.hardcore();
- keepSpawnInMemory = creator.keepSpawnInMemory();
+ keepSpawnLoaded = creator.keepSpawnLoaded(); // Paper
return this;
}
@@ -0,0 +0,0 @@ public class WorldCreator {
*
* @param keepSpawnInMemory Whether the spawn chunks will be kept loaded
* @return This object, for chaining
+ * @deprecated use {@link #keepSpawnLoaded(net.kyori.adventure.util.TriState)}
*/
@NotNull
+ @Deprecated(forRemoval = true) // Paper
public WorldCreator keepSpawnInMemory(boolean keepSpawnInMemory) {
- this.keepSpawnInMemory = keepSpawnInMemory;
-
- return this;
+ return this.keepSpawnLoaded(net.kyori.adventure.util.TriState.byBoolean(keepSpawnInMemory)); // Paper
}
/**
* Gets whether or not the spawn chunks will be kept loaded.
*
* @return True if the spawn chunks will be kept loaded
+ * @deprecated use {@link #keepSpawnLoaded()}
*/
+ @Deprecated(forRemoval = true) // Paper
public boolean keepSpawnInMemory() {
- return keepSpawnInMemory;
+ return this.keepSpawnLoaded() == net.kyori.adventure.util.TriState.TRUE; // Paper
}
/**
@@ -0,0 +0,0 @@ public class WorldCreator {
return result;
}
+
+ // Paper start
+
+ // Paper start - keep spawn loaded tristate
+ /**
+ * Returns the current intent to keep the world loaded, @see {@link WorldCreator#keepSpawnLoaded(net.kyori.adventure.util.TriState)}
+ *
@@ -42,10 +88,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public WorldCreator keepSpawnLoaded(@NotNull net.kyori.adventure.util.TriState keepSpawnLoaded) {
+ java.util.Objects.requireNonNull(keepSpawnLoaded, "keepSpawnLoaded");
+ Preconditions.checkArgument(keepSpawnLoaded != null, "keepSpawnLoaded");
+ this.keepSpawnLoaded = keepSpawnLoaded;
+ return this;
+ }
+
+ // Paper end
+ // Paper end - keep spawn loaded tristate
}