Compare commits

...

4 commits

Author SHA1 Message Date
Jake Potrebic
496156e2ef
Update with latest upstream changes 2023-08-15 10:04:27 -07:00
BlockyTheDev
6dc8e30c92
Fix startup and runtime crashes (experimental branch) (#9606)
* Fix startup error

* Fix runtime error

- The code with '.getKey().getKey().getKey()' looks a bit strange but is necessary so the results on the timings website are the same as before. It gets the key (String) from the NamespacedKey, of the key from the Keyed, from the key of the Map.Entry.

* [ci skip] Add myself to LICENSE.md

* Remove wildcard import

* Revert import order
2023-08-15 09:41:56 -07:00
Jake Potrebic
cbc8941088
some more ItemType/BlockType api replacements 2023-06-20 10:56:49 -07:00
Jake Potrebic
3fa4ea6668
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
6680169e [#660/Enum] Merge remote-tracking branch 'origin/pr/660' into experimental
8b97f215 Add missing AbstractTestingBase extension
9f21f42b [#660/Enum] Merge remote-tracking branch 'origin/pr/660' into experimental
fb59a4a0 Create experimental version
a7c1393b Merge branch 'master' into enums-to-registers
1af01165 Merge branch 'master' into enums-to-registers
4ee82e4e Implement feedback
af8ffd60 Merge branch 'master' into enums-to-registers
6a8ea63f Updated to 1.20
22ae9ebc Merge branch 'master' into enums-to-registers
b1d669be Some clean up
685d812e Merge branch 'master' into enums-to-registers
00d778c7 Convert MusicInstrument
bba2eb5f Convert GameEvent
ffbf67a1 Convert PotionType
eacaa45d Convert Particle
d08d21d1 Convert PatternType
c6b51f7c Convert Cat type
af6c2987 Make missing Frog variant abstract
a67a5f5c Add missing Annotation
6ab21c50 Change how converting from / to BlockType and ItemType work
e3e84e69 Add Objects.requireNonNull so that there are not marked as nullable
fceddab5 Add missing deprecation
e91906f5 Don't convert legacy in register instead, only in required method
2200b334 Use static constructors for ItemStack
b5f483b0 Deprecated Material
a995df2a Fix typo getItemTyp
9cedb664 import ItemType
27e282b2 getSteerItemType -> getSteerItem
d8d0e43b Better Piglin method names
3a2ab399 BLOCK_TYPE -> BLOCK, ITEM_TYPE -> ITEM
a0eb63ac Interface it is
4bb0b646 Split Material into BlockType and ItemType
b6bfcff5 Merge branch 'master' into enums-to-registers
1f86c847 Updated to Mockito 5.3.1
280ee1f7 Fix merge, updated to 1.19.4
9e0c7ad5 Merge branch 'master' into enums-to-registers
fdbed698 Updated to 1.19.3
85c3e2d3 Merge branch 'master' into enums-to-registers
b2c390af Fix merge
4e405647 Merge branch 'master' into enums-to-registers
d01b4c90 Fix copy/paste
ba2c8cb1 Update to 1.19
7e4f2db2 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/bukkit into enums-to-registers
a1a974f0 Fix merge
7d3a91d3 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/bukkit into enums-to-registers
499e22d9 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/bukkit into enums-to-registers
a0cf419f Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/bukkit into enums-to-registers
d5bd36a2 Fix / Implement merge changes
fe643952 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/bukkit into enums-to-registers
cf1d2005 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/bukkit into enums-to-registers
f18dce93 Make Statistic abstract
bbe3f791 Fix 1.18 merge Handle comment out test cases
0988647e Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/bukkit into enums-to-registers
6e4f2c50 Populated BlockType and ItemType
7a58144d Convert Material enum, midpoint push, it compiles and runs
4771132c Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/bukkit into enums-to-registers
e6b179ff Convert Material enum, midpoint push to merge BlockState changes
f33b85a0 Change other enums / classes.
8b0d5418 Create seperat OldEnum class, which holds common enum methods.
45544426 Change Enums to classes to easier handle none standart minecraft values

CraftBukkit Changes:
8969b32d0 [#931/Enum] Merge remote-tracking branch 'origin/pr/931' into experimental
222257a67 Add missing AbstractTestingBase extension
0480af399 [#931/Enum] Merge remote-tracking branch 'origin/pr/931' into experimental
1afa1ddc2 Create experimental version
00780ea51 Ignore FactoryItemMaterialTest test
676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
84f10cc36 Fix merge
9e114e13e Merge branch 'master' into enums-to-registers
941787e24 Add missing Commodore for 1.20 updated
6dac9a12d Updated tests
737426398 Only allow reference holder
aaaa5fa88 Merge branch 'master' into enums-to-registers
74957eb99 Merge branch 'master' into enums-to-registers
a1ca4e870 Merge branch 'master' into enums-to-registers
f293f4a61 Updated to 1.20
b434b3d15 Merge branch 'master' into enums-to-registers
e99dcbda7 Some clean up
fcead8aed Use correct primitive class
e955d9c50 Fix some Commodore errors
af5526ebb Allow Material to support older plugins
b83afd643 Add rewrite for Google enum set methods
067323765 Add missing method replacement in dynamic invocation
63e17e631 Merge branch 'master' into enums-to-registers
26dfcacf8 Bad copy and past
d50c9bd6a Convert MusicInstrument
c0c5312db Convert GameEvent
39daffe2c Convert PotionType
9b974f832 Convert Particle
f528fca63 Convert PatternType
525c65006 Convert Cat type
6832b8fbb More consistent to / from bukkit / minecraft methods
d31e38e16 Make missing Frog variant abstract
e4f0e7d8e This shouldn't be committed
6fee81baa Add Commodore for EnumSet
82a668683 Fix hasItemType / getItemType
f70162d66 Change how converting from / to BlockType and ItemType work
c3f7c7886 Don't convert legacy in register instead, only in required method
2039e05fa Use static constructors for ItemStack
fe221578b More Commodore
2b70bd171 More Commodore
70f4a89f5 Fix some Commodore
06544ed4b Fix typo getItemTyp
6269d2e42 getSteerItemType -> getSteerItem
a19ac46c0 Better Piglin method names
eef5f52c6 BLOCK_TYPE -> BLOCK, ITEM_TYPE -> ITEM
bbaff1348 Interface it is
c39e1316c Finish Commodore action for Material split
dd8552105 Work on Commodore
1d4ef8bf2 Split Material into BlockType and ItemType
6c5a98220 Merge branch 'master' into enums-to-registers
869658a96 Handle Material calls in lambda expression
523ac4ac0 Add reroute for Class#getEnumConstants
0a4463279 Use extra method for getting registry
602d9b404 Updated to Mockito 5.3.1
8ff87b77d Fix merge, updated to 1.19.4
9d739d313 Merge branch 'master' into enums-to-registers
eb6f702ff Reduce usage of BuiltInRegistries
b6f667cac Some more asm compatibility changes, add config option
87c931d38 Handle enum maps
a2c6699db Updated to 1.19.3
f7c27584f Merge branch 'master' into enums-to-registers
2f95b9951 Fix merge
184b05740 Merge branch 'master' into enums-to-registers
12bd8de26 Updated to 1.19
9c57831b7 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
4ed8eb402 Fix merge
a9faac8e4 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
0d2988603 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
3f8f9557d Fix merge, updated to 1.18.2
1560490c6 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
a0e4eb12c Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
8b59f682d Move getType method to CraftEntity class
b849c0147 Add missing patches
4644ba79f Fix / Implement merge changes
cf9ee732e Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
0c9125b67 Use Tag where possible
cc05153d9 Cache interactable call
ab5cc36de Use getHandle
83ebf4114 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
bc20aea0c Make Statistic abstract
3faa7e135 Add Tests for Material BlockType and ItemType
e10f74365 Fix 1.18 merge Handle comment out test cases
f72f70ec4 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
dbf4f5b7e Populated BlockType and ItemType
015afc1bc Convert Material enum, midpoint push, it compiles and runs
cc0112866 Merge branch 'master' of https://hub.spigotmc.org/stash/scm/~derfrzocker/craftbukkit into enums-to-registers
e26742c59 Convert Material enum, midpoint push to merge BlockState changes
796ad9295 Fix bug in legacy naming converting.
199c8278c Change other enums / classes.
fd513652a Seperated custom biome value handling. Fix compareTo call.
60c71ce07 Change Enums to classes to easier handle none standart minecraft values

Spigot Changes:
addcf45f [Enum] Rebuild patches
2023-06-20 09:50:05 -07:00
754 changed files with 3292 additions and 3688 deletions

View file

@ -60,4 +60,5 @@ Luke Chambers <consolelogluke@gmail.com>
Emily <emilia.lopezf.1999@gmail.com>
dawon <dawon@dawon.eu>
Ollie <69084614+olijeffers0n@users.noreply.github.com>
BlockyTheDev <86119630+BlockyTheDev@users.noreply.github.com>
```

View file

@ -1,5 +1,5 @@
group=io.papermc.paper
version=1.20.1-R0.1-SNAPSHOT
version=1.20.1-experimental-SNAPSHOT
mcVersion=1.20.1
org.gradle.caching=true

View file

@ -27,10 +27,10 @@ index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff6181943
+/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..73bc33e7a498f8eca2d68c4588b04de4eaf8fc7a
index 0000000000000000000000000000000000000000..b1634fe921f5cd4e0b76823e33db5bc3ca50a8b5
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,85 @@
@@ -0,0 +1,86 @@
+plugins {
+ `java-library`
+ `maven-publish`
@ -63,6 +63,7 @@ index 0000000000000000000000000000000000000000..73bc33e7a498f8eca2d68c4588b04de4
+ testImplementation("junit:junit:4.13.2")
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.ow2.asm:asm-tree:9.5")
+ testImplementation("org.mockito:mockito-core:5.3.1")
+}
+
+configure<PublishingExtension> {
@ -118,10 +119,10 @@ index 0000000000000000000000000000000000000000..73bc33e7a498f8eca2d68c4588b04de4
+}
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index e6d48b5fdc484ed2443ddf1d60079a13ea2c9677..0000000000000000000000000000000000000000
index f9baf5cd570de24773b5ac2e5126475b5124d863..0000000000000000000000000000000000000000
--- a/pom.xml
+++ /dev/null
@@ -1,270 +0,0 @@
@@ -1,276 +0,0 @@
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@ -129,7 +130,7 @@ index e6d48b5fdc484ed2443ddf1d60079a13ea2c9677..00000000000000000000000000000000
-
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId>
- <version>1.20.1-R0.1-SNAPSHOT</version>
- <version>1.20.1-experimental-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>Spigot-API</name>
@ -138,8 +139,8 @@ index e6d48b5fdc484ed2443ddf1d60079a13ea2c9677..00000000000000000000000000000000
-
- <properties>
- <skipTests>true</skipTests>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>9</maven.compiler.source>
- <maven.compiler.target>9</maven.compiler.target>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
@ -234,6 +235,12 @@ index e6d48b5fdc484ed2443ddf1d60079a13ea2c9677..00000000000000000000000000000000
- <version>9.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>5.3.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Build system changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 73bc33e7a498f8eca2d68c4588b04de4eaf8fc7a..34117c1178e04885ff9be5b73c7c2547e77ed4d5 100644
index b1634fe921f5cd4e0b76823e33db5bc3ca50a8b5..61e15811e94effd303d55f8fa14c9fbf0ca6438e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -17,15 +17,27 @@ dependencies {
@ -37,7 +37,7 @@ index 73bc33e7a498f8eca2d68c4588b04de4eaf8fc7a..34117c1178e04885ff9be5b73c7c2547
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
@@ -67,7 +79,7 @@ tasks.withType<Javadoc> {
@@ -68,7 +80,7 @@ tasks.withType<Javadoc> {
options.links(
"https://guava.dev/releases/31.1-jre/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/2.0/",
@ -46,7 +46,7 @@ index 73bc33e7a498f8eca2d68c4588b04de4eaf8fc7a..34117c1178e04885ff9be5b73c7c2547
"https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
)
options.tags("apiNote:a:API Note:")
@@ -83,3 +95,14 @@ tasks.withType<Javadoc> {
@@ -84,3 +96,14 @@ tasks.withType<Javadoc> {
}
}
}

View file

@ -12,47 +12,6 @@ Subject: [PATCH] Test changes
Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 34117c1178e04885ff9be5b73c7c2547e77ed4d5..c174d9d6534382ae9d002b883bde929d46e32789 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,6 +37,7 @@ dependencies {
compileOnlyApi(checkerQual)
testCompileOnly(checkerQual)
// Paper end
+ testImplementation("org.mockito:mockito-core:4.9.0") // Paper - add mockito
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2")
diff --git a/src/test/java/io/papermc/paper/testing/EmptyRegistry.java b/src/test/java/io/papermc/paper/testing/EmptyRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..ba9ddce87a9f385e729a5c2cf7c5eec120e388a7
--- /dev/null
+++ b/src/test/java/io/papermc/paper/testing/EmptyRegistry.java
@@ -0,0 +1,23 @@
+package io.papermc.paper.testing;
+
+import java.util.Collections;
+import java.util.Iterator;
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public record EmptyRegistry() implements Registry<Keyed> {
+
+ @NotNull
+ @Override
+ public Iterator<Keyed> iterator() {
+ return Collections.emptyIterator();
+ }
+
+ @Override
+ public @Nullable Keyed get(@NotNull final NamespacedKey key) {
+ return null;
+ }
+}
diff --git a/src/test/java/io/papermc/paper/testing/EmptyTag.java b/src/test/java/io/papermc/paper/testing/EmptyTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f559ebc18
@ -90,60 +49,6 @@ index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f
+ return Collections.emptySet();
+ }
+}
diff --git a/src/test/java/io/papermc/paper/testing/TestServer.java b/src/test/java/io/papermc/paper/testing/TestServer.java
new file mode 100644
index 0000000000000000000000000000000000000000..756acf231b1b076b08046d86992ba7ce7f62a94f
--- /dev/null
+++ b/src/test/java/io/papermc/paper/testing/TestServer.java
@@ -0,0 +1,48 @@
+package io.papermc.paper.testing;
+
+import java.util.logging.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Server;
+import org.bukkit.command.SimpleCommandMap;
+import org.bukkit.plugin.PluginManager;
+import org.bukkit.plugin.SimplePluginManager;
+
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public final class TestServer {
+
+ @SuppressWarnings("removal")
+ public static void setup() {
+ //noinspection ConstantValue
+ if (Bukkit.getServer() != null) {
+ return;
+ }
+
+ final Server dummyServer = mock(Server.class);
+
+ final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName());
+ when(dummyServer.getLogger()).thenReturn(logger);
+ when(dummyServer.getName()).thenReturn(TestServer.class.getSimpleName());
+ when(dummyServer.getVersion()).thenReturn("Version_" + TestServer.class.getPackage().getImplementationVersion());
+ when(dummyServer.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion());
+
+
+ final Thread currentThread = Thread.currentThread();
+ when(dummyServer.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
+
+ when(dummyServer.getTag(anyString(), any(NamespacedKey.class), any())).thenAnswer(ignored -> new EmptyTag());
+
+ final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer));
+ when(dummyServer.getPluginManager()).thenReturn(pluginManager);
+
+ when(dummyServer.getRegistry(any())).thenAnswer(ignored -> new EmptyRegistry());
+ when(dummyServer.getScoreboardCriteria(anyString())).thenReturn(null);
+
+ Bukkit.setServer(dummyServer);
+ }
+
+}
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 4ac3dd977e75cd8464163351d306e037ee32cb48..c26ea217927ba77611e6ae93f8df50a83bceb3dd 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
@ -312,231 +217,17 @@ index 2dfada66067d79b84cd490eadbe0178e8cd8c260..06d66512c91c680130132b79e34fbf32
@Override
public Object[] apply(Method input) {
diff --git a/src/test/java/org/bukkit/TestServer.java b/src/test/java/org/bukkit/TestServer.java
deleted file mode 100644
index 701a17c10f31cd345238a3c568264178ce372faa..0000000000000000000000000000000000000000
index 1e407c612c7dc26a2bea4b6ed70e1f0723dc3762..e3480404af8187588787383b18e3002032653d71 100644
--- a/src/test/java/org/bukkit/TestServer.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.bukkit;
-
-import com.google.common.collect.ImmutableMap;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.logging.Logger;
-import org.bukkit.command.SimpleCommandMap;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.plugin.SimplePluginManager;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public final class TestServer implements InvocationHandler {
- private static interface MethodHandler {
- Object handle(TestServer server, Object[] args);
- }
-
- private static final Map<Method, MethodHandler> methods;
-
- static {
- try {
- ImmutableMap.Builder<Method, MethodHandler> methodMap = ImmutableMap.builder();
- methodMap.put(
- Server.class.getMethod("isPrimaryThread"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return Thread.currentThread().equals(server.creatingThread);
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getPluginManager"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return server.pluginManager;
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getLogger"),
- new MethodHandler() {
- final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName());
- @Override
- public Object handle(TestServer server, Object[] args) {
- return logger;
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getName"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return TestServer.class.getSimpleName();
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getVersion"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return "Version_" + TestServer.class.getPackage().getImplementationVersion();
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getBukkitVersion"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return "BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion();
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getRegistry", Class.class),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return new Registry() {
- @NotNull
- @Override
- public Iterator iterator() {
- return null;
- }
-
- @Nullable
- @Override
- public Keyed get(@NotNull NamespacedKey key) {
- return null;
- }
- };
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getScoreboardCriteria", String.class),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- // Does not need to return anything. Exists solely to test CriteriaTest which has static init fields
- return null;
- }
- }
- );
- methods = methodMap.build();
-
- TestServer server = new TestServer();
- Server instance = Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(server);
- Bukkit.setServer(instance);
- server.pluginManager = new SimplePluginManager(instance, new SimpleCommandMap(instance));
- } catch (Throwable t) {
- throw new Error(t);
- }
- }
-
- private Thread creatingThread = Thread.currentThread();
- private PluginManager pluginManager;
- private TestServer() {};
-
- public static Server getInstance() {
- return Bukkit.getServer();
- }
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) {
- MethodHandler handler = methods.get(method);
- if (handler != null) {
- return handler.handle(this, args);
- }
- throw new UnsupportedOperationException(String.valueOf(method));
- }
-}
diff --git a/src/test/java/org/bukkit/TestWorld.java b/src/test/java/org/bukkit/TestWorld.java
index ab34f1199921d415fa2ca6e281a8125c9e6d7173..f64d024f5bbf9482aaddb56597b23b04c66f21bf 100644
--- a/src/test/java/org/bukkit/TestWorld.java
+++ b/src/test/java/org/bukkit/TestWorld.java
@@ -18,7 +18,7 @@ public final class TestWorld implements InvocationHandler {
+++ b/src/test/java/org/bukkit/TestServer.java
@@ -59,6 +59,10 @@ public final class TestServer {
static {
try {
- TestServer.getInstance();
+ io.papermc.paper.testing.TestServer.setup(); // Paper
Mockito.when(instance.getUnsafe()).then(mock -> unsafeValues);
ImmutableMap.Builder<Method, MethodHandler> methodMap = ImmutableMap.builder();
methodMap.put(
diff --git a/src/test/java/org/bukkit/event/SyntheticEventTest.java b/src/test/java/org/bukkit/event/SyntheticEventTest.java
index d402cb59f508205ebe9ee450594826b04cecb90b..09886568ae6167141b463b6262565fa212af3385 100644
--- a/src/test/java/org/bukkit/event/SyntheticEventTest.java
+++ b/src/test/java/org/bukkit/event/SyntheticEventTest.java
@@ -1,6 +1,5 @@
package org.bukkit.event;
-import org.bukkit.TestServer;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.SimplePluginManager;
import org.bukkit.plugin.TestPlugin;
@@ -12,14 +11,15 @@ public class SyntheticEventTest {
@SuppressWarnings("deprecation")
@Test
public void test() {
- final JavaPluginLoader loader = new JavaPluginLoader(TestServer.getInstance());
+ io.papermc.paper.testing.TestServer.setup(); // Paper
+ final JavaPluginLoader loader = new JavaPluginLoader(org.bukkit.Bukkit.getServer()); // Paper
TestPlugin plugin = new TestPlugin(getClass().getName()) {
@Override
public PluginLoader getPluginLoader() {
return loader;
}
};
- SimplePluginManager pluginManager = new SimplePluginManager(TestServer.getInstance(), null);
+ SimplePluginManager pluginManager = new SimplePluginManager(org.bukkit.Bukkit.getServer(), null); // Paper
TestEvent event = new TestEvent(false);
Impl impl = new Impl();
diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
index f188cd4f3b07027c30d41f1162db77a506b7b6bb..c46ed2acb82db814d660459b705dd49e6d44240f 100644
--- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java
+++ b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
@@ -2,7 +2,6 @@ package org.bukkit.plugin;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
-import org.bukkit.TestServer;
import org.bukkit.event.Event;
import org.bukkit.event.TestEvent;
import org.bukkit.permissions.Permission;
@@ -14,7 +13,7 @@ public class PluginManagerTest {
volatile Object value = null;
}
- private static final PluginManager pm = TestServer.getInstance().getPluginManager();
+ private static final PluginManager pm = org.bukkit.Bukkit.getServer().getPluginManager(); // Paper
private final MutableObject store = new MutableObject();
diff --git a/src/test/java/org/bukkit/scoreboard/CriteriaTest.java b/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
index eb94b6f4d58cd9f66b07791c57af7e359992e28c..a93f28e2f987a36e2c7e4f7d31506b750bdb222b 100644
--- a/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
+++ b/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
@@ -2,7 +2,6 @@ package org.bukkit.scoreboard;
import org.bukkit.Material;
import org.bukkit.Statistic;
-import org.bukkit.TestServer;
import org.bukkit.entity.EntityType;
import org.junit.Assert;
import org.junit.Test;
@@ -11,7 +10,7 @@ public class CriteriaTest {
@Test
public void testStatistic() {
- TestServer.getInstance();
+ io.papermc.paper.testing.TestServer.setup(); // Paper
Assert.assertThrows(IllegalArgumentException.class, () -> Criteria.statistic(Statistic.AVIATE_ONE_CM, Material.STONE)); // Generic statistic with block
Assert.assertThrows(IllegalArgumentException.class, () -> Criteria.statistic(Statistic.AVIATE_ONE_CM, EntityType.CREEPER)); // Generic statistic with entity type
+ // Paper start - test changes
+ Mockito.when(instance.getTag(Mockito.anyString(), Mockito.any(NamespacedKey.class), Mockito.any())).thenAnswer(ignored -> new io.papermc.paper.testing.EmptyTag());
+ // Paper end
+
Bukkit.setServer(instance);
server.pluginManager = new SimplePluginManager(instance, new SimpleCommandMap(instance));
} catch (Throwable t) {

View file

@ -7,7 +7,7 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 3e571743e76b26167e329dbd0a4c04ffd6427572..7671b795188adfea56daea2d957e173c8d07c086 100644
index 3410360cb952bd5bdb352f0ff890228c3a2b2a92..6fef295a8a3425f6b4df9d3a7cfe007e4ab9320f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,13 +8,26 @@ java {
@ -754,10 +754,10 @@ index 0000000000000000000000000000000000000000..6e94562d79206d88b74b53814f9423f1
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba93af305d7 100644
index ba518f05a67ce8fe867b7c62ec3bc780b0032d08..c0ba2c8d47bd6f149410b57e45fc87a3b3ad4aab 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -388,7 +388,9 @@ public final class Bukkit {
@@ -389,7 +389,9 @@ public final class Bukkit {
*
* @param message the message
* @return the number of players
@ -767,7 +767,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
public static int broadcastMessage(@NotNull String message) {
return server.broadcastMessage(message);
}
@@ -1104,6 +1106,19 @@ public final class Bukkit {
@@ -1105,6 +1107,19 @@ public final class Bukkit {
server.shutdown();
}
@ -787,7 +787,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
/**
* Broadcasts the specified message to every user with the given
* permission name.
@@ -1113,6 +1128,21 @@ public final class Bukkit {
@@ -1114,6 +1129,21 @@ public final class Bukkit {
* permissibles} must have to receive the broadcast
* @return number of message recipients
*/
@ -809,7 +809,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
public static int broadcast(@NotNull String message, @NotNull String permission) {
return server.broadcast(message, permission);
}
@@ -1351,6 +1381,7 @@ public final class Bukkit {
@@ -1352,6 +1382,7 @@ public final class Bukkit {
return server.createInventory(owner, type);
}
@ -817,7 +817,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
/**
* Creates an empty inventory with the specified type and title. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
@@ -1376,6 +1407,38 @@ public final class Bukkit {
@@ -1377,6 +1408,38 @@ public final class Bukkit {
* @see InventoryType#isCreatable()
*/
@NotNull
@ -856,7 +856,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
public static Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title) {
return server.createInventory(owner, type, title);
}
@@ -1394,6 +1457,7 @@ public final class Bukkit {
@@ -1395,6 +1458,7 @@ public final class Bukkit {
return server.createInventory(owner, size);
}
@ -864,7 +864,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
/**
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
* specified size and title.
@@ -1406,10 +1470,30 @@ public final class Bukkit {
@@ -1407,10 +1471,30 @@ public final class Bukkit {
* @throws IllegalArgumentException if the size is not a multiple of 9
*/
@NotNull
@ -895,7 +895,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
/**
* Creates an empty merchant.
*
@@ -1417,7 +1501,20 @@ public final class Bukkit {
@@ -1418,7 +1502,20 @@ public final class Bukkit {
* when the merchant inventory is viewed
* @return a new merchant
*/
@ -916,7 +916,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
public static Merchant createMerchant(@Nullable String title) {
return server.createMerchant(title);
}
@@ -1534,12 +1631,43 @@ public final class Bukkit {
@@ -1535,12 +1632,43 @@ public final class Bukkit {
return server.isPrimaryThread();
}
@ -960,7 +960,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
public static String getMotd() {
return server.getMotd();
}
@@ -1548,7 +1676,9 @@ public final class Bukkit {
@@ -1549,7 +1677,9 @@ public final class Bukkit {
* Set the message that is displayed on the server list.
*
* @param motd The message to be displayed
@ -970,7 +970,7 @@ index ff86f4f5d7f460e8986c4a4fa483f5b5a1d3a1b6..cd9566aeace9e2e1e01fb014b0c50ba9
public static void setMotd(@NotNull String motd) {
server.setMotd(motd);
}
@@ -1557,8 +1687,10 @@ public final class Bukkit {
@@ -1558,8 +1688,10 @@ public final class Bukkit {
* Gets the default message that is displayed when the server is stopped.
*
* @return the shutdown message
@ -1152,10 +1152,10 @@ index c559f38fdb92cfee9f2e0ffb7088d1cf74a7f73d..a42f1d53340e4073038d46b7fabf5d44
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844cbafe2d9 100644
index 1cf603286b30b4773dd10a8b4508b6e03d998958..437d59ddf6a6859afc052257ba3f574929071522 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -60,13 +60,13 @@ import org.jetbrains.annotations.Nullable;
@@ -61,13 +61,13 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a server implementation.
*/
@ -1171,7 +1171,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
*/
public static final String BROADCAST_CHANNEL_ADMINISTRATIVE = "bukkit.broadcast.admin";
@@ -74,7 +74,7 @@ public interface Server extends PluginMessageRecipient {
@@ -75,7 +75,7 @@ public interface Server extends PluginMessageRecipient {
* Used for all announcement messages, such as informing users that a
* player has joined.
* <p>
@ -1180,7 +1180,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
*/
public static final String BROADCAST_CHANNEL_USERS = "bukkit.broadcast.user";
@@ -327,7 +327,9 @@ public interface Server extends PluginMessageRecipient {
@@ -328,7 +328,9 @@ public interface Server extends PluginMessageRecipient {
*
* @param message the message
* @return the number of players
@ -1190,7 +1190,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
public int broadcastMessage(@NotNull String message);
/**
@@ -945,8 +947,33 @@ public interface Server extends PluginMessageRecipient {
@@ -946,8 +948,33 @@ public interface Server extends PluginMessageRecipient {
* @param permission the required permission {@link Permissible
* permissibles} must have to receive the broadcast
* @return number of message recipients
@ -1224,7 +1224,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
/**
* Gets the player by the given name, regardless if they are offline or
@@ -1144,6 +1171,35 @@ public interface Server extends PluginMessageRecipient {
@@ -1145,6 +1172,35 @@ public interface Server extends PluginMessageRecipient {
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type);
@ -1260,7 +1260,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
/**
* Creates an empty inventory with the specified type and title. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
@@ -1165,9 +1221,11 @@ public interface Server extends PluginMessageRecipient {
@@ -1166,9 +1222,11 @@ public interface Server extends PluginMessageRecipient {
* @return The new inventory.
* @throws IllegalArgumentException if the {@link InventoryType} cannot be
* viewed.
@ -1272,7 +1272,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title);
@@ -1183,6 +1241,22 @@ public interface Server extends PluginMessageRecipient {
@@ -1184,6 +1242,22 @@ public interface Server extends PluginMessageRecipient {
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, int size) throws IllegalArgumentException;
@ -1295,7 +1295,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
/**
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
* specified size and title.
@@ -1193,18 +1267,32 @@ public interface Server extends PluginMessageRecipient {
@@ -1194,18 +1268,32 @@ public interface Server extends PluginMessageRecipient {
* viewed
* @return a new inventory
* @throws IllegalArgumentException if the size is not a multiple of 9
@ -1328,7 +1328,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
Merchant createMerchant(@Nullable String title);
/**
@@ -1300,27 +1388,56 @@ public interface Server extends PluginMessageRecipient {
@@ -1301,27 +1389,56 @@ public interface Server extends PluginMessageRecipient {
*/
boolean isPrimaryThread();
@ -1385,7 +1385,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
String getShutdownMessage();
/**
@@ -1702,7 +1819,9 @@ public interface Server extends PluginMessageRecipient {
@@ -1706,7 +1823,9 @@ public interface Server extends PluginMessageRecipient {
* Sends the component to the player
*
* @param component the components to send
@ -1395,7 +1395,7 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
public void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1711,7 +1830,9 @@ public interface Server extends PluginMessageRecipient {
@@ -1715,7 +1834,9 @@ public interface Server extends PluginMessageRecipient {
* Sends an array of components as a single message to the player
*
* @param components the components to send
@ -1406,28 +1406,26 @@ index d3684494b81d06b82eab72c6cfbd76d36dfc0e97..e359bc68007fbe62270ee62be762f844
throw new UnsupportedOperationException("Not supported yet.");
}
diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java
index 4cbc963f268753316327e38b6e1e42cffb486b54..6e8d2b35d8f33827396dbcfa817cd9c2f8ad83a6 100644
index 3f3c0ff5e8df623147f5b7ba74adc0027a325380..080378ac39ecb896c6b82bc3c27dd41e384f1e0d 100644
--- a/src/main/java/org/bukkit/Sound.java
+++ b/src/main/java/org/bukkit/Sound.java
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
* guarantee values will not be removed from this Enum. As such, you should not
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
* guarantee values will not be removed from this class. As such, you should not
* depend on the ordinal values of this class.
*/
-public enum Sound implements Keyed {
+public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Paper - implement Sound.Type
-public abstract class Sound extends OldEnum<Sound> implements Keyed {
+public abstract class Sound extends OldEnum<Sound> implements Keyed, net.kyori.adventure.sound.Sound.Type { // Paper - implement Sound.Type
AMBIENT_BASALT_DELTAS_ADDITIONS("ambient.basalt_deltas.additions"),
AMBIENT_BASALT_DELTAS_LOOP("ambient.basalt_deltas.loop"),
@@ -1498,4 +1498,11 @@ public enum Sound implements Keyed {
public NamespacedKey getKey() {
return key;
public static final Sound ENTITY_ALLAY_AMBIENT_WITH_ITEM = getSound("entity.allay.ambient_with_item");
public static final Sound ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM = getSound("entity.allay.ambient_without_item");
@@ -1532,4 +1532,9 @@ public abstract class Sound extends OldEnum<Sound> implements Keyed {
public static Sound[] values() {
return Lists.newArrayList(Registry.SOUNDS).toArray(new Sound[0]);
}
+
+ // Paper start
+ @Override
+ public net.kyori.adventure.key.@NotNull Key key() {
+ return this.key;
+ }
+ public abstract net.kyori.adventure.key.@NotNull Key key();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/SoundCategory.java b/src/main/java/org/bukkit/SoundCategory.java
@ -1467,10 +1465,10 @@ index ac5e263d737973af077e3406a84a84baca4370db..2d91924b7f5ef16a91d40cdc1bfc3d68
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 650adcecdca839518e0b57bc47935d010ca0f64f..fd0ae07b8a19f6b628601a487329a929f3a26c91 100644
index 59cc52159e2d135e8f2ad93364a72a5d5c61db6f..2d334dbdd9e2c9a020899097e0620152758dc078 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -25,6 +25,15 @@ import org.jetbrains.annotations.Nullable;
@@ -28,6 +28,15 @@ import org.jetbrains.annotations.Nullable;
*/
@Deprecated
public interface UnsafeValues {
@ -1499,7 +1497,7 @@ index efb97712cc9dc7c1e12a59f5b94e4f2ad7c6b7d8..3024468af4c073324e536c1cb26beffb
return warning == null || warning.value();
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index c4d2a13d62059ca1f148a9af909f424b745bc8df..5357291ff0f2f20bd87ab9f6e57f6a4f6ff65226 100644
index fd957c5e57bf77f6e66d7bfcf34f79e14ebb37bc..d2e95c6ecc11b19ebb52c291884376c39d28467e 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -44,7 +44,7 @@ import org.jetbrains.annotations.Nullable;
@ -2007,10 +2005,10 @@ index b7d8dd30360a38dbdc7bbce40c8e6ced7261f833..0817f2395c2b18828565435568ce651f
public void sendRawMessage(@Nullable UUID sender, @NotNull String message);
}
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
index e2800dc97af5bbb02c555069285a0fa155a9799d..2dc749936df6168073a5bb9f9051d55f8589ac62 100644
index ed59e306b26bde6bdccf8a5180474b7bbaf1f111..340a06329e6603fb20d02eda294972fc18508543 100644
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java
@@ -299,6 +299,19 @@ public abstract class Enchantment implements Keyed {
@@ -293,6 +293,19 @@ public abstract class Enchantment implements Keyed {
* @return True if the enchantment may be applied, otherwise False
*/
public abstract boolean canEnchantItem(@NotNull ItemStack item);
@ -2028,16 +2026,17 @@ index e2800dc97af5bbb02c555069285a0fa155a9799d..2dc749936df6168073a5bb9f9051d55f
+ public abstract net.kyori.adventure.text.@NotNull Component displayName(int level);
+ // Paper end
@Override
public boolean equals(Object obj) {
/**
* Gets the Enchantment at the specified key
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
index 9566e4306ada5e82dede0f002aa06da12c44996b..4d5f0837bd0e02a30c943d8969fb6b13452322e0 100644
index 7fee01b0ad709c672d91bce34ca7f328cf5a15a0..3f432a055d9fc70e6b16bf87c209be50232f2e93 100644
--- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
@@ -63,4 +63,11 @@ public class EnchantmentWrapper extends Enchantment {
public boolean conflictsWith(@NotNull Enchantment other) {
return getEnchantment().conflictsWith(other);
@@ -70,4 +70,12 @@ public class EnchantmentWrapper extends Enchantment {
public NamespacedKey getKey() {
return getEnchantment().getKey();
}
+
+ // Paper start
+ @NotNull
+ @Override
@ -2047,7 +2046,7 @@ index 9566e4306ada5e82dede0f002aa06da12c44996b..4d5f0837bd0e02a30c943d8969fb6b13
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index f3afe67f0832cb828d25be3654518ff73a80b0e1..598abaa82c634178043a29f6caa6ac5221659d06 100644
index 2417f0d5077b51a7649503d57c48b0614f532904..9cebad10eb06f42cd0428d80940fa8e223f0deab 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
@ -2081,7 +2080,7 @@ index f3afe67f0832cb828d25be3654518ff73a80b0e1..598abaa82c634178043a29f6caa6ac52
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcadaddba9d43 100644
index a18e0377b68100d37ea171f80fe7f7e18e0a4593..5b5802be082f70a015b4a20c0ccdec1ee6f479f6 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -43,7 +43,41 @@ import org.jetbrains.annotations.Nullable;
@ -2272,7 +2271,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
/**
* Says a message (or runs a command).
*
@@ -633,6 +732,90 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -621,6 +720,90 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull Map<EquipmentSlot, ItemStack> items);
@ -2282,7 +2281,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
+ * a certain location. This will not actually change the world in any way.
+ * This method will use a sign at the location's block or a faked sign
+ * sent via
+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}.
+ * {@link #sendBlockChange(Location, BlockData)}.
+ * <p>
+ * If the client does not have a sign at the given location it will
+ * display an error message to the user.
@ -2301,7 +2300,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
+ * a certain location. This will not actually change the world in any way.
+ * This method will use a sign at the location's block or a faked sign
+ * sent via
+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}.
+ * {@link #sendBlockChange(Location, BlockData)}.
+ * <p>
+ * If the client does not have a sign at the given location it will
+ * display an error message to the user.
@ -2322,7 +2321,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
+ * a certain location. This will not actually change the world in any way.
+ * This method will use a sign at the location's block or a faked sign
+ * sent via
+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}.
+ * {@link #sendBlockChange(Location, BlockData)}.
+ * <p>
+ * If the client does not have a sign at the given location it will
+ * display an error message to the user.
@ -2343,7 +2342,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
+ * a certain location. This will not actually change the world in any way.
+ * This method will use a sign at the location's block or a faked sign
+ * sent via
+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}.
+ * {@link #sendBlockChange(Location, BlockData)}.
+ * <p>
+ * If the client does not have a sign at the given location it will
+ * display an error message to the user.
@ -2363,7 +2362,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
/**
* Send a sign change. This fakes a sign change packet for a user at
* a certain location. This will not actually change the world in any way.
@@ -650,7 +833,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -638,7 +821,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param lines the new text on the sign or null to clear it
* @throws IllegalArgumentException if location is null
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
@ -2373,7 +2372,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException;
/**
@@ -672,7 +857,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -660,7 +845,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException if location is null
* @throws IllegalArgumentException if dyeColor is null
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
@ -2383,7 +2382,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException;
/**
@@ -695,7 +882,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -683,7 +870,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException if location is null
* @throws IllegalArgumentException if dyeColor is null
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
@ -2393,7 +2392,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException;
/**
@@ -1211,6 +1400,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1199,6 +1388,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* pack correctly.
* </ul>
*
@ -2401,7 +2400,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
* @param url The URL from which the client will download the resource
* pack. The string must contain only US-ASCII characters and should
* be encoded as per RFC 1738.
@@ -1267,8 +1457,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1255,8 +1445,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long.
*/
@ -2459,7 +2458,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
/**
* Request that the player's client download and switch resource packs.
* <p>
@@ -1298,6 +1537,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1286,6 +1525,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* pack correctly.
* </ul>
*
@ -2467,7 +2466,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
* @param url The URL from which the client will download the resource
* pack. The string must contain only US-ASCII characters and should
* be encoded as per RFC 1738.
@@ -1358,8 +1598,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1346,8 +1586,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long.
*/
@ -2525,7 +2524,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
/**
* Gets the Scoreboard displayed to this player
*
@@ -1475,7 +1764,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1463,7 +1752,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param title Title text
* @param subtitle Subtitle text
@ -2534,7 +2533,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
*/
@Deprecated
public void sendTitle(@Nullable String title, @Nullable String subtitle);
@@ -1494,7 +1783,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1482,7 +1771,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param fadeIn time in ticks for titles to fade in. Defaults to 10.
* @param stay time in ticks for titles to stay. Defaults to 70.
* @param fadeOut time in ticks for titles to fade out. Defaults to 20.
@ -2544,7 +2543,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
public void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut);
/**
@@ -1721,6 +2012,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1709,6 +2000,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public int getClientViewDistance();
@ -2559,7 +2558,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
/**
* Gets the player's estimated ping in milliseconds.
*
@@ -1746,8 +2045,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1734,8 +2033,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* they wish.
*
* @return the player's locale
@ -2570,7 +2569,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
public String getLocale();
/**
@@ -1799,6 +2100,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1787,6 +2088,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public boolean isAllowingServerListings();
@ -2585,7 +2584,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
// Spigot start
public class Spigot extends Entity.Spigot {
@@ -1830,11 +2139,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1818,11 +2127,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
throw new UnsupportedOperationException("Not supported yet.");
}
@ -2599,7 +2598,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
@Override
public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
@@ -1845,7 +2156,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1833,7 +2144,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param position the screen position
* @param component the components to send
@ -2609,7 +2608,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1855,7 +2168,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1843,7 +2156,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param position the screen position
* @param components the components to send
@ -2619,7 +2618,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1866,7 +2181,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1854,7 +2169,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param position the screen position
* @param sender the sender of the message
* @param component the components to send
@ -2629,7 +2628,7 @@ index 6860eb5e85d115d1c00ace8c646ccc080bff29ce..84e63caeabe3e44381a464bde47bcada
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1877,7 +2194,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1865,7 +2182,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param position the screen position
* @param sender the sender of the message
* @param components the components to send
@ -3916,13 +3915,13 @@ index e12996492c1558fed9fab30de9f8018e0ed7fac3..002acfbdce1db10f7ba1b6a013e678f5
/**
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index f89d71b77d1200314df6ca23614d5ca6fb15ceb3..af4a7ce37eb10bab06eadb6583c7894b3ec55ae6 100644
index 830cf7f0e069c4c0b29252c0ac7e8cb08f2d1922..d0530328536840ce126b39942fac35a476ea2ac4 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -159,4 +159,24 @@ public interface ItemFactory {
@@ -158,4 +158,24 @@ public interface ItemFactory {
@Deprecated
@NotNull
Material updateMaterial(@NotNull final ItemMeta meta, @NotNull final Material material) throws IllegalArgumentException;
ItemType updateItemType(@NotNull final ItemMeta meta, @NotNull final ItemType itemType) throws IllegalArgumentException;
+
+ // Paper start
+ /**
@ -3945,7 +3944,7 @@ index f89d71b77d1200314df6ca23614d5ca6fb15ceb3..af4a7ce37eb10bab06eadb6583c7894b
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index d80b0a52968920b990a75cff85e436a16d782500..9d327f0832c40d4a8d212346284274f6cf78834f 100644
index c9cdedc546804879bb93d957503b56347868524a..7e6c2bcf42d271184a75c91ecded5824535b3455 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
@ -3954,10 +3953,10 @@ index d80b0a52968920b990a75cff85e436a16d782500..9d327f0832c40d4a8d212346284274f6
*/
-public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable {
+public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper
private Material type = Material.AIR;
private int amount = 0;
private MaterialData data = null;
@@ -602,4 +602,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
/**
* Creates a new ItemStack with an amount of 1.
@@ -652,4 +652,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
@ -3980,12 +3979,12 @@ index d80b0a52968920b990a75cff85e436a16d782500..9d327f0832c40d4a8d212346284274f6
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/meta/BookMeta.java b/src/main/java/org/bukkit/inventory/meta/BookMeta.java
index 94852d50e88d0594b84b581cd627174043629995..be7c2cfc757e4dd15927be850739d401958fb227 100644
index 315fd06a0706569cf339f6f98ef623787acb8643..c1978f0501e41adb1ccc1f20a1444d50e9ecc35f 100644
--- a/src/main/java/org/bukkit/inventory/meta/BookMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/BookMeta.java
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable;
* Represents a book ({@link Material#WRITABLE_BOOK} or {@link
* Material#WRITTEN_BOOK}) that can have a title, an author, and pages.
* Represents a book ({@link ItemType#WRITABLE_BOOK} or {@link
* ItemType#WRITTEN_BOOK}) that can have a title, an author, and pages.
*/
-public interface BookMeta extends ItemMeta {
+public interface BookMeta extends ItemMeta, net.kyori.adventure.inventory.Book { // Paper

View file

@ -26,3 +26,23 @@ index 0000000000000000000000000000000000000000..9db0056ab94145819628b3ad8d8d2613
+ }
+
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 2d334dbdd9e2c9a020899097e0620152758dc078..639d275b8318d19afd18996e1daa4e800927a84d 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -5,6 +5,7 @@ import org.bukkit.advancement.Advancement;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.block.Biome;
+import org.bukkit.block.BlockType;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@@ -47,6 +48,7 @@ public interface UnsafeValues {
Material fromLegacy(MaterialData material, boolean itemPriority);
Material toMaterial(ItemType itemType);
+ Material blockTypeToMaterial(BlockType<?> blockType); // Paper
BlockData fromLegacy(Material material, byte data);

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Paper Plugins
diff --git a/build.gradle.kts b/build.gradle.kts
index a626bbad85f8d1b348d4e67f328f4b0141b267c1..b0ca0ddffce2524e82d891c7a4d69d3ef9f2c097 100644
index 04433b1f41c5abf04743ed6dd96bf83267a39828..8b4f7f0166a1323266c603ca4c860980617f5eda 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -47,7 +47,7 @@ dependencies {
@ -1338,13 +1338,13 @@ index 0000000000000000000000000000000000000000..6bf3d212a6156ad9ab0e82d1ca0a04f8
+
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index fd0ae07b8a19f6b628601a487329a929f3a26c91..2042e3fb0ea347148814d9838cd7bb475bd23984 100644
index cd00a831cd4c6030082aa8107d25c78d8ee67d8f..628fae98b17cd7dd1a5358562225cefefeb5051b 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -101,4 +101,14 @@ public interface UnsafeValues {
@@ -110,4 +110,13 @@ public interface UnsafeValues {
EntityType<Entity> getUnkownEntityType();
@Nullable
FeatureFlag getFeatureFlag(@NotNull NamespacedKey key);
Biome getCustomBiome();
+
+ // Paper start
+ @Deprecated(forRemoval = true)
@ -1354,7 +1354,6 @@ index fd0ae07b8a19f6b628601a487329a929f3a26c91..2042e3fb0ea347148814d9838cd7bb47
+ static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
+ return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java
index 1dbbc244309043b18c1d71707c4fb066c0d0e02d..551c5af6a7bfa2268cbc63be8e70d129bccaa912 100644
@ -2268,28 +2267,56 @@ index 2f74ec96ece706de23156ebabfe493211bc05391..302319acbc257a075adfb78d9f5c49fd
+
+ // Paper end
}
diff --git a/src/test/java/io/papermc/paper/testing/TestServer.java b/src/test/java/io/papermc/paper/testing/TestServer.java
index 756acf231b1b076b08046d86992ba7ce7f62a94f..52d27d977b9df0bdf02b33ed0aaa3b4db0a04cb4 100644
--- a/src/test/java/io/papermc/paper/testing/TestServer.java
+++ b/src/test/java/io/papermc/paper/testing/TestServer.java
@@ -36,9 +36,6 @@ public final class TestServer {
diff --git a/src/test/java/org/bukkit/TestServer.java b/src/test/java/org/bukkit/TestServer.java
index e3480404af8187588787383b18e3002032653d71..ec00f2ac0fe2be6c3b4c25b027bc4ff36008e5e1 100644
--- a/src/test/java/org/bukkit/TestServer.java
+++ b/src/test/java/org/bukkit/TestServer.java
@@ -4,9 +4,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Logger;
-import org.bukkit.command.SimpleCommandMap;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.plugin.SimplePluginManager;
+// Paper - Paper Plugins
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -20,7 +18,7 @@ public final class TestServer {
when(dummyServer.getTag(anyString(), any(NamespacedKey.class), any())).thenAnswer(ignored -> new EmptyTag());
Mockito.when(instance.isPrimaryThread()).then(mock -> Thread.currentThread().equals(server.creatingThread));
- final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer));
- when(dummyServer.getPluginManager()).thenReturn(pluginManager);
-
when(dummyServer.getRegistry(any())).thenAnswer(ignored -> new EmptyRegistry());
when(dummyServer.getScoreboardCriteria(anyString())).thenReturn(null);
- Mockito.when(instance.getPluginManager()).then(mock -> server.pluginManager);
+ // Paper - Paper Plugins
Mockito.when(instance.getLogger()).then(new Answer<Logger>() {
final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName());
@@ -64,14 +62,14 @@ public final class TestServer {
// Paper end
Bukkit.setServer(instance);
- server.pluginManager = new SimplePluginManager(instance, new SimpleCommandMap(instance));
+ // Paper - Paper Plugins
} catch (Throwable t) {
throw new Error(t);
}
}
private Thread creatingThread = Thread.currentThread();
- private PluginManager pluginManager;
+ // Paper - Paper Plugins
private TestServer() {}
public static void setup() {}
diff --git a/src/test/java/org/bukkit/event/SyntheticEventTest.java b/src/test/java/org/bukkit/event/SyntheticEventTest.java
deleted file mode 100644
index 09886568ae6167141b463b6262565fa212af3385..0000000000000000000000000000000000000000
index d402cb59f508205ebe9ee450594826b04cecb90b..0000000000000000000000000000000000000000
--- a/src/test/java/org/bukkit/event/SyntheticEventTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.bukkit.event;
-
-import org.bukkit.TestServer;
-import org.bukkit.plugin.PluginLoader;
-import org.bukkit.plugin.SimplePluginManager;
-import org.bukkit.plugin.TestPlugin;
@ -2301,15 +2328,14 @@ index 09886568ae6167141b463b6262565fa212af3385..00000000000000000000000000000000
- @SuppressWarnings("deprecation")
- @Test
- public void test() {
- io.papermc.paper.testing.TestServer.setup(); // Paper
- final JavaPluginLoader loader = new JavaPluginLoader(org.bukkit.Bukkit.getServer()); // Paper
- final JavaPluginLoader loader = new JavaPluginLoader(TestServer.getInstance());
- TestPlugin plugin = new TestPlugin(getClass().getName()) {
- @Override
- public PluginLoader getPluginLoader() {
- return loader;
- }
- };
- SimplePluginManager pluginManager = new SimplePluginManager(org.bukkit.Bukkit.getServer(), null); // Paper
- SimplePluginManager pluginManager = new SimplePluginManager(TestServer.getInstance(), null);
-
- TestEvent event = new TestEvent(false);
- Impl impl = new Impl();
@ -2338,26 +2364,28 @@ index 09886568ae6167141b463b6262565fa212af3385..00000000000000000000000000000000
-}
diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
deleted file mode 100644
index c46ed2acb82db814d660459b705dd49e6d44240f..0000000000000000000000000000000000000000
index 7c7cdfb509997de9f58d1b2c758e308a10ec0f92..0000000000000000000000000000000000000000
--- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
@@ -1,185 +0,0 @@
-package org.bukkit.plugin;
-
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-import org.bukkit.TestServer;
-import org.bukkit.event.Event;
-import org.bukkit.event.TestEvent;
-import org.bukkit.permissions.Permission;
-import org.bukkit.support.AbstractTestingBase;
-import org.junit.After;
-import org.junit.Test;
-
-public class PluginManagerTest {
-public class PluginManagerTest extends AbstractTestingBase {
- private class MutableObject {
- volatile Object value = null;
- }
-
- private static final PluginManager pm = org.bukkit.Bukkit.getServer().getPluginManager(); // Paper
- private static final PluginManager pm = TestServer.getInstance().getPluginManager();
-
- private final MutableObject store = new MutableObject();
-

View file

@ -717,10 +717,10 @@ index 0000000000000000000000000000000000000000..199789d56d22fcb1b77ebd56805cc28a
+}
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf542989301d21b1c
index 0000000000000000000000000000000000000000..7213bd2ccf6fa03933a9dff878baee8e92bf50b9
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
@@ -0,0 +1,355 @@
@@ -0,0 +1,356 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -751,9 +751,9 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893
+import com.google.common.collect.Sets;
+import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.block.BlockState;
+import org.bukkit.block.BlockType;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
@ -762,8 +762,9 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893
+
+import java.lang.management.ManagementFactory;
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import org.jetbrains.annotations.NotNull;
@ -797,7 +798,7 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893
+ private final MinuteReport[] minuteReports;
+
+ private final TimingHistoryEntry[] entries;
+ final Set<Material> tileEntityTypeSet = Sets.newHashSet();
+ final Set<BlockType> tileEntityTypeSet = Sets.newHashSet();
+ final Set<EntityType> entityTypeSet = Sets.newHashSet();
+ private final Map<Object, Object> worlds;
+
@ -868,20 +869,20 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893
+ public JSONPair apply(Map.Entry<EntityType, Counter> entry) {
+ entityTypeSet.add(entry.getKey());
+ return pair(
+ String.valueOf(entry.getKey().ordinal()),
+ entry.getKey().getKey().getKey().toUpperCase(Locale.ENGLISH),
+ entry.getValue().count()
+ );
+ }
+ }
+ ),
+ toObjectMapper(input.tileEntityCounts.entrySet(),
+ new Function<Map.Entry<Material, Counter>, JSONPair>() {
+ new Function<Map.Entry<BlockType, Counter>, JSONPair>() {
+ @NotNull
+ @Override
+ public JSONPair apply(Map.Entry<Material, Counter> entry) {
+ public JSONPair apply(Map.Entry<BlockType, Counter> entry) {
+ tileEntityTypeSet.add(entry.getKey());
+ return pair(
+ String.valueOf(entry.getKey().ordinal()),
+ entry.getKey().getKey().getKey().toUpperCase(Locale.ENGLISH),
+ entry.getValue().count()
+ );
+ }
@ -930,11 +931,11 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893
+
+ @SuppressWarnings("unchecked")
+ final Map<EntityType, Counter> entityCounts = MRUMapCache.of(LoadingMap.of(
+ new EnumMap<EntityType, Counter>(EntityType.class), k -> new Counter()
+ new HashMap<>(), k -> new Counter()
+ ));
+ @SuppressWarnings("unchecked")
+ final Map<Material, Counter> tileEntityCounts = MRUMapCache.of(LoadingMap.of(
+ new EnumMap<Material, Counter>(Material.class), k -> new Counter()
+ final Map<BlockType, Counter> tileEntityCounts = MRUMapCache.of(LoadingMap.of(
+ new HashMap<>(), k -> new Counter()
+ ));
+
+ static class RegionId {
@ -2854,10 +2855,10 @@ index 0000000000000000000000000000000000000000..3e61a926620a67daec3af54b72a1b911
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index cd9566aeace9e2e1e01fb014b0c50ba93af305d7..1f4df6984a8b8bd3e72a5eb7fb1c66b6bfddfbf5 100644
index 208825df2752c10caf2cf8fb860d5b25bdd429b2..e2f7f9ebed56f5d4ca23dafe313263b386121391 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -832,7 +832,6 @@ public final class Bukkit {
@@ -833,7 +833,6 @@ public final class Bukkit {
*/
public static void reload() {
server.reload();
@ -2866,10 +2867,10 @@ index cd9566aeace9e2e1e01fb014b0c50ba93af305d7..1f4df6984a8b8bd3e72a5eb7fb1c66b6
/**
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e359bc68007fbe62270ee62be762f844cbafe2d9..e773b40ff5fa9890c72e45e5c75a155bd7d02954 100644
index 7aacf5c174dc66df0f605236ace5bcd2c5689a3b..520cbdb2cc7da4550e9346ebdfea0e80f32a49b6 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1815,6 +1815,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1819,6 +1819,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
throw new UnsupportedOperationException("Not supported yet.");
}
@ -2897,10 +2898,10 @@ index e359bc68007fbe62270ee62be762f844cbafe2d9..e773b40ff5fa9890c72e45e5c75a155b
* Sends the component to the player
*
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 2042e3fb0ea347148814d9838cd7bb475bd23984..f68ef89f37057cf677a767026ab395f7a839a2f9 100644
index e800b6abb43fcb95937f1a8719761b4e2da84318..1a4212141fae926950a95e7bb584b28b21e20ba1 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -35,6 +35,7 @@ public interface UnsafeValues {
@@ -39,6 +39,7 @@ public interface UnsafeValues {
net.kyori.adventure.text.Component resolveWithContext(net.kyori.adventure.text.Component component, org.bukkit.command.CommandSender context, org.bukkit.entity.Entity scoreboardSubject, boolean bypassPermissions) throws java.io.IOException;
// Paper end
@ -2908,12 +2909,13 @@ index 2042e3fb0ea347148814d9838cd7bb475bd23984..f68ef89f37057cf677a767026ab395f7
Material toLegacy(Material material);
Material fromLegacy(Material material);
@@ -111,4 +112,12 @@ public interface UnsafeValues {
@@ -119,4 +120,13 @@ public interface UnsafeValues {
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
}
// Paper end
+ // Paper end
+
+ // Paper start
+ // Paper start - Timings
+ /**
+ * Server name to report to timings v2
+ * @return name
@ -3455,10 +3457,10 @@ index 516d7fc7812aac343782861d0d567f54aa578c2a..00000000000000000000000000000000
- // Spigot end
-}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 84e63caeabe3e44381a464bde47bcadaddba9d43..7303c09e078dad0855c96280174b2760eacc20cd 100644
index 5b5802be082f70a015b4a20c0ccdec1ee6f479f6..e7d6559f7a1e4cf88042a31e16d5b3370c2a0eb7 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2199,7 +2199,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2187,7 +2187,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Deprecated // Paper
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");

View file

@ -7,10 +7,10 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 1f4df6984a8b8bd3e72a5eb7fb1c66b6bfddfbf5..d77a7acb3ea82a331cb773bfda3e66d26a2bbd68 100644
index 51b5ac9d535d1ecac7719deed2e422db442a1171..6cae51327c3acf6aa0284be3c94d7fdf3cab3486 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -77,6 +77,20 @@ public final class Bukkit {
@@ -78,6 +78,20 @@ public final class Bukkit {
return server;
}
@ -32,10 +32,10 @@ index 1f4df6984a8b8bd3e72a5eb7fb1c66b6bfddfbf5..d77a7acb3ea82a331cb773bfda3e66d2
* Attempts to set the {@link Server} singleton.
* <p>
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e773b40ff5fa9890c72e45e5c75a155bd7d02954..76d28815a51d73fc79ef8bb5abe8fc7758e6fd23 100644
index c8a8305e41a55e98c99ed9df07f5763071a4485f..3d54c3c09203558e2c5348a9100af6809651f3e8 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -62,6 +62,18 @@ import org.jetbrains.annotations.Nullable;
@@ -63,6 +63,18 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7303c09e078dad0855c96280174b2760eacc20cd..c1affe53a8dc1d1219118610f1f0908c68bb7e51 100644
index 6de23a9dbaf012dd8a95bab55835bb406b59a012..592aae628d0b87b4277f1697b5aabde622d03710 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2051,6 +2051,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2039,6 +2039,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Deprecated // Paper
public String getLocale();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add getTPS method
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index d77a7acb3ea82a331cb773bfda3e66d26a2bbd68..b2effed0281997a64dd0fdc965bce2a54af0cf4d 100644
index 6cae51327c3acf6aa0284be3c94d7fdf3cab3486..3ea91c82670ae329a11b3d035378be047d91e3e8 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1940,6 +1940,17 @@ public final class Bukkit {
@@ -1941,6 +1941,17 @@ public final class Bukkit {
return server.getEntity(uuid);
}
@ -27,10 +27,10 @@ index d77a7acb3ea82a331cb773bfda3e66d26a2bbd68..b2effed0281997a64dd0fdc965bce2a5
* Get the advancement specified by this key.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 76d28815a51d73fc79ef8bb5abe8fc7758e6fd23..04f5191398dcfac02eb6553d549e77207c06e550 100644
index 3d54c3c09203558e2c5348a9100af6809651f3e8..0eeefd5eb693af9e16182d6e39e7b4a1d8568bfa 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1652,6 +1652,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1653,6 +1653,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
Entity getEntity(@NotNull UUID uuid);

View file

@ -56,10 +56,10 @@ index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c7
+ }
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index f68ef89f37057cf677a767026ab395f7a839a2f9..a6aa33b9574d0278e10927007a62290e1d102e73 100644
index c84dc62c7383deeb00106c2e672af2018c4acadc..4c2ae9cb674260deba91d734bf7bf24fd7038485 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -119,5 +119,12 @@ public interface UnsafeValues {
@@ -128,5 +128,12 @@ public interface UnsafeValues {
* @return name
*/
String getTimingsServerName();

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 598abaa82c634178043a29f6caa6ac5221659d06..70a32f89c16439c575d8928332cfed64d1d6ab7e 100644
index 9cebad10eb06f42cd0428d80940fa8e223f0deab..083201330c781a0cb36051eef4ab95d4f1937a9d 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -725,5 +725,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@ -25,10 +25,10 @@ index 598abaa82c634178043a29f6caa6ac5221659d06..70a32f89c16439c575d8928332cfed64
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index 9a57341691ebfbb6ec5a426a13f2fa5d61009b48..bd87d1548faa2fb095adce9f156f24163995dbe7 100644
index 60763c9b5b6528f5c8c83f53bb6cb8b1097a67b0..320a0e1f6b93ca9e85eac7d9a3f5821fa242c257 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -92,4 +92,15 @@ public interface FallingBlock extends Entity {
@@ -81,4 +81,15 @@ public interface FallingBlock extends Entity {
* @param damage the max damage to set. Must be >= 0
*/
void setMaxDamage(int damage);

View file

@ -8,10 +8,10 @@ Add per player no-tick, tick, and send view distances.
Also add send/no-tick view distance to World.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 5357291ff0f2f20bd87ab9f6e57f6a4f6ff65226..887aa6217583d224d66f6d238ac269c23725d459 100644
index d2e95c6ecc11b19ebb52c291884376c39d28467e..efe7ddee0c1321d3ab5c99d8e606ab04886c5d2c 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2662,6 +2662,62 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -2642,6 +2642,62 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
int getSimulationDistance();
// Spigot end
@ -75,10 +75,10 @@ index 5357291ff0f2f20bd87ab9f6e57f6a4f6ff65226..887aa6217583d224d66f6d238ac269c2
public class Spigot {
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c1affe53a8dc1d1219118610f1f0908c68bb7e51..05f0fca8f94da035512bb44aa6f0f99609b8afc6 100644
index 592aae628d0b87b4277f1697b5aabde622d03710..eee3f8fb587b54d90e892b8c5d0b2eb290059bd4 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2065,6 +2065,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2053,6 +2053,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param affects Whether the player can affect mob spawning
*/
public void setAffectsSpawning(boolean affects);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index b2effed0281997a64dd0fdc965bce2a54af0cf4d..f3a976ea2d7433623202c1d7cbf777608b0ba457 100644
index 3ea91c82670ae329a11b3d035378be047d91e3e8..6255c0b355dc978b50578629dc612011644a2501 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2141,6 +2141,19 @@ public final class Bukkit {
@@ -2145,6 +2145,19 @@ public final class Bukkit {
return server.getUnsafe();
}
@ -29,10 +29,10 @@ index b2effed0281997a64dd0fdc965bce2a54af0cf4d..f3a976ea2d7433623202c1d7cbf77760
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 04f5191398dcfac02eb6553d549e77207c06e550..c0c67866014940a1331cd714d5c6eb50256ae143 100644
index 0eeefd5eb693af9e16182d6e39e7b4a1d8568bfa..b711cc420d4ab150275b06162e3e9540252b5b06 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1662,6 +1662,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1663,6 +1663,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
public double[] getTPS();
// Paper end

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
Change Javadoc to be accurate
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index f3a976ea2d7433623202c1d7cbf777608b0ba457..77b267c50523433eee0fa35c6c5b8a9e121c0862 100644
index 6255c0b355dc978b50578629dc612011644a2501..ba65e37ce5b8b6c5e449c6bbe8fa7d6a83082f15 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -409,6 +409,30 @@ public final class Bukkit {
@@ -410,6 +410,30 @@ public final class Bukkit {
return server.broadcastMessage(message);
}
@ -41,10 +41,10 @@ index f3a976ea2d7433623202c1d7cbf777608b0ba457..77b267c50523433eee0fa35c6c5b8a9e
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c0c67866014940a1331cd714d5c6eb50256ae143..0e63d438a74b96075d7d8fb51ddbd21be3447377 100644
index b711cc420d4ab150275b06162e3e9540252b5b06..eac6eb66b00403ed0541201e54347a0286b4387b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -344,6 +344,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -345,6 +345,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Deprecated // Paper
public int broadcastMessage(@NotNull String message);
@ -76,10 +76,10 @@ index c0c67866014940a1331cd714d5c6eb50256ae143..0e63d438a74b96075d7d8fb51ddbd21b
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 05f0fca8f94da035512bb44aa6f0f99609b8afc6..f5d419920aa5b83b6c9f680cba6c87646c2be026 100644
index eee3f8fb587b54d90e892b8c5d0b2eb290059bd4..fe49a1871e1143bfd6579a5df02d6974e0eb7382 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -915,6 +915,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -903,6 +903,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void sendMap(@NotNull MapView map);

View file

@ -432,10 +432,10 @@ index 0000000000000000000000000000000000000000..9e90c3df567a65b48a0b9341f784eb90
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index f5d419920aa5b83b6c9f680cba6c87646c2be026..28ca7231bfd8b5381b54ea323dfa2c3a972c9700 100644
index fe49a1871e1143bfd6579a5df02d6974e0eb7382..14f101acef4063c15d9c8c1e24eee33a4f4debb6 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -949,6 +949,131 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -937,6 +937,131 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
spigot().sendMessage(position, components);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Complete resource pack API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 28ca7231bfd8b5381b54ea323dfa2c3a972c9700..d980cc3ed54db4bdf22c73d75d99871f1b16ecb0 100644
index 14f101acef4063c15d9c8c1e24eee33a4f4debb6..3a1e584d584041f36b861e4507f7a58933f9b32d 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1529,7 +1529,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1517,7 +1517,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the URL is null.
* @throws IllegalArgumentException Thrown if the URL is too long. The
* length restriction is an implementation specific arbitrary value.
@ -18,7 +18,7 @@ index 28ca7231bfd8b5381b54ea323dfa2c3a972c9700..d980cc3ed54db4bdf22c73d75d99871f
public void setResourcePack(@NotNull String url);
/**
@@ -2355,6 +2357,124 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2343,6 +2345,124 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) {
return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.displayName())));
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add command to reload permissions.yml and require confirm to
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 77b267c50523433eee0fa35c6c5b8a9e121c0862..0b9b28b7a07a8176142b18cfa767c81f5035d52d 100644
index ba65e37ce5b8b6c5e449c6bbe8fa7d6a83082f15..5c7a7d1cb0fc760f4209061aa653fdedb729dd36 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2176,6 +2176,13 @@ public final class Bukkit {
@@ -2180,6 +2180,13 @@ public final class Bukkit {
public static org.bukkit.command.CommandMap getCommandMap() {
return server.getCommandMap();
}
@ -24,10 +24,10 @@ index 77b267c50523433eee0fa35c6c5b8a9e121c0862..0b9b28b7a07a8176142b18cfa767c81f
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0e63d438a74b96075d7d8fb51ddbd21be3447377..e76c11688760a24f8395f562108b4c5fd7139b42 100644
index eac6eb66b00403ed0541201e54347a0286b4387b..27ff3b0b594bca7c5ae45937e1044e1b2f30c60b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1923,4 +1923,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1927,4 +1927,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
Spigot spigot();
// Spigot end

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0b9b28b7a07a8176142b18cfa767c81f5035d52d..22d9538abe61ccb3e5d3ae407d54446fa172fa39 100644
index 5c7a7d1cb0fc760f4209061aa653fdedb729dd36..763ba521c4b2cdfd0fda062281207dc790db76e1 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2183,6 +2183,15 @@ public final class Bukkit {
@@ -2187,6 +2187,15 @@ public final class Bukkit {
public static void reloadPermissions() {
server.reloadPermissions();
}
@ -26,10 +26,10 @@ index 0b9b28b7a07a8176142b18cfa767c81f5035d52d..22d9538abe61ccb3e5d3ae407d54446f
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e76c11688760a24f8395f562108b4c5fd7139b42..26516ae5519675dac359b578d0f06ea2c0745ab3 100644
index 27ff3b0b594bca7c5ae45937e1044e1b2f30c60b..459ca6d2a797c4007fda3129badd44f35335615d 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1925,4 +1925,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1929,4 +1929,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Spigot end
void reloadPermissions(); // Paper

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add String based Action Bar API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index d980cc3ed54db4bdf22c73d75d99871f1b16ecb0..5b9480a3d06155c391f1347cb56fde9612d75ed8 100644
index 3a1e584d584041f36b861e4507f7a58933f9b32d..5d47d3089f244b146aab63d54f5aefba51e481a9 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -916,6 +916,39 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -904,6 +904,39 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(@NotNull MapView map);
// Paper start
@ -48,7 +48,7 @@ index d980cc3ed54db4bdf22c73d75d99871f1b16ecb0..5b9480a3d06155c391f1347cb56fde96
/**
* Sends the component to the player
*
@@ -943,9 +976,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -931,9 +964,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends an array of components as a single message to the specified screen position of this player
*

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration option to prevent player names from being
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 22d9538abe61ccb3e5d3ae407d54446fa172fa39..68a79316cec0c4ab83c6f986e3a9561440994319 100644
index 763ba521c4b2cdfd0fda062281207dc790db76e1..0e83259a03292daf5c069d570a324ae0323351ef 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2192,6 +2192,16 @@ public final class Bukkit {
@@ -2196,6 +2196,16 @@ public final class Bukkit {
public static boolean reloadCommandAliases() {
return server.reloadCommandAliases();
}
@ -27,10 +27,10 @@ index 22d9538abe61ccb3e5d3ae407d54446fa172fa39..68a79316cec0c4ab83c6f986e3a95614
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 26516ae5519675dac359b578d0f06ea2c0745ab3..0cf214c45078d83d678f12f6cb350e50fc5f1e94 100644
index 459ca6d2a797c4007fda3129badd44f35335615d..f8592dbe75680133e5db1e166fac48957c57cac9 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1927,4 +1927,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1931,4 +1931,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
void reloadPermissions(); // Paper
boolean reloadCommandAliases(); // Paper

View file

@ -53,10 +53,10 @@ index 96ef22fe879c7be4f67bbb4d60c45ad11764dd5b..5dc9f9ede98d93925c99ee382e93f15f
* @param target the target to remove from this list
*/
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 68a79316cec0c4ab83c6f986e3a9561440994319..316fc8348445b99af7ffc7c4ad24948a1115dfe6 100644
index 0e83259a03292daf5c069d570a324ae0323351ef..1704d04097c9d364e5f9049a6a0f60945db482dd 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1299,10 +1299,7 @@ public final class Bukkit {
@@ -1300,10 +1300,7 @@ public final class Bukkit {
}
/**
@ -68,7 +68,7 @@ index 68a79316cec0c4ab83c6f986e3a9561440994319..316fc8348445b99af7ffc7c4ad24948a
*
* @param type the type of list to fetch, cannot be null
* @return a ban list of the specified type
@@ -1364,6 +1361,8 @@ public final class Bukkit {
@@ -1365,6 +1362,8 @@ public final class Bukkit {
/**
* Gets every player that has ever played on this server.
@ -78,10 +78,10 @@ index 68a79316cec0c4ab83c6f986e3a9561440994319..316fc8348445b99af7ffc7c4ad24948a
* @return an array containing all previous players
*/
diff --git a/src/main/java/org/bukkit/ChunkSnapshot.java b/src/main/java/org/bukkit/ChunkSnapshot.java
index 0cf808356a1a5c6fc4bcf97a694ed9beb80a776a..dc765dea47a9a1c1520fb16ddb24f81413ed0dd1 100644
index 803d4de580acc616424922fee4715a689b778886..94ab204a0739163613a5c651329606924c75d85b 100644
--- a/src/main/java/org/bukkit/ChunkSnapshot.java
+++ b/src/main/java/org/bukkit/ChunkSnapshot.java
@@ -136,7 +136,7 @@ public interface ChunkSnapshot {
@@ -137,7 +137,7 @@ public interface ChunkSnapshot {
* Get raw biome temperature at given coordinates
*
* @param x X-coordinate (0-15)
@ -91,10 +91,10 @@ index 0cf808356a1a5c6fc4bcf97a694ed9beb80a776a..dc765dea47a9a1c1520fb16ddb24f814
* @return temperature at given coordinate
*/
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
index 43f5aab2fe70af5f570de1f21eca83905f1e2f57..05c29cbd2ae1ca0434a90f8389479bd608ca2ac1 100644
index a73c954aad2957c630b64e7b750f33f73809f9b1..8264599a873ed23ec6552d1550a414ec3712487b 100644
--- a/src/main/java/org/bukkit/RegionAccessor.java
+++ b/src/main/java/org/bukkit/RegionAccessor.java
@@ -158,7 +158,7 @@ public interface RegionAccessor {
@@ -159,7 +159,7 @@ public interface RegionAccessor {
* Creates a tree at the given {@link Location}
*
* @param location Location to spawn the tree
@ -103,7 +103,7 @@ index 43f5aab2fe70af5f570de1f21eca83905f1e2f57..05c29cbd2ae1ca0434a90f8389479bd6
* @param type Type of the tree to create
* @return true if the tree was created successfully, otherwise false
*/
@@ -170,14 +170,14 @@ public interface RegionAccessor {
@@ -171,14 +171,14 @@ public interface RegionAccessor {
* The provided consumer gets called for every block which gets changed
* as a result of the tree generation. When the consumer gets called no
* modifications to the world are done yet. Which means, that calling
@ -120,7 +120,7 @@ index 43f5aab2fe70af5f570de1f21eca83905f1e2f57..05c29cbd2ae1ca0434a90f8389479bd6
* @param type Type of the tree to create
* @param stateConsumer The consumer which should get called for every block which gets changed
* @return true if the tree was created successfully, otherwise false
@@ -197,7 +197,7 @@ public interface RegionAccessor {
@@ -198,7 +198,7 @@ public interface RegionAccessor {
* If it returns {@code false} the block won't get set in the world.
*
* @param location Location to spawn the tree
@ -130,10 +130,10 @@ index 43f5aab2fe70af5f570de1f21eca83905f1e2f57..05c29cbd2ae1ca0434a90f8389479bd6
* @param statePredicate The predicate which should get used to test if a block should be set or not.
* @return true if the tree was created successfully, otherwise false
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0cf214c45078d83d678f12f6cb350e50fc5f1e94..d7b081ac72d7d2aa3b675c6cbb8fb66f73facc99 100644
index f8592dbe75680133e5db1e166fac48957c57cac9..dca2cbe8c93469c8c1c404bc34748a9dcf6d3368 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -542,13 +542,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -543,13 +543,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* </ul>
* <p>
* <b>Note:</b> If set to 0, {@link SpawnCategory} mobs spawning will be disabled.
@ -148,7 +148,7 @@ index 0cf214c45078d83d678f12f6cb350e50fc5f1e94..d7b081ac72d7d2aa3b675c6cbb8fb66f
*/
public int getTicksPerSpawns(@NotNull SpawnCategory spawnCategory);
@@ -1108,10 +1105,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1109,10 +1106,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
public Set<OfflinePlayer> getBannedPlayers();
/**
@ -160,7 +160,7 @@ index 0cf214c45078d83d678f12f6cb350e50fc5f1e94..d7b081ac72d7d2aa3b675c6cbb8fb66f
*
* @param type the type of list to fetch, cannot be null
* @return a ban list of the specified type
@@ -1161,6 +1155,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1162,6 +1156,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
/**
* Gets every player that has ever played on this server.
@ -170,10 +170,10 @@ index 0cf214c45078d83d678f12f6cb350e50fc5f1e94..d7b081ac72d7d2aa3b675c6cbb8fb66f
* @return an array containing all previous players
*/
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 4ef6bbfa753da439ac57bd8d70dd114d73665c8d..7f23527168a33b92d823f76765edfe00abe0e4f6 100644
index 80189c7c70d7043016a24c0ac87655636408856e..a53a990477fd84f7f7dcb50058819eead8e8b5b5 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2576,7 +2576,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -2556,7 +2556,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
/**
* Find the closest nearby structure of a given {@link StructureType}.
* Finding unexplored structures can, and will, block if the world is
@ -182,7 +182,7 @@ index 4ef6bbfa753da439ac57bd8d70dd114d73665c8d..7f23527168a33b92d823f76765edfe00
* temporarily freezing while locating an unexplored structure.
* <p>
* The {@code radius} is not a rigid square radius. Each structure may alter
@@ -2610,7 +2610,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -2590,7 +2590,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
/**
* Find the closest nearby structure of a given {@link StructureType}.
* Finding unexplored structures can, and will, block if the world is
@ -191,7 +191,7 @@ index 4ef6bbfa753da439ac57bd8d70dd114d73665c8d..7f23527168a33b92d823f76765edfe00
* temporarily freezing while locating an unexplored structure.
* <p>
* The {@code radius} is not a rigid square radius. Each structure may alter
@@ -2643,7 +2643,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -2623,7 +2623,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
/**
* Find the closest nearby structure of a given {@link Structure}. Finding
* unexplored structures can, and will, block if the world is looking in
@ -201,14 +201,14 @@ index 4ef6bbfa753da439ac57bd8d70dd114d73665c8d..7f23527168a33b92d823f76765edfe00
* <p>
* The {@code radius} is not a rigid square radius. Each structure may alter
diff --git a/src/main/java/org/bukkit/block/Bed.java b/src/main/java/org/bukkit/block/Bed.java
index f9bd74f9ce6bd6650726e5a993f9b6e292cdc74d..f4c37ce1fe7aac3dde8485ee51fc8888ed56e79e 100644
index 92532e335f07b14d1dad0de90c10f764d5fd9d8b..f4c37ce1fe7aac3dde8485ee51fc8888ed56e79e 100644
--- a/src/main/java/org/bukkit/block/Bed.java
+++ b/src/main/java/org/bukkit/block/Bed.java
@@ -4,7 +4,22 @@ import org.bukkit.material.Colorable;
/**
* Represents a captured state of a bed.
- * @deprecated does not provide useful information beyond the material itself
- * @deprecated does not provide useful information beyond the block type itself
*/
-@Deprecated
-public interface Bed extends TileState, Colorable { }
@ -231,10 +231,10 @@ index f9bd74f9ce6bd6650726e5a993f9b6e292cdc74d..f4c37ce1fe7aac3dde8485ee51fc8888
+// Paper end
+}
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index f8e12868f2e629cdf4784f0157fdb2f8e7b01f99..870ad6cd930653e6248abcc0fce94ffafbe9ebde 100644
index 1197cb8a6be92296c494010d87e046dfe912a161..d834e8d8d532ce5b46201ff5c02d54a6c047f615 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -357,7 +357,7 @@ public interface Block extends Metadatable, Translatable {
@@ -356,7 +356,7 @@ public interface Block extends Metadatable, Translatable {
* Gets the temperature of this block.
* <p>
* If the raw biome temperature without adjusting for height effects is
@ -244,18 +244,27 @@ index f8e12868f2e629cdf4784f0157fdb2f8e7b01f99..870ad6cd930653e6248abcc0fce94ffa
* @return Temperature of this block
*/
diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java
index 2e2232956f626669005cfdfd6550aa8ee29fc1ab..869fa47a13fbcb128228963bf53cc72da4499a01 100644
index dd286dd68682658af096790c048b88ee0c401214..7f4a858ab98f8d0c3c2f890ca88bc13b6ba967fa 100644
--- a/src/main/java/org/bukkit/block/data/BlockData.java
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
@@ -215,7 +215,7 @@ public interface BlockData extends Cloneable {
* {@link Material#REDSTONE_WIRE} -> {@link Material#REDSTONE}
* {@link Material#CARROTS} -> {@link Material#CARROT}
@@ -208,15 +208,13 @@ public interface BlockData extends Cloneable {
/**
* Gets the ItemType that a player would use to place this block.
* <p>
- * For most blocks this is the same as {@link BlockType#asItemType()} but some blocks
- * have different item types used to place them.
- *
+ * This is identical to {@link BlockType#getItemType()}.
* For example:
* <pre>
* {@link ItemType#REDSTONE_WIRE} -> {@link BlockType#REDSTONE}
* {@link ItemType#CARROTS} -> {@link BlockType#CARROT}
* </pre>
- * @return placement material
+ * @return placement material or {@link Material#AIR} if it doesn't have one
- * @return placement item type
+ * @return placement item type or {@link ItemType#AIR} if it doesn't have one
*/
@NotNull
Material getPlacementMaterial();
ItemType getPlacementType();
diff --git a/src/main/java/org/bukkit/block/data/FaceAttachable.java b/src/main/java/org/bukkit/block/data/FaceAttachable.java
index 9599e1237b9717ddbf84c3738bf6c1293e8b3c54..950266b4bb0a2fabeb9539c5676ed58f0b0fe620 100644
--- a/src/main/java/org/bukkit/block/data/FaceAttachable.java
@ -331,10 +340,10 @@ index 91fc11dda99de506be83d40df8929bf7cd8e8d85..7dc631ebd009f5f5c3ac1699c3f3515c
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Arrow.java b/src/main/java/org/bukkit/entity/Arrow.java
index 8814519df13c5e9475774f4bce4c8c6a462c2978..be9a35790fc664721ac94f3708613eb77631a0c5 100644
index 8eb0cf31b1ce6d714a14cf65bbb117ff163ae2f3..8e57082e8b19a2fd9625816c2ea4a90d41f78ca5 100644
--- a/src/main/java/org/bukkit/entity/Arrow.java
+++ b/src/main/java/org/bukkit/entity/Arrow.java
@@ -73,7 +73,7 @@ public interface Arrow extends AbstractArrow {
@@ -93,7 +93,7 @@ public interface Arrow extends AbstractArrow {
* Removes a custom potion effect from this arrow.
*
* @param type the potion effect type to remove
@ -356,8 +365,32 @@ index 0449664d7cd0c52ac34d2101110f1ab42070257c..57f8e7bf4c7b4c4a4e793cfd5d7db743
* the portal, it will fly to it before mounting.
*/
LAND_ON_PORTAL,
diff --git a/src/main/java/org/bukkit/entity/EntityCategory.java b/src/main/java/org/bukkit/entity/EntityCategory.java
index fd960f20c79f721575c9bd4074a5ca9ab6b796b1..3e2ae87c806ce439d6c8848deecda48a28dbed96 100644
--- a/src/main/java/org/bukkit/entity/EntityCategory.java
+++ b/src/main/java/org/bukkit/entity/EntityCategory.java
@@ -23,7 +23,7 @@ public enum EntityCategory {
* <li>Are subject to burning in daylight (though not all).
* <li>Sink in water (except {@link Drowned}, {@link Phantom Phantoms}
* and {@link Wither Withers}).
- * <li>Take additional damage from {@link Enchantment#DAMAGE_UNDEAD}.
+ * <li>Take additional damage from {@link Enchantment#SMITE}.
* <li>Are ignored by {@link Wither Withers}.
* </ul>
*/
@@ -31,8 +31,8 @@ public enum EntityCategory {
/**
* Entities of the arthropod family. These creatures:
* <ul>
- * <li>Take additional damage and receive {@link PotionEffectType#SLOW}
- * from {@link Enchantment#DAMAGE_ARTHROPODS}.
+ * <li>Take additional damage and receive {@link PotionEffectType#SLOWNESS}
+ * from {@link Enchantment#BANE_OF_ARTHROPODS}.
* <li>Are immune to {@link PotionEffectType#POISON} if they are spiders.
* </ul>
*/
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 09936f3a2376a46721bbc8365c989581c2a789ef..3845a726adbd0e75d7bf2aeeb6da8cb571d51a8f 100644
index f2faa8b9a7da1c9af26f494ae82ae5372dcc4805..411dbbd8046a3157747713fea9ae19eca113e9b7 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -22,6 +22,11 @@ import org.jetbrains.annotations.Nullable;
@ -414,7 +447,7 @@ index ae9eaaa8e38e1d9dfc459926c7fc51ddb89de84a..b2ec535bb1b0ce0c114ddd7638b90218
@Override
public int getConversionTime();
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 5b9480a3d06155c391f1347cb56fde9612d75ed8..26236250f4418def6f65c811800063588b43fa84 100644
index 5d47d3089f244b146aab63d54f5aefba51e481a9..383d12b1ffc76bc8f9100a71027ac9e25e4a3742 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -327,15 +327,15 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@ -446,7 +479,7 @@ index 5b9480a3d06155c391f1347cb56fde9612d75ed8..26236250f4418def6f65c81180006358
* @param loc the location to play the effect at
* @param effect the {@link Effect}
* @param data a data bit needed for some effects
@@ -933,7 +933,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -921,7 +921,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* Use supplied alternative character to the section symbol to represent legacy color codes.
*
@ -455,7 +488,7 @@ index 5b9480a3d06155c391f1347cb56fde9612d75ed8..26236250f4418def6f65c81180006358
* @param message The message to send
* @deprecated use {@link #sendActionBar(net.kyori.adventure.text.Component)}
*/
@@ -1399,7 +1399,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1387,7 +1387,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Allows this player to see a player that was previously hidden. If
@ -464,7 +497,7 @@ index 5b9480a3d06155c391f1347cb56fde9612d75ed8..26236250f4418def6f65c81180006358
* remain hidden until the other plugin calls this method too.
*
* @param plugin Plugin that wants to show the player
@@ -1428,7 +1428,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1416,7 +1416,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Allows this player to see an entity that was previously hidden. If
@ -518,18 +551,18 @@ index af5110b4160979c39cc1e5de6fa3bd7957b21403..15a0a733b0e5804655b5957cbf208312
* @param location the location to remove
* @see #getExploredLocations()
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
index 6bf3af3ed81b66f61e53105d3591165ea74dba0e..a91400cd8bb4c72d1f3200a17f6de025540fe09d 100644
index fb4c6f92c7c16ff8cdc0a054a270b41d78dfcdde..a6e57f8ad3f09d05ca61c824d128221528f7a96d 100644
--- a/src/main/java/org/bukkit/entity/Villager.java
+++ b/src/main/java/org/bukkit/entity/Villager.java
@@ -202,7 +202,7 @@ public interface Villager extends AbstractVillager {
@@ -225,7 +225,7 @@ public interface Villager extends AbstractVillager {
*/
NITWIT,
public static final Profession NITWIT = getProfession("nitwit");
/**
- * Sheperd profession. Wears a brown robe. Shepherds primarily trade for
+ * Shepherd profession. Wears a brown robe. Shepherds primarily trade for
* wool items, and shears.
*/
SHEPHERD,
public static final Profession SHEPHERD = getProfession("shepherd");
diff --git a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
index 44f7f6939a27b9a0a796d91eac4b7c97ec90a643..641c71ab66bd2499b35cf3c1d533fd105d096e10 100644
--- a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
@ -546,7 +579,7 @@ index 44f7f6939a27b9a0a796d91eac4b7c97ec90a643..641c71ab66bd2499b35cf3c1d533fd10
public class BlockExplodeEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
diff --git a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
index be0a2d1f234d8265d98e54e518a994957b1f3ab7..4e3c406ba883aae553e8d69b6b719b872cd6096c 100644
index ff20d0768aed1732dcef8989c62e19c01e8ec70a..a4525c1ac5e6aa0130358739db35fbb732476e33 100644
--- a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
@@ -114,7 +114,7 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
@ -774,7 +807,7 @@ index 4c2102a11c3d682d98f0db4ccafa35231e66bcdd..ca238af544764273b9cd4cf3587e8632
public class PlayerResourcePackStatusEvent extends PlayerEvent {
diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java
index 0cc6e29a5af28e95f87f415d6b2424d4622a6f34..c0b749a5bbf4980d01fed74768bb61909b579cb9 100644
index 08d656ee57b080e07b7b7d97c9551fb0a0e3e94b..82d8fe3be9ff6914b44872462c3827123459735d 100644
--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java
+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java
@@ -627,7 +627,7 @@ public abstract class ChunkGenerator {
@ -1045,45 +1078,41 @@ index 62fbd7f6d8195bebcab7f704a0a485a1bbeca26c..5461f7fa75f5a065bb333b4a113640b5
* @return the currently held item
* @see #getItemInMainHand()
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index 8971ec20d36c4d1a8fb07ec4603221791a2b52b4..4c7f30877c608e327908a61e4bd68789191e2f3c 100644
index a9dbb11148e5bdf3e6c251bc98b6a8295aceba2f..e92de5ca8bd48723a493495db3ca2e2f5b55fab5 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -30,8 +30,6 @@ public class ShapedRecipe implements Recipe, Keyed {
@@ -29,7 +29,6 @@ public class ShapedRecipe implements Recipe, Keyed {
* @param result The item you want the recipe to create.
* @see ShapedRecipe#shape(String...)
* @see ShapedRecipe#setIngredient(char, Material)
- * @see ShapedRecipe#setIngredient(char, Material, int)
* @see ShapedRecipe#setIngredient(char, ItemType)
- * @see ShapedRecipe#setIngredient(char, MaterialData)
* @see ShapedRecipe#setIngredient(char, RecipeChoice)
* @deprecated Recipes must have keys. Use {@link #ShapedRecipe(NamespacedKey, ItemStack)}
* instead.
@@ -52,8 +50,6 @@ public class ShapedRecipe implements Recipe, Keyed {
@@ -50,7 +49,6 @@ public class ShapedRecipe implements Recipe, Keyed {
* @param result The item you want the recipe to create.
* @see ShapedRecipe#shape(String...)
* @see ShapedRecipe#setIngredient(char, Material)
- * @see ShapedRecipe#setIngredient(char, Material, int)
* @see ShapedRecipe#setIngredient(char, ItemType)
- * @see ShapedRecipe#setIngredient(char, MaterialData)
* @see ShapedRecipe#setIngredient(char, RecipeChoice)
*/
public ShapedRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result) {
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index df4c52f1f0be2409c7506b09167bd58b5602fa7a..74449a635aca84adcc1652e1e85f2d27dcaf6842 100644
index 94393a1f0d19a58a1029f9c31193b3d9279c5ef0..69a25d05efcc96f8b3d3b5455e571259e5af2dab 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -38,11 +38,8 @@ public class ShapelessRecipe implements Recipe, Keyed {
@@ -37,9 +37,8 @@ public class ShapelessRecipe implements Recipe, Keyed {
* @param key the unique recipe key
* @param result The item you want the recipe to create.
* @see ShapelessRecipe#addIngredient(Material)
* @see ShapelessRecipe#addIngredient(ItemType)
- * @see ShapelessRecipe#addIngredient(MaterialData)
- * @see ShapelessRecipe#addIngredient(Material,int)
* @see ShapelessRecipe#addIngredient(int,Material)
* @see ShapelessRecipe#addIngredient(int,ItemType)
- * @see ShapelessRecipe#addIngredient(int,MaterialData)
- * @see ShapelessRecipe#addIngredient(int,Material,int)
+ * @see ShapelessRecipe#addIngredient(RecipeChoice)
*/
public ShapelessRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result) {
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
@@ -184,7 +181,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
Preconditions.checkArgument(result.getType() != ItemType.AIR, "Recipe must have non-AIR result.");
@@ -147,7 +146,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
/**
* Removes multiple instances of an ingredient from the list. If there are
@ -1107,10 +1136,10 @@ index af04071d37e70b8cc9837d57477c8493be8afb9f..582671a0a94d47302c0fdc572d486282
this.key = key;
this.result = result;
diff --git a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
index 07c3dff4d6190ef388d9c1e1c36f67f00a3e8e66..597a18a767b68b47e81454b7d44613c7178c1366 100644
index 8df05b404eb1bcbe1bf358b8cb34c46f25ceeba1..0de3c34c67b8c37a3c7ba8bcec4404ed4ef5019e 100644
--- a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
+++ b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
@@ -28,7 +28,7 @@ public class StonecuttingRecipe implements Recipe, Keyed {
@@ -33,7 +33,7 @@ public class StonecuttingRecipe implements Recipe, Keyed {
}
/**
@ -1119,16 +1148,16 @@ index 07c3dff4d6190ef388d9c1e1c36f67f00a3e8e66..597a18a767b68b47e81454b7d44613c7
*
* @param key The unique recipe key
* @param result The item you want the recipe to create.
@@ -42,7 +42,7 @@ public class StonecuttingRecipe implements Recipe, Keyed {
@@ -47,7 +47,7 @@ public class StonecuttingRecipe implements Recipe, Keyed {
}
/**
- * Sets the input of this cooking recipe.
+ * Sets the input of this Stonecutting recipe.
*
* @param input The input material.
* @param input The input item type.
* @return The changed recipe, so you can chain calls.
@@ -64,7 +64,7 @@ public class StonecuttingRecipe implements Recipe, Keyed {
@@ -69,7 +69,7 @@ public class StonecuttingRecipe implements Recipe, Keyed {
}
/**
@ -1150,6 +1179,28 @@ index 049c70c935fd7a781280d223f74bbbf87223f505..f78714c2a6d9da162c9802552984cbfa
* {@link EquipmentSlot} will be returned. This is because
* AttributeModifiers without a slot are active in any slot.<br>
* If there are no attributes set for the given slot, an empty map
diff --git a/src/main/java/org/bukkit/loot/LootContext.java b/src/main/java/org/bukkit/loot/LootContext.java
index 71b7aa9d675e1714e286e6fd4015ead036d912e0..b35dba42069f771db8727bf98f9d17aff9d6094e 100644
--- a/src/main/java/org/bukkit/loot/LootContext.java
+++ b/src/main/java/org/bukkit/loot/LootContext.java
@@ -54,7 +54,7 @@ public final class LootContext {
/**
* Represents the
- * {@link org.bukkit.enchantments.Enchantment#LOOT_BONUS_MOBS} the
+ * {@link org.bukkit.enchantments.Enchantment#LOOTING} the
* {@link #getKiller()} entity has on their equipped item.
*
* This value is only set via
@@ -124,7 +124,7 @@ public final class LootContext {
}
/**
- * Set the {@link org.bukkit.enchantments.Enchantment#LOOT_BONUS_MOBS}
+ * Set the {@link org.bukkit.enchantments.Enchantment#LOOTING}
* level equivalent to use when generating loot. Values less than or
* equal to 0 will force the {@link LootTable} to only return a single
* {@link org.bukkit.inventory.ItemStack} per pool.
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
index 86a0a6f9e8487d6dfaf60876ace3dcc9b4722826..571b43c2809d2b248feebc7decba6017a67c8aee 100644
--- a/src/main/java/org/bukkit/scoreboard/Objective.java

View file

@ -321,10 +321,10 @@ index 0000000000000000000000000000000000000000..7b3b6ef533d32169fbeca389bd61cfc6
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 316fc8348445b99af7ffc7c4ad24948a1115dfe6..10eeb288ef41dfc6bd70fc8f6ec218dabc60b2a4 100644
index 1704d04097c9d364e5f9049a6a0f60945db482dd..9935ca77536c8fa30881376e20cd3193f22879fb 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2201,6 +2201,83 @@ public final class Bukkit {
@@ -2205,6 +2205,83 @@ public final class Bukkit {
public static boolean suggestPlayerNamesWhenNullTabCompletions() {
return server.suggestPlayerNamesWhenNullTabCompletions();
}
@ -409,10 +409,10 @@ index 316fc8348445b99af7ffc7c4ad24948a1115dfe6..10eeb288ef41dfc6bd70fc8f6ec218da
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index d7b081ac72d7d2aa3b675c6cbb8fb66f73facc99..1487b5de4fba5304b7e2105c6f88872923aa7974 100644
index dca2cbe8c93469c8c1c404bc34748a9dcf6d3368..136ae88a23ac02f79960d4ee99041486b41806f5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1932,5 +1932,74 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1936,5 +1936,74 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if player names should be suggested
*/
boolean suggestPlayerNamesWhenNullTabCompletions();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 3845a726adbd0e75d7bf2aeeb6da8cb571d51a8f..abdca9fe5acc90f167219eb769ece66c35682bb1 100644
index 411dbbd8046a3157747713fea9ae19eca113e9b7..7f12a18a77838266c0394da078a958c6bfb0e776 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -339,6 +339,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@@ -336,6 +336,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/
public int getExpToLevel();

View file

@ -8,10 +8,10 @@ Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar.
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index af4a7ce37eb10bab06eadb6583c7894b3ec55ae6..159e5a908b35b84b7fabc36581e093d9aa4c4b67 100644
index d0530328536840ce126b39942fac35a476ea2ac4..193e36ca6ea3b6528e53ebd07bbd8775b12993af 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -178,5 +178,19 @@ public interface ItemFactory {
@@ -177,5 +177,19 @@ public interface ItemFactory {
*/
@NotNull
net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack);
@ -32,10 +32,10 @@ index af4a7ce37eb10bab06eadb6583c7894b3ec55ae6..159e5a908b35b84b7fabc36581e093d9
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 9d327f0832c40d4a8d212346284274f6cf78834f..09a36df6edce2a283df80c67d5ef62da7ff73555 100644
index 7e6c2bcf42d271184a75c91ecded5824535b3455..b8dfe0d1cebb944dfffc97ac74fdecda2f4884a2 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -618,5 +618,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -668,5 +668,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public net.kyori.adventure.text.@NotNull Component displayName() {
return Bukkit.getServer().getItemFactory().displayName(this);
}

View file

@ -7,10 +7,10 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 159e5a908b35b84b7fabc36581e093d9aa4c4b67..349da0065ddf000cacdc259fab0f2c759332e9ad 100644
index 193e36ca6ea3b6528e53ebd07bbd8775b12993af..c8e1377f804c50d41ad29c6c67dea58526d28125 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -192,5 +192,17 @@ public interface ItemFactory {
@@ -191,5 +191,17 @@ public interface ItemFactory {
@Nullable
@Deprecated
String getI18NDisplayName(@Nullable ItemStack item);
@ -29,10 +29,10 @@ index 159e5a908b35b84b7fabc36581e093d9aa4c4b67..349da0065ddf000cacdc259fab0f2c75
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 09a36df6edce2a283df80c67d5ef62da7ff73555..a8faa4c1881bae4d47d901388a78b991d138b518 100644
index b8dfe0d1cebb944dfffc97ac74fdecda2f4884a2..923f160407a2d4be71ef42a387cb803712404c43 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -537,7 +537,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -587,7 +587,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
}
}
@ -41,7 +41,7 @@ index 09a36df6edce2a283df80c67d5ef62da7ff73555..a8faa4c1881bae4d47d901388a78b991
}
/**
@@ -619,6 +619,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -669,6 +669,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return Bukkit.getServer().getItemFactory().displayName(this);
}

View file

@ -6,12 +6,13 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..e406ce639a2e88b78f82f25e71678a669d0a958b
index 0000000000000000000000000000000000000000..b1985f57d0e52df49304964797dfbbe9a7578ddd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
@@ -0,0 +1,137 @@
@@ -0,0 +1,189 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
@ -22,10 +23,12 @@ index 0000000000000000000000000000000000000000..e406ce639a2e88b78f82f25e71678a66
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import org.bukkit.inventory.ItemType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.Unmodifiable;
+
+import static org.bukkit.Material.*;
+import static org.bukkit.inventory.ItemType.*;
+
+/**
+ * Called when the player themselves change their armor items
@ -98,10 +101,12 @@ index 0000000000000000000000000000000000000000..e406ce639a2e88b78f82f25e71678a66
+ LEGS(NETHERITE_LEGGINGS, DIAMOND_LEGGINGS, GOLDEN_LEGGINGS, IRON_LEGGINGS, CHAINMAIL_LEGGINGS, LEATHER_LEGGINGS),
+ FEET(NETHERITE_BOOTS, DIAMOND_BOOTS, GOLDEN_BOOTS, IRON_BOOTS, CHAINMAIL_BOOTS, LEATHER_BOOTS);
+
+ private final Set<Material> mutableTypes = new HashSet<>();
+ private Set<Material> immutableTypes;
+ private final Set<ItemType> mutableTypes = new HashSet<>();
+ private Set<ItemType> immutableTypes;
+ @Deprecated
+ private Set<Material> legacyTypes;
+
+ SlotType(Material... types) {
+ SlotType(ItemType... types) {
+ this.mutableTypes.addAll(Arrays.asList(types));
+ }
+
@ -110,14 +115,32 @@ index 0000000000000000000000000000000000000000..e406ce639a2e88b78f82f25e71678a66
+ * armor slot.
+ *
+ * @return immutable set of material types
+ * @deprecated use {@link #getItemTypes()}
+ */
+ @Deprecated
+ public @NotNull @Unmodifiable Set<Material> getTypes() {
+ if (this.legacyTypes == null) {
+ this.legacyTypes = new HashSet<>();
+ for (final ItemType itemType : this.getItemTypes()) {
+ this.legacyTypes.add(Bukkit.getUnsafe().toMaterial(itemType));
+ }
+ }
+ return Collections.unmodifiableSet(this.legacyTypes);
+ }
+
+ /**
+ * Gets an immutable set of all allowed item types that can be placed in an
+ * armor slot.
+ *
+ * @return immutable set of item types
+ */
+ @NotNull
+ public Set<Material> getTypes() {
+ if (immutableTypes == null) {
+ immutableTypes = Collections.unmodifiableSet(mutableTypes);
+ public @Unmodifiable Set<ItemType> getItemTypes() {
+ if (this.immutableTypes == null) {
+ this.immutableTypes = Collections.unmodifiableSet(this.mutableTypes);
+ }
+
+ return immutableTypes;
+ return this.immutableTypes;
+ }
+
+ /**
@ -125,8 +148,10 @@ index 0000000000000000000000000000000000000000..e406ce639a2e88b78f82f25e71678a66
+ *
+ * @param material material to get slot by
+ * @return slot type the material will go in, or null if it won't
+ * @deprecated use {@link #getByItemType(ItemType)}
+ */
+ @Nullable
+ @Deprecated
+ public static SlotType getByMaterial(@NotNull Material material) {
+ for (SlotType slotType : values()) {
+ if (slotType.getTypes().contains(material)) {
@ -137,13 +162,40 @@ index 0000000000000000000000000000000000000000..e406ce639a2e88b78f82f25e71678a66
+ }
+
+ /**
+ * Gets whether or not this material can be equipped to a slot
+ * Gets the type of slot via the specified item type
+ *
+ * @param itemType item type to get slot by
+ * @return slot type the item type will go in, or null if it won't
+ */
+ @Nullable
+ public static SlotType getByItemType(@NotNull ItemType itemType) {
+ for (SlotType slotType : values()) {
+ if (slotType.getItemTypes().contains(itemType)) {
+ return slotType;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets whether this material can be equipped to a slot
+ *
+ * @param material material to check
+ * @return whether or not this material can be equipped
+ * @return whether this material can be equipped
+ */
+ @Deprecated
+ public static boolean isEquipable(@NotNull Material material) {
+ return getByMaterial(material) != null;
+ }
+
+ /**
+ * Gets whether this item type can be equipped to a slot
+ *
+ * @param itemType item type to check
+ * @return whether this item type can be equipped
+ */
+ public static boolean isEquipable(@NotNull ItemType itemType) {
+ return getByItemType(itemType) != null;
+ }
+ }
+}

View file

@ -9,10 +9,10 @@ on the real tile entity.
This is useful for where performance is needed
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 870ad6cd930653e6248abcc0fce94ffafbe9ebde..9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd 100644
index d834e8d8d532ce5b46201ff5c02d54a6c047f615..b33c1a227669d01950ceb4162a2910ae05a85a0e 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -272,6 +272,16 @@ public interface Block extends Metadatable, Translatable {
@@ -271,6 +271,16 @@ public interface Block extends Metadatable, Translatable {
@NotNull
BlockState getState();

View file

@ -10,24 +10,24 @@ on the players login.
Plugin authors need to define a key to keep it consistent between server restarts.
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index 4c7f30877c608e327908a61e4bd68789191e2f3c..be68263386a8faea7744f4de75d484e9358c87df 100644
index e92de5ca8bd48723a493495db3ca2e2f5b55fab5..06b7f273ae66b2c936523c95fd4f802bd39ae324 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -38,6 +38,7 @@ public class ShapedRecipe implements Recipe, Keyed {
@@ -37,6 +37,7 @@ public class ShapedRecipe implements Recipe, Keyed {
public ShapedRecipe(@NotNull ItemStack result) {
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
Preconditions.checkArgument(result.getType() != ItemType.AIR, "Recipe must have non-AIR result.");
this.key = NamespacedKey.randomKey();
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace();
this.output = new ItemStack(result);
}
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index 74449a635aca84adcc1652e1e85f2d27dcaf6842..05ef88225415cd30de36f4517b6fb40d826ce996 100644
index 69a25d05efcc96f8b3d3b5455e571259e5af2dab..ebc2c713d8a4ceec86b7dd270c5ca18c78103bcc 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -27,6 +27,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
@@ -26,6 +26,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
public ShapelessRecipe(@NotNull ItemStack result) {
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
Preconditions.checkArgument(result.getType() != ItemType.AIR, "Recipe must have non-AIR result.");
this.key = NamespacedKey.randomKey();
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace();
this.output = new ItemStack(result);

View file

@ -10,10 +10,10 @@ of giving the player experience points.
Both an API To standalone mend, and apply mending logic to .giveExp has been added.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index bd6881d18d18d03f7e9b7821fa6cc433a79dc17e..b4efaec20a64e6f1955819b0d784d9f671d928e0 100644
index 0700a76cdccab9a6dbbcbfd50aa6a5f192f15e75..2400d82ea71f22ddb6c671bf74c6480c35910598 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1242,6 +1242,15 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1230,6 +1230,15 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void resetPlayerWeather();
@ -29,7 +29,7 @@ index bd6881d18d18d03f7e9b7821fa6cc433a79dc17e..b4efaec20a64e6f1955819b0d784d9f6
/**
* Gets the player's cooldown between picking up experience orbs.
*
@@ -1267,8 +1276,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1255,8 +1264,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* Gives the player the amount of experience specified.
*
* @param amount Exp amount to give

View file

@ -16,7 +16,7 @@ See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3f2fdc9aa
index 0000000000000000000000000000000000000000..24b325625c76d0bc4cdb2f4063d6666aa3deac17
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
@@ -0,0 +1,105 @@
@ -43,11 +43,11 @@ index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3
+ */
+public class PreCreatureSpawnEvent extends Event implements Cancellable {
+ @NotNull private final Location location;
+ @NotNull private final EntityType type;
+ @NotNull private final EntityType<?> type;
+ @NotNull private final CreatureSpawnEvent.SpawnReason reason;
+ private boolean shouldAbortSpawn;
+
+ public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
+ public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType<?> type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
+ this.location = Preconditions.checkNotNull(location, "Location may not be null");
+ this.type = Preconditions.checkNotNull(type, "Type may not be null");
+ this.reason = Preconditions.checkNotNull(reason, "Reason may not be null");
@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3
+ * @return The type of creature being spawned
+ */
+ @NotNull
+ public EntityType getType() {
+ public EntityType<?> getType() {
+ return type;
+ }
+

View file

@ -7,10 +7,10 @@ This allows you to create already filled textures on Skulls to avoid texture loo
which commonly cause rate limit issues with Mojang API
diff --git a/src/main/java/org/bukkit/block/Skull.java b/src/main/java/org/bukkit/block/Skull.java
index b39128bb0ca2d4fe7a254193236c60fb5bfaa7da..5135b8e6028e6926e2711e2dd6ce68b76f468fd7 100644
index c7580fa8e62c6ee35abb0cec2586a39bbae4e8a7..0070b8e4a86f85ee31e071513808c36dbad04845 100644
--- a/src/main/java/org/bukkit/block/Skull.java
+++ b/src/main/java/org/bukkit/block/Skull.java
@@ -63,6 +63,20 @@ public interface Skull extends TileState {
@@ -62,6 +62,20 @@ public interface Skull extends TileState {
*/
public void setOwningPlayer(@NotNull OfflinePlayer player);
@ -31,7 +31,7 @@ index b39128bb0ca2d4fe7a254193236c60fb5bfaa7da..5135b8e6028e6926e2711e2dd6ce68b7
/**
* Gets the profile of the player who owns the skull. This player profile
* may appear as the texture depending on skull type.
@@ -70,6 +84,7 @@ public interface Skull extends TileState {
@@ -69,6 +83,7 @@ public interface Skull extends TileState {
* @return the profile of the owning player
*/
@Nullable
@ -39,7 +39,7 @@ index b39128bb0ca2d4fe7a254193236c60fb5bfaa7da..5135b8e6028e6926e2711e2dd6ce68b7
PlayerProfile getOwnerProfile();
/**
@@ -84,6 +99,7 @@ public interface Skull extends TileState {
@@ -83,6 +98,7 @@ public interface Skull extends TileState {
* @throws IllegalArgumentException if the profile does not contain the
* necessary information
*/

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 10eeb288ef41dfc6bd70fc8f6ec218dabc60b2a4..ace8904541fb4571cb03f14e6e3baa02ae460d1e 100644
index 9935ca77536c8fa30881376e20cd3193f22879fb..c1cf9328f32d6b4ecbba667a8dda3a60b37aca82 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1229,8 +1229,10 @@ public final class Bukkit {
@@ -1230,8 +1230,10 @@ public final class Bukkit {
* @return the new PlayerProfile
* @throws IllegalArgumentException if both the unique id is
* <code>null</code> and the name is <code>null</code> or blank
@ -20,7 +20,7 @@ index 10eeb288ef41dfc6bd70fc8f6ec218dabc60b2a4..ace8904541fb4571cb03f14e6e3baa02
public static PlayerProfile createPlayerProfile(@Nullable UUID uniqueId, @Nullable String name) {
return server.createPlayerProfile(uniqueId, name);
}
@@ -1241,8 +1243,10 @@ public final class Bukkit {
@@ -1242,8 +1244,10 @@ public final class Bukkit {
* @param uniqueId the unique id
* @return the new PlayerProfile
* @throws IllegalArgumentException if the unique id is <code>null</code>
@ -31,7 +31,7 @@ index 10eeb288ef41dfc6bd70fc8f6ec218dabc60b2a4..ace8904541fb4571cb03f14e6e3baa02
public static PlayerProfile createPlayerProfile(@NotNull UUID uniqueId) {
return server.createPlayerProfile(uniqueId);
}
@@ -1254,8 +1258,10 @@ public final class Bukkit {
@@ -1255,8 +1259,10 @@ public final class Bukkit {
* @return the new PlayerProfile
* @throws IllegalArgumentException if the name is <code>null</code> or
* blank
@ -43,10 +43,10 @@ index 10eeb288ef41dfc6bd70fc8f6ec218dabc60b2a4..ace8904541fb4571cb03f14e6e3baa02
return server.createPlayerProfile(name);
}
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index 5acb0d36a008cf5ad332c867e9303d35235b4028..b1ded556a1ce4e1d3c873ab9d7f799b6edcc5118 100644
index 6aa01b6f25e88ea7908edd1db836e62adb1b8da6..ab0c6c479d41e00e31d850d5e35d78484423d5c9 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -55,7 +55,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@@ -57,7 +57,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @return the player's profile
*/
@NotNull
@ -56,10 +56,10 @@ index 5acb0d36a008cf5ad332c867e9303d35235b4028..b1ded556a1ce4e1d3c873ab9d7f799b6
/**
* Checks if this player is banned or not
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1487b5de4fba5304b7e2105c6f88872923aa7974..e4f8031ab979ba7e3fd7242b788e41974f490565 100644
index 136ae88a23ac02f79960d4ee99041486b41806f5..572a5aa724f58dc9795bf83b4151412e26f2a14d 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1049,8 +1049,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1050,8 +1050,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return the new PlayerProfile
* @throws IllegalArgumentException if both the unique id is
* <code>null</code> and the name is <code>null</code> or blank
@ -70,7 +70,7 @@ index 1487b5de4fba5304b7e2105c6f88872923aa7974..e4f8031ab979ba7e3fd7242b788e4197
PlayerProfile createPlayerProfile(@Nullable UUID uniqueId, @Nullable String name);
/**
@@ -1059,8 +1061,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1060,8 +1062,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param uniqueId the unique id
* @return the new PlayerProfile
* @throws IllegalArgumentException if the unique id is <code>null</code>
@ -81,7 +81,7 @@ index 1487b5de4fba5304b7e2105c6f88872923aa7974..e4f8031ab979ba7e3fd7242b788e4197
PlayerProfile createPlayerProfile(@NotNull UUID uniqueId);
/**
@@ -1070,8 +1074,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1071,8 +1075,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return the new PlayerProfile
* @throws IllegalArgumentException if the name is <code>null</code> or
* blank
@ -93,10 +93,10 @@ index 1487b5de4fba5304b7e2105c6f88872923aa7974..e4f8031ab979ba7e3fd7242b788e4197
/**
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b4efaec20a64e6f1955819b0d784d9f671d928e0..7b2d8fd3cb0d44a531bd5d618154059d2a934d48 100644
index 2400d82ea71f22ddb6c671bf74c6480c35910598..3c2b4ecce2c4ae3ab5a394857988d24776b9ca90 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2531,6 +2531,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2519,6 +2519,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED}
*/
boolean hasResourcePack();

View file

@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index ace8904541fb4571cb03f14e6e3baa02ae460d1e..36c5294e6169c3aa4517cd2c945b5dfb7a2a0c51 100644
index c1cf9328f32d6b4ecbba667a8dda3a60b37aca82..48f3a48268f714eeba3cfcd8e665265fc144f39e 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -687,6 +687,20 @@ public final class Bukkit {
@@ -688,6 +688,20 @@ public final class Bukkit {
return server.getPlayer(id);
}
@ -34,10 +34,10 @@ index ace8904541fb4571cb03f14e6e3baa02ae460d1e..36c5294e6169c3aa4517cd2c945b5dfb
* Gets the plugin manager for interfacing with plugins.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e4f8031ab979ba7e3fd7242b788e41974f490565..2ac191185e4dabb2f39b05a56548b0d97daa2979 100644
index 572a5aa724f58dc9795bf83b4151412e26f2a14d..cb3415c9b103f60ce0d7942fb1ad4c8cd39d02d4 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -591,6 +591,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -592,6 +592,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
public Player getPlayer(@NotNull UUID id);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add openSign method to HumanEntity
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index abdca9fe5acc90f167219eb769ece66c35682bb1..b3aa3dc6aa5afbc36cc86741b4cba56f463c2234 100644
index 7f12a18a77838266c0394da078a958c6bfb0e776..553cd804126a556f7fdf9f4bcb8640eb33e829d6 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -500,6 +500,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@@ -497,6 +497,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/
@Deprecated
public void setShoulderEntityRight(@Nullable Entity entity);
@ -36,10 +36,10 @@ index abdca9fe5acc90f167219eb769ece66c35682bb1..b3aa3dc6aa5afbc36cc86741b4cba56f
/**
* Make the entity drop the item in their hand.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7b2d8fd3cb0d44a531bd5d618154059d2a934d48..cf7e79eaf1be19f1253761d8e9785b337420f625 100644
index 3c2b4ecce2c4ae3ab5a394857988d24776b9ca90..a2aa3c1e98a4909d3abfa9704da8c3b77918e05a 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2376,10 +2376,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2364,10 +2364,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Open a Sign for editing by the Player.
*

View file

@ -8,10 +8,10 @@ Allows a more logical API for banning players.
player.banPlayer("Breaking the rules");
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index b1ded556a1ce4e1d3c873ab9d7f799b6edcc5118..6ab8f05be11f8101202d56bfebc7ec23f868dddd 100644
index ab0c6c479d41e00e31d850d5e35d78484423d5c9..af2973b1f6d4ac73b2ddee33c6a0869b5ec06b54 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -63,6 +63,61 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@@ -65,6 +65,61 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @return true if banned, otherwise false
*/
public boolean isBanned();
@ -74,10 +74,10 @@ index b1ded556a1ce4e1d3c873ab9d7f799b6edcc5118..6ab8f05be11f8101202d56bfebc7ec23
/**
* Checks if this player is whitelisted or not
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index cf7e79eaf1be19f1253761d8e9785b337420f625..45633a83af30ed7a18f26911a13bc065a3a027b6 100644
index a2aa3c1e98a4909d3abfa9704da8c3b77918e05a..de5ac3b6f9cf001e3c3500f23930a6f9876210de 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -916,6 +916,162 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -904,6 +904,162 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(@NotNull MapView map);
// Paper start

View file

@ -10,7 +10,7 @@ This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
new file mode 100644
index 0000000000000000000000000000000000000000..f45b8cfd1611345e8d81ecb8297a586f05eb5dc6
index 0000000000000000000000000000000000000000..f710167633a8ef1abc4aac2a1912514a959d414c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
@@ -0,0 +1,485 @@
@ -470,20 +470,20 @@ index 0000000000000000000000000000000000000000..f45b8cfd1611345e8d81ecb8297a586f
+ */
+ @NotNull
+ public ParticleBuilder color(@Nullable Color color, float size) {
+ if (particle != Particle.REDSTONE && color != null) {
+ if (this.particle != Particle.DUST && color != null) {
+ throw new IllegalStateException("Color may only be set on REDSTONE");
+ }
+
+ // We don't officially support reusing these objects, but here we go
+ if (color == null) {
+ if (data instanceof Particle.DustOptions) {
+ if (this.data instanceof Particle.DustOptions) {
+ return data(null);
+ } else {
+ return this;
+ }
+ }
+
+ return data(new Particle.DustOptions(color, size));
+ return this.data(new Particle.DustOptions(color, size));
+ }
+
+ /**
@ -500,12 +500,12 @@ index 0000000000000000000000000000000000000000..f45b8cfd1611345e8d81ecb8297a586f
+ }
+}
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
index 73b782c3975ad13159b6236976783fcfabd20493..819506712e9874c0142fc9e7d959bd7be97fc649 100644
index 0f97cf9fd3aebbcda1531f2cfbb9e2e17ba14acf..31c2706e0f038c180821e7c4e543f1177789ce3d 100644
--- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java
@@ -162,6 +162,17 @@ public enum Particle {
return dataType;
}
@@ -140,6 +140,17 @@ public abstract class Particle<D> extends OldEnum<Particle<D>> implements Keyed
@NotNull
public abstract Class<D> getDataType();
+ // Paper start - Particle API expansion
+ /**
@ -522,15 +522,19 @@ index 73b782c3975ad13159b6236976783fcfabd20493..819506712e9874c0142fc9e7d959bd7b
* Options which can be applied to redstone dust particles - a particle
* color and size.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 0f76496471c50d5f18cedc735e667265e6c27422..0ed7a7db90856ff50ed1354f9914c0cc321d2d09 100644
index 48e3e92820f59753df30e5d61f57fb71e2894aa6..61f5fd47381d21b268f58af2106fc8be5e2f1c73 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2776,7 +2776,57 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -2756,7 +2756,62 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
*/
- public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
+ public default <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) { spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true); }// Paper start - Expand Particle API
- public <T> void spawnParticle(@NotNull Particle<T> particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
+ // Paper start - Expand Particle API
+ default <T> void spawnParticle(@NotNull Particle<T> particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) {
+ this.spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true);
+ }
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
@ -553,7 +557,9 @@ index 0f76496471c50d5f18cedc735e667265e6c27422..0ed7a7db90856ff50ed1354f9914c0cc
+ * the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
+ */
+ public default <T> void spawnParticle(@NotNull Particle particle, @Nullable List<Player> receivers, @NotNull Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) { spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true); }
+ default <T> void spawnParticle(@NotNull Particle<T> particle, @Nullable List<Player> receivers, @NotNull Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) {
+ this.spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true);
+ }
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
@ -578,9 +584,8 @@ index 0f76496471c50d5f18cedc735e667265e6c27422..0ed7a7db90856ff50ed1354f9914c0cc
+ * @param force allows the particle to be seen further away from the player
+ * and shows to players using any vanilla client particle settings
+ */
+ public <T> void spawnParticle(@NotNull Particle particle, @Nullable List<Player> receivers, @Nullable Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force);
+ <T> void spawnParticle(@NotNull Particle<T> particle, @Nullable List<Player> receivers, @Nullable Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force);
+ // Paper end
+
/**
* Spawns the particle (the number of times specified by count)

View file

@ -7,18 +7,18 @@ Control what potion the witch readies to use
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..57f93af14acc6346c5a343e05fe8f5d44d6adbc6
index 0000000000000000000000000000000000000000..af74dcd5dccd26661787219eb8873c5be2f981a7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java
@@ -0,0 +1,80 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.Material;
+import org.bukkit.entity.Witch;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.ItemType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..57f93af14acc6346c5a343e05fe8f5d4
+ public static ItemStack process(@NotNull Witch witch, @Nullable ItemStack potion) {
+ WitchReadyPotionEvent event = new WitchReadyPotionEvent(witch, potion);
+ if (!event.callEvent() || event.getPotion() == null) {
+ return new ItemStack(Material.AIR);
+ return ItemStack.of(ItemType.AIR);
+ }
+ return event.getPotion();
+ }

View file

@ -6,20 +6,20 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index a8faa4c1881bae4d47d901388a78b991d138b518..b85eb71ff5d198d6270cbe07da0de3ed27fa72d5 100644
index 923f160407a2d4be71ef42a387cb803712404c43..250e39c76dbedbd1d0d118eecf1253738e369c35 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -646,5 +646,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -696,5 +696,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public String getI18NDisplayName() {
return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
}
+
+ public int getMaxItemUseDuration() {
+ if (type == null || type == Material.AIR || !type.isItem()) {
+ if (this.type == null || this.type == ItemType.AIR) {
+ return 0;
+ }
+ // Requires access to NMS
+ return ensureServerConversions().getMaxItemUseDuration();
+ return this.ensureServerConversions().getMaxItemUseDuration();
+ }
// Paper end
}

View file

@ -6,7 +6,7 @@ Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API
Adds ability to get what arrow was shot, and control if it should be consumed.
diff --git a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
index d4d7ad9c3c953680342c121f39ddaef476549047..719d0d878320c1903b44076053989ba99fa0e92a 100644
index d4d7ad9c3c953680342c121f39ddaef476549047..6c27a3149b17162cc38206147c759df066186af0 100644
--- a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
@@ -22,7 +22,32 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
@ -31,7 +31,7 @@ index d4d7ad9c3c953680342c121f39ddaef476549047..719d0d878320c1903b44076053989ba9
+
+ @Deprecated
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) {
+ this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force);
+ this(shooter, bow, ItemStack.of(org.bukkit.inventory.ItemType.AIR), projectile, force);
+ }
+ @Deprecated

View file

@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack API additions for quantity/flags/lore
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index b85eb71ff5d198d6270cbe07da0de3ed27fa72d5..83a0631a80db156ace1d977df71d5fc653b70bb6 100644
index 250e39c76dbedbd1d0d118eecf1253738e369c35..8187b1b801c7a6fd71696bfe21de177705b0e3a2 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -3,6 +3,7 @@ package org.bukkit.inventory;
@ -16,9 +16,9 @@ index b85eb71ff5d198d6270cbe07da0de3ed27fa72d5..83a0631a80db156ace1d977df71d5fc6
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -654,5 +655,185 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -704,5 +705,185 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
// Requires access to NMS
return ensureServerConversions().getMaxItemUseDuration();
return this.ensureServerConversions().getMaxItemUseDuration();
}
+
+ /**

View file

@ -6,10 +6,10 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API
How long an entity has raised hands to charge an attack or use an item
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index b3aa3dc6aa5afbc36cc86741b4cba56f463c2234..9e012c3c0671e5d0e55c243fdb4e14057038c153 100644
index 553cd804126a556f7fdf9f4bcb8640eb33e829d6..7c27f459cf84e87bb294d1a1c8081bc8eba9d852 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -328,7 +328,9 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@@ -325,7 +325,9 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*
* @return the item being used by the player, or null if they are not using
* an item
@ -20,7 +20,7 @@ index b3aa3dc6aa5afbc36cc86741b4cba56f463c2234..9e012c3c0671e5d0e55c243fdb4e1405
public ItemStack getItemInUse();
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 2bfeebe26f32d2e931dc483714d30430deeb9b04..17e5d2e2acdae23d8ea3b3b1a89f62e8be7b81a8 100644
index a48be2a0401a57b6165a849cf29f37a63b54f630..4cb92615ccd45617a282df59574f9c4fc45f119b 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -745,5 +745,42 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource

View file

@ -6,13 +6,15 @@ Subject: [PATCH] AnvilDamageEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95ce90b9dee
index 0000000000000000000000000000000000000000..8174787e87433084035bb3cbc88e041937c56430
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
@@ -0,0 +1,148 @@
@@ -0,0 +1,171 @@
+package com.destroystokyo.paper.event.block;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.block.BlockType;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
@ -104,15 +106,15 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
+ * Represents the amount of damage on an anvil block
+ */
+ public enum DamageState {
+ FULL(Material.ANVIL),
+ CHIPPED(Material.CHIPPED_ANVIL),
+ DAMAGED(Material.DAMAGED_ANVIL),
+ BROKEN(Material.AIR);
+ FULL(BlockType.ANVIL),
+ CHIPPED(BlockType.CHIPPED_ANVIL),
+ DAMAGED(BlockType.DAMAGED_ANVIL),
+ BROKEN(BlockType.AIR);
+
+ private Material material;
+ private BlockType<?> blockType;
+
+ DamageState(@NotNull Material material) {
+ this.material = material;
+ DamageState(@NotNull BlockType<?> blockType) {
+ this.blockType = blockType;
+ }
+
+ /**
@ -120,9 +122,18 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
+ *
+ * @return Material
+ */
+ @NotNull
+ public Material getMaterial() {
+ return material;
+ @Deprecated
+ public @NotNull Material getMaterial() {
+ return Bukkit.getUnsafe().blockTypeToMaterial(this.blockType);
+ }
+
+ /**
+ * Get the block type for this damage state.
+ *
+ * @return the block type
+ */
+ public @NotNull BlockType<?> getBlockType() {
+ return this.blockType;
+ }
+
+ /**
@ -134,7 +145,7 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
+ */
+ @NotNull
+ public static DamageState getState(@Nullable BlockData blockData) {
+ return blockData == null ? BROKEN : getState(blockData.getMaterial());
+ return blockData == null ? BROKEN : getState(blockData.getBlockType());
+ }
+
+ /**
@ -143,14 +154,26 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
+ * @param material Block material
+ * @return DamageState
+ * @throws IllegalArgumentException If non anvil material is given
+ * @deprecated use {@link #getState(BlockType)}
+ */
+ @NotNull
+ public static DamageState getState(@Nullable Material material) {
+ if (material == null) {
+ @Deprecated
+ public static @NotNull DamageState getState(@Nullable Material material) {
+ return material == null ? BROKEN : getState(material.asBlockType());
+ }
+
+ /**
+ * Get damaged state by block type
+ *
+ * @param blockType Block type
+ * @return DamageState
+ * @throws IllegalArgumentException If non anvil block type is given
+ */
+ public static @NotNull DamageState getState(@Nullable BlockType<?> blockType) {
+ if (blockType == null) {
+ return BROKEN;
+ }
+ for (DamageState state : values()) {
+ if (state.material == material) {
+ if (state.blockType == blockType) {
+ return state;
+ }
+ }

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..9d7221583454dc922b20af6c233897c0b2ec47da
index 0000000000000000000000000000000000000000..ac1d40a697fe98cc9151b53f5d63e283d44fbbf9
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
@@ -0,0 +1,116 @@
@ -116,7 +116,7 @@ index 0000000000000000000000000000000000000000..9d7221583454dc922b20af6c233897c0
+
+ /**
+ * When TNT prime was caused by an {@link Entity} shooting TNT
+ * using a bow with {@link org.bukkit.enchantments.Enchantment#ARROW_FIRE} enchantment
+ * using a bow with {@link org.bukkit.enchantments.Enchantment#FLAME} enchantment
+ */
+ PROJECTILE,
+

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Don't use snapshots for Timings Tile Entity reports
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
index eb9d58f8852e732a1284beeaf542989301d21b1c..02e88db63be2d5e31da6b65157ba7b971b1f10f3 100644
index 7213bd2ccf6fa03933a9dff878baee8e92bf50b9..efcba8d9105e65f8770e95a20c9718ad93c6af79 100644
--- a/src/main/java/co/aikar/timings/TimingHistory.java
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
@@ -120,7 +120,7 @@ public class TimingHistory {
@@ -121,7 +121,7 @@ public class TimingHistory {
data.entityCounts.get(entity.getType()).increment();
}

View file

@ -50,7 +50,7 @@ index 943c3364f6b931fe11f9a6099504590b2da34657..16a604b6315daff228c827fe02b1234c
* @return A new location where X/Y/Z are the center of the block
*/
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 159307600747c49948c5242d6cf39eed08c902e7..e83de41cbaf0e5a68ce0d5ad2b5ec10877ec4055 100644
index 273d111ccacc31daf7c2f5ea33728d9f04ba06e7..df543e106f22d1e151cd2e056f5741cc83a607cf 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -96,6 +96,41 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@ -96,10 +96,10 @@ index 159307600747c49948c5242d6cf39eed08c902e7..e83de41cbaf0e5a68ce0d5ad2b5ec108
* Gets the highest non-empty (impassable) block at the given coordinates.
*
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd..78f6cc1a8a8de05aec6f551f8a5f425944f0ffa3 100644
index b33c1a227669d01950ceb4162a2910ae05a85a0e..cad80c8aeb55fe9846189c62ff9cfdb5525c7236 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -156,6 +156,82 @@ public interface Block extends Metadatable, Translatable {
@@ -155,6 +155,82 @@ public interface Block extends Metadatable, Translatable {
*/
int getZ();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Inventory#removeItemAnySlot
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..f1a48eab1a357ae64545e1f1dc941c383cff8707 100644
index b0098a34cb07958ae815ed6b6957eb8be76e7a85..889615d40eb90ba62d44d7310fad16bdfb13da36 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -104,7 +104,9 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -103,7 +103,9 @@ public interface Inventory extends Iterable<ItemStack> {
public HashMap<Integer, ItemStack> addItem(@NotNull ItemStack... items) throws IllegalArgumentException;
/**
@ -19,7 +19,7 @@ index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..f1a48eab1a357ae64545e1f1dc941c38
* <p>
* It will try to remove 'as much as possible' from the types and amounts
* you give as arguments.
@@ -121,10 +123,39 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -120,10 +122,39 @@ public interface Inventory extends Iterable<ItemStack> {
* @param items The ItemStacks to remove
* @return A HashMap containing items that couldn't be removed.
* @throws IllegalArgumentException if items is null

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Add source block constructor and getChangedBlockData() to
diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
index e3a5f5824ed882058f5bac5003f66ce79733a868..1d496e5a3d1541bf0a257a4358b3943fd6415204 100644
index 55cdfd35a91f82b2c5bf51fff3671e45b49b7d0c..0ae137a46fc505d99c827b099d36c35d9fa891b0 100644
--- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
@@ -32,6 +32,13 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
@ -34,7 +34,7 @@ index e3a5f5824ed882058f5bac5003f66ce79733a868..1d496e5a3d1541bf0a257a4358b3943f
* @return Changed block's type
*/
@@ -64,6 +72,19 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
return changed.getMaterial();
return changed.getBlockType();
}
+ // Paper start - Getter for the BlockData

View file

@ -78,12 +78,12 @@ index 0000000000000000000000000000000000000000..c896d172519a8552a132031cb956378d
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 17e5d2e2acdae23d8ea3b3b1a89f62e8be7b81a8..8cccec99cdb028e86b71b3984f4f94201fd9a390 100644
index 4cb92615ccd45617a282df59574f9c4fc45f119b..a4e5225e433e83d56ff96055106593a352639034 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -83,6 +83,98 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
@NotNull
public Block getTargetBlock(@Nullable Set<Material> transparent, int maxDistance);
public Block getTargetBlock(@Nullable Set<BlockType<?>> transparent, int maxDistance);
+ // Paper start
+ /**

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 45633a83af30ed7a18f26911a13bc065a3a027b6..b21834a0ec507d223cdb178b4500981c9e8dc248 100644
index de5ac3b6f9cf001e3c3500f23930a6f9876210de..9649e65d2b0af4f72d648eb33c0de124ba4b5e34 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2703,6 +2703,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2691,6 +2691,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param profile The new profile to use
*/
void setPlayerProfile(@NotNull com.destroystokyo.paper.profile.PlayerProfile profile);

View file

@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..909617079db61b675cc7b60b44ef96b3
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 36c5294e6169c3aa4517cd2c945b5dfb7a2a0c51..36a127864be2a75a38bcc6eacafde5109e5c6c69 100644
index 48f3a48268f714eeba3cfcd8e665265fc144f39e..5a7e8b3d073c2ea44909477c38bc2ab454c6a502 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -55,6 +55,7 @@ import org.bukkit.util.CachedServerIcon;
@@ -56,6 +56,7 @@ import org.bukkit.util.CachedServerIcon;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -59,7 +59,7 @@ index 36c5294e6169c3aa4517cd2c945b5dfb7a2a0c51..36a127864be2a75a38bcc6eacafde510
/**
* Represents the Bukkit core, for version and Server singleton handling
@@ -104,7 +105,25 @@ public final class Bukkit {
@@ -105,7 +106,25 @@ public final class Bukkit {
}
Bukkit.server = server;

View file

@ -5,26 +5,19 @@ Subject: [PATCH] Material API additions
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index f52c0e25e75e890046339d605c0abf79d82864f2..64d01ce77966e895ec494719a4398577be1097a1 100644
index 9941023b98f3822c7b12697ae7326708abf19ead..09669d5757f4fa58835e339deb8d38afa5662997 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -118,6 +118,7 @@ import org.jetbrains.annotations.Nullable;
/**
* An enum of all material IDs accepted by the official server and client
*/
+@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper
public enum Material implements Keyed, Translatable {
//<editor-fold desc="Materials" defaultstate="collapsed">
AIR(9648, 0),
@@ -4435,6 +4436,22 @@ public enum Material implements Keyed, Translatable {
@@ -4439,6 +4439,23 @@ public enum Material implements Keyed, Translatable {
}
}
+ // Paper start
+
+ /**
+ * @return If the type is either AIR, CAVE_AIR or VOID_AIR
+ * @deprecated Check if the {@link ItemType} is {@link ItemType#AIR} or {@link BlockType#isAir()}
+ */
+ @Deprecated
+ public boolean isEmpty() {
+ switch (this) {
+ case AIR:

View file

@ -11,10 +11,10 @@ Co-authored by: Lena Kolb <lenakolb2204@gmail.com>
diff --git a/src/main/java/com/destroystokyo/paper/MaterialSetTag.java b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab01565b3d92a
index 0000000000000000000000000000000000000000..8f5530188e340336dfffb3054c1743b068bc9342
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java
@@ -0,0 +1,97 @@
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ */
@ -23,10 +23,13 @@ index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab015
+
+import com.google.common.collect.Lists;
+import io.papermc.paper.tag.BaseTag;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Tag;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockState;
+import org.bukkit.block.BlockType;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.inventory.ItemStack;
+
@ -35,9 +38,11 @@ index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab015
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.bukkit.inventory.ItemType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+@Deprecated
+public class MaterialSetTag extends BaseTag<Material, MaterialSetTag> {
+
+ /**
@ -92,8 +97,17 @@ index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab015
+ return value.name();
+ }
+
+ public MaterialSetTag addTags(@NotNull Tag<BlockType>...tags) {
+ for (Tag<BlockType> tag : tags) {
+ for (final BlockType<?> value : tag.getValues()) {
+ this.add(Bukkit.getUnsafe().blockTypeToMaterial(value));
+ }
+ }
+ return this;
+ }
+
+ public boolean isTagged(@NotNull BlockData block) {
+ return isTagged(block.getMaterial());
+ return isTagged(block.getBlockType());
+ }
+
+ public boolean isTagged(@NotNull BlockState block) {
@ -108,16 +122,24 @@ index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab015
+ return isTagged(item.getType());
+ }
+
+ public boolean isTagged(@NotNull ItemType itemType) {
+ return this.isTagged(Bukkit.getUnsafe().toMaterial(itemType));
+ }
+
+ public boolean isTagged(@NotNull BlockType<?> itemType) {
+ return this.isTagged(Bukkit.getUnsafe().blockTypeToMaterial(itemType));
+ }
+
+ public boolean isTagged(@NotNull Material material) {
+ return this.tagged.contains(material);
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
new file mode 100644
index 0000000000000000000000000000000000000000..0b92f3279fe5dcbea77b22803447b7ad21ef999f
index 0000000000000000000000000000000000000000..296fbcb6768d7b21720431e32e39b2702da08324
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -0,0 +1,704 @@
@@ -0,0 +1,705 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
@ -155,6 +177,7 @@ index 0000000000000000000000000000000000000000..0b92f3279fe5dcbea77b22803447b7ad
+ * {@link UnsupportedOperationException}.
+ */
+@SuppressWarnings({"NonFinalUtilityClass", "unused", "WeakerAccess"})
+@Deprecated
+public class MaterialTags {
+
+ private static NamespacedKey keyFor(String key) {
@ -652,7 +675,7 @@ index 0000000000000000000000000000000000000000..0b92f3279fe5dcbea77b22803447b7ad
+ */
+ @SuppressWarnings("unchecked")
+ public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable"))
+ .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS).lock();
+ .addTags(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS).lock();
+ //.ensureSize("COLORABLE", 81).lock(); unit test don't have the vanilla item tags, so counts don't line up for real
+
+ /**
@ -1011,10 +1034,10 @@ index 0000000000000000000000000000000000000000..794787912325ae32b3cfc8217bc3fc21
+}
diff --git a/src/main/java/io/papermc/paper/tag/EntitySetTag.java b/src/main/java/io/papermc/paper/tag/EntitySetTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..c89c4619aaf388197834d98eb95af2f1e93db871
index 0000000000000000000000000000000000000000..d120fb50bf1f36c3f991d7170b5423af1db4021c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/tag/EntitySetTag.java
@@ -0,0 +1,42 @@
@@ -0,0 +1,43 @@
+package io.papermc.paper.tag;
+
+import org.bukkit.NamespacedKey;
@ -1027,6 +1050,7 @@ index 0000000000000000000000000000000000000000..c89c4619aaf388197834d98eb95af2f1
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+@Deprecated
+public class EntitySetTag extends BaseTag<EntityType, EntitySetTag> {
+
+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Predicate<EntityType> filter) {
@ -1059,10 +1083,10 @@ index 0000000000000000000000000000000000000000..c89c4619aaf388197834d98eb95af2f1
+}
diff --git a/src/main/java/io/papermc/paper/tag/EntityTags.java b/src/main/java/io/papermc/paper/tag/EntityTags.java
new file mode 100644
index 0000000000000000000000000000000000000000..d7eb49a05c3f0cacf285f8995433c5d5e988de0f
index 0000000000000000000000000000000000000000..eafae2a211c58719ef008a5d4018541249dcf4b7
--- /dev/null
+++ b/src/main/java/io/papermc/paper/tag/EntityTags.java
@@ -0,0 +1,54 @@
@@ -0,0 +1,55 @@
+package io.papermc.paper.tag;
+
+import org.bukkit.NamespacedKey;
@ -1073,6 +1097,7 @@ index 0000000000000000000000000000000000000000..d7eb49a05c3f0cacf285f8995433c5d5
+ * All tags in this class are unmodifiable, attempting to modify them will throw an
+ * {@link UnsupportedOperationException}.
+ */
+@Deprecated
+public class EntityTags {
+
+ private static NamespacedKey keyFor(String key) {
@ -1118,10 +1143,10 @@ index 0000000000000000000000000000000000000000..d7eb49a05c3f0cacf285f8995433c5d5
+ .ensureSize("WATER_BASED", 11).lock();
+}
diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java
index 1504dca4ec3e8d21189b7534bb009521799ffdf7..82d34e9aae42dfafd900dc0e610bf1dc82a5a6f3 100644
index b7871206d4d8c3cd869d9f2f15b7a1184722c2f9..bbf7dd8ca90ba1c3626e87ca221201568163101f 100644
--- a/src/main/java/org/bukkit/Tag.java
+++ b/src/main/java/org/bukkit/Tag.java
@@ -11,6 +11,10 @@ import org.jetbrains.annotations.NotNull;
@@ -13,6 +13,10 @@ import org.jetbrains.annotations.NotNull;
* Note that whilst all tags defined within this interface must be present in
* implementations, their existence is not guaranteed across future versions.
*
@ -1134,10 +1159,10 @@ index 1504dca4ec3e8d21189b7534bb009521799ffdf7..82d34e9aae42dfafd900dc0e610bf1dc
public interface Tag<T extends Keyed> extends Keyed {
diff --git a/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..e541f29e983d8dcaca91de9ee1459d587226b4c3
index 0000000000000000000000000000000000000000..556e347fd10fd8f8358d8aaee1bcd374b9d19823
--- /dev/null
+++ b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java
@@ -0,0 +1,65 @@
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ */
@ -1146,9 +1171,9 @@ index 0000000000000000000000000000000000000000..e541f29e983d8dcaca91de9ee1459d58
+
+import io.papermc.paper.tag.BaseTag;
+import io.papermc.paper.tag.EntityTags;
+import io.papermc.paper.testing.TestServer;
+import org.bukkit.Bukkit;
+import org.junit.Before;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
@ -1159,14 +1184,10 @@ index 0000000000000000000000000000000000000000..e541f29e983d8dcaca91de9ee1459d58
+
+import static org.junit.Assert.assertTrue;
+
+public class MaterialTagsTest {
+
+ @Before
+ public void before() {
+ TestServer.setup();
+ }
+public class MaterialTagsTest extends AbstractTestingBase {
+
+ @Test
+ @Ignore
+ public void testInitialize() {
+ try {
+ MaterialTags.SHULKER_BOXES.getValues();
@ -1178,6 +1199,7 @@ index 0000000000000000000000000000000000000000..e541f29e983d8dcaca91de9ee1459d58
+ }
+
+ @Test
+ @Ignore
+ public void testLocked() {
+ testLocked(MaterialTags.class);
+ testLocked(EntityTags.class);
@ -1205,24 +1227,25 @@ index 0000000000000000000000000000000000000000..e541f29e983d8dcaca91de9ee1459d58
+}
diff --git a/src/test/java/io/papermc/paper/EntityTagsTest.java b/src/test/java/io/papermc/paper/EntityTagsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..3caf03d8e50cd2180e9aac2dddeaa3afd0bf7438
index 0000000000000000000000000000000000000000..d92e2bf0d8c2d3c861dbf14d31b9bf13c53beec2
--- /dev/null
+++ b/src/test/java/io/papermc/paper/EntityTagsTest.java
@@ -0,0 +1,22 @@
@@ -0,0 +1,23 @@
+package io.papermc.paper;
+
+import io.papermc.paper.tag.EntityTags;
+import io.papermc.paper.testing.TestServer;
+import java.util.logging.Level;
+import org.bukkit.Bukkit;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class EntityTagsTest {
+public class EntityTagsTest extends AbstractTestingBase {
+
+ @Test
+ @Ignore
+ public void testInitialize() {
+ try {
+ TestServer.setup();
+ EntityTags.HORSES.getValues();
+ assert true;
+ } catch (Throwable e) {

View file

@ -12,7 +12,7 @@ Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..48cff063594840a07aeaf35513780e28ea019a76
index 0000000000000000000000000000000000000000..765440cedcddc4a7b7312a930fef857efd7ad661
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
@@ -0,0 +1,29 @@
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..48cff063594840a07aeaf35513780e28
+public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent {
+ @NotNull private final Location spawnerLocation;
+
+ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) {
+ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType<?> type, @NotNull Location spawnerLocation) {
+ super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER);
+ this.spawnerLocation = Preconditions.checkNotNull(spawnerLocation, "Spawner location may not be null");
+ }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Make the default permission message configurable
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 36a127864be2a75a38bcc6eacafde5109e5c6c69..8649a3453bd3c3ee5f2bf5b706b125cb70d3bb1b 100644
index 5a7e8b3d073c2ea44909477c38bc2ab454c6a502..89f29c76f891d95100b6253b0b66b235ef6a6aea 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2241,6 +2241,28 @@ public final class Bukkit {
@@ -2245,6 +2245,28 @@ public final class Bukkit {
return server.suggestPlayerNamesWhenNullTabCompletions();
}
@ -38,10 +38,10 @@ index 36a127864be2a75a38bcc6eacafde5109e5c6c69..8649a3453bd3c3ee5f2bf5b706b125cb
* Creates a PlayerProfile for the specified uuid, with name as null.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2ac191185e4dabb2f39b05a56548b0d97daa2979..771a504a6f64644f434e2a6d20d285d338b5dff4 100644
index cb3415c9b103f60ce0d7942fb1ad4c8cd39d02d4..e81abc039bf036f71def4dc78f8eb97c0c92ed9d 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1951,6 +1951,23 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1955,6 +1955,23 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean suggestPlayerNamesWhenNullTabCompletions();

View file

@ -18,10 +18,10 @@ index 1d061412cdafa28c6940c7433747ab1dabe23de1..6fda7f3aa68e76af64362e9afed70fc6
@Override
diff --git a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
index dce3d619a6f1791197e44277c2dee9eaf19ff56f..7e2335ed8acc692af1e70eddcf97ee7a56e30f68 100644
index f89315e9de3aed4209be0df7e4de6daadc5fbe2a..aaa2ed5aef8c0d5596fc76aafa2d5383973caeb0 100644
--- a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
+++ b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
@@ -25,8 +25,8 @@ public class StandardMessengerTest {
@@ -26,8 +26,8 @@ public class StandardMessengerTest extends AbstractTestingBase {
assertTrue(messenger.isReservedChannel("minecraft:register"));
assertFalse(messenger.isReservedChannel("test:register"));
assertTrue(messenger.isReservedChannel("minecraft:unregister"));

View file

@ -16,10 +16,10 @@ intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose.
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index 6ab8f05be11f8101202d56bfebc7ec23f868dddd..72175dcae49f75b494ab70958053ed994a8828f4 100644
index af2973b1f6d4ac73b2ddee33c6a0869b5ec06b54..6a3479599050d268f7a4b8dc5aea813bf4ba02d6 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -165,7 +165,9 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@@ -167,7 +167,9 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* UTC.
*
* @return Date of last log-in for this player, or 0
@ -29,7 +29,7 @@ index 6ab8f05be11f8101202d56bfebc7ec23f868dddd..72175dcae49f75b494ab70958053ed99
public long getLastPlayed();
/**
@@ -183,6 +185,30 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@@ -185,6 +187,30 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
*/
@Nullable
public Location getBedSpawnLocation();

View file

@ -9,7 +9,7 @@ Redirects some of upstream's APIs to these new methods to avoid
usage of magic values and the deprecated RecipeChoice#getItemStack
diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java
index 90208bc96085f05a3b657b9467b1670d00b03104..523818cbb0d6c90481ec97123e7fe0e2ff4eea14 100644
index 22dd838deda4761e24af017f6e9a417ef60094e8..37648928292be6a75a14ef3a0d3af2cd41e61c6c 100644
--- a/src/main/java/org/bukkit/inventory/RecipeChoice.java
+++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java
@@ -146,8 +146,6 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
@ -22,17 +22,17 @@ index 90208bc96085f05a3b657b9467b1670d00b03104..523818cbb0d6c90481ec97123e7fe0e2
public static class ExactChoice implements RecipeChoice {
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index be68263386a8faea7744f4de75d484e9358c87df..c2d224b6472a65cd362e1ab55ce7e3d0b5a3befc 100644
index 06b7f273ae66b2c936523c95fd4f802bd39ae324..4869adf9b89f1458af5517ae5813d44630846de8 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -180,6 +180,13 @@ public class ShapedRecipe implements Recipe, Keyed {
@@ -155,6 +155,13 @@ public class ShapedRecipe implements Recipe, Keyed {
return this;
}
+ // Paper start
+ @NotNull
+ public ShapedRecipe setIngredient(char key, @NotNull ItemStack item) {
+ return setIngredient(key, new RecipeChoice.ExactChoice(item));
+ return this.setIngredient(key, new RecipeChoice.ExactChoice(item));
+ }
+ // Paper end
+
@ -40,36 +40,36 @@ index be68263386a8faea7744f4de75d484e9358c87df..c2d224b6472a65cd362e1ab55ce7e3d0
* Get a copy of the ingredients map.
*
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index 05ef88225415cd30de36f4517b6fb40d826ce996..8bf26da12dcb03f22f842a57798948d5513c227d 100644
index ebc2c713d8a4ceec86b7dd270c5ca18c78103bcc..1ff7f7327c3462f54b8b2d1100c608f30ecabe31 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -141,6 +141,40 @@ public class ShapelessRecipe implements Recipe, Keyed {
@@ -106,6 +106,40 @@ public class ShapelessRecipe implements Recipe, Keyed {
return this;
}
+ // Paper start
+ @NotNull
+ public ShapelessRecipe addIngredient(@NotNull ItemStack item) {
+ return addIngredient(item.getAmount(), item);
+ return this.addIngredient(item.getAmount(), item);
+ }
+
+ @NotNull
+ public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) {
+ Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients");
+ Preconditions.checkArgument(this.ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients");
+ while (count-- > 0) {
+ ingredients.add(new RecipeChoice.ExactChoice(item));
+ this.ingredients.add(new RecipeChoice.ExactChoice(item));
+ }
+ return this;
+ }
+
+ @NotNull
+ public ShapelessRecipe removeIngredient(@NotNull ItemStack item) {
+ return removeIngredient(1, item);
+ return this.removeIngredient(1, item);
+ }
+
+ @NotNull
+ public ShapelessRecipe removeIngredient(int count, @NotNull ItemStack item) {
+ Iterator<RecipeChoice> iterator = ingredients.iterator();
+ Iterator<RecipeChoice> iterator = this.ingredients.iterator();
+ while (count > 0 && iterator.hasNext()) {
+ RecipeChoice choice = iterator.next();
+ if (choice.test(item)) {
@ -84,21 +84,3 @@ index 05ef88225415cd30de36f4517b6fb40d826ce996..8bf26da12dcb03f22f842a57798948d5
/**
* Removes an ingredient from the list.
*
@@ -164,7 +198,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
*/
@NotNull
public ShapelessRecipe removeIngredient(@NotNull Material ingredient) {
- return removeIngredient(ingredient, 0);
+ return removeIngredient(new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack)
}
/**
@@ -191,7 +225,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
*/
@NotNull
public ShapelessRecipe removeIngredient(int count, @NotNull Material ingredient) {
- return removeIngredient(count, ingredient, 0);
+ return removeIngredient(count, new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack)
}
/**

View file

@ -9,10 +9,10 @@ a ton of noise to plugin developers.
These do not help plugin developers if they bring moise noise than value.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 8649a3453bd3c3ee5f2bf5b706b125cb70d3bb1b..ef7445fc5c169e64a73dce4f71a2885fb976caf3 100644
index 89f29c76f891d95100b6253b0b66b235ef6a6aea..d22fde8aa7d9dc2d3e717716b4604ad8604daa61 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -836,9 +836,8 @@ public final class Bukkit {
@@ -837,9 +837,8 @@ public final class Bukkit {
*
* @param id the id of the map to get
* @return a map view if it exists, or null otherwise
@ -23,7 +23,7 @@ index 8649a3453bd3c3ee5f2bf5b706b125cb70d3bb1b..ef7445fc5c169e64a73dce4f71a2885f
@Nullable
public static MapView getMap(int id) {
return server.getMap(id);
@@ -1230,10 +1229,8 @@ public final class Bukkit {
@@ -1231,10 +1230,8 @@ public final class Bukkit {
* @param name the name the player to retrieve
* @return an offline player
* @see #getOfflinePlayer(java.util.UUID)
@ -35,7 +35,7 @@ index 8649a3453bd3c3ee5f2bf5b706b125cb70d3bb1b..ef7445fc5c169e64a73dce4f71a2885f
@NotNull
public static OfflinePlayer getOfflinePlayer(@NotNull String name) {
return server.getOfflinePlayer(name);
@@ -1798,7 +1795,7 @@ public final class Bukkit {
@@ -1799,7 +1796,7 @@ public final class Bukkit {
*
* @return the scoreboard manager or null if no worlds are loaded.
*/
@ -90,10 +90,10 @@ index 20978b269a7757a561d6b872cc77898b44bbd272..2b9a117804a8ca54b47e51e23359bd6e
if (this.world == null) {
return null;
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 64d01ce77966e895ec494719a4398577be1097a1..7705fece7f58bd66f7d68da85f8f34e43b4bae12 100644
index 09669d5757f4fa58835e339deb8d38afa5662997..e022c70ba53d623053f1c826d57e47fb102dfce0 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4465,11 +4465,11 @@ public enum Material implements Keyed, Translatable {
@@ -4469,11 +4469,11 @@ public enum Material implements Keyed, Translatable {
}
/**
@ -107,7 +107,7 @@ index 64d01ce77966e895ec494719a4398577be1097a1..7705fece7f58bd66f7d68da85f8f34e4
public boolean isLegacy() {
return legacy;
}
@@ -4540,8 +4540,10 @@ public enum Material implements Keyed, Translatable {
@@ -4544,8 +4544,10 @@ public enum Material implements Keyed, Translatable {
* Gets the MaterialData class associated with this Material
*
* @return MaterialData associated with this Material
@ -156,27 +156,27 @@ index f43209cf7b752c26718c303ca8c3e1c7d9912ad3..f0094e6fb05e526736629ad3181c8d2c
/**
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 6e5e5fecdd7b76dde2e1524fe7b5faa837f491fb..09e3c2872462da546b891cbc396aaffb77f6aadf 100644
index d98145f9b13ef5fc6650ce5f39ae648ab0a3c637..e84b3e488003bff973b77cec08f7429fce6364fa 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -157,14 +157,14 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -194,14 +194,14 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see TrimMaterial
*/
- @ApiStatus.Experimental
+ //@ApiStatus.Experimental // Paper
Registry<TrimMaterial> TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class);
+ // @ApiStatus.Experimental // Paper
Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(Bukkit.getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug.");
/**
* Trim patterns.
*
* @see TrimPattern
*/
- @ApiStatus.Experimental
+ //@ApiStatus.Experimental // Paper
Registry<TrimPattern> TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class);
+ // @ApiStatus.Experimental // Paper
Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(Bukkit.getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug.");
/**
* Villager profession.
@@ -246,8 +246,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -276,8 +276,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @param input non-null input
* @return registered object or null if does not exist
@ -203,10 +203,10 @@ index 6277451c3c6c551078c237cd767b6d70c4f585ea..10f5cfb1885833a1d2c1027c03974da4
CRACKED(0x0),
GLYPHED(0x1),
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 771a504a6f64644f434e2a6d20d285d338b5dff4..5edef1114f1c94e921656972141d62a9d6338105 100644
index e81abc039bf036f71def4dc78f8eb97c0c92ed9d..883d2320914d0687dcee08f078cb20fd857cf971 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -702,9 +702,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -703,9 +703,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*
* @param id the id of the map to get
* @return a map view if it exists, or null otherwise
@ -217,7 +217,7 @@ index 771a504a6f64644f434e2a6d20d285d338b5dff4..5edef1114f1c94e921656972141d62a9
@Nullable
public MapView getMap(int id);
@@ -1033,10 +1032,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1034,10 +1033,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param name the name the player to retrieve
* @return an offline player
* @see #getOfflinePlayer(java.util.UUID)
@ -229,7 +229,7 @@ index 771a504a6f64644f434e2a6d20d285d338b5dff4..5edef1114f1c94e921656972141d62a9
@NotNull
public OfflinePlayer getOfflinePlayer(@NotNull String name);
@@ -1514,7 +1511,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1515,7 +1512,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*
* @return the scoreboard manager or null if no worlds are loaded.
*/
@ -282,7 +282,7 @@ index e455eb21abf121dc6ff10ff8a13dd06f67096a8f..bbc01e7c192ae6689c301670047ff114
return origin;
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index c6019065869130608ac97af951c7036031eec242..31fc272b0e82e4eef6d9bf01dd25d39513d354b3 100644
index af7aed8dd06be375c1f5b1fdb852d7a56bfdf5c6..c1de320da510cd580a1e398fff0f764a844c3ec6 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -415,9 +415,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@ -308,10 +308,10 @@ index c6019065869130608ac97af951c7036031eec242..31fc272b0e82e4eef6d9bf01dd25d395
/**
diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java
index 631cbf2be51040eee00aa39a39c5ec4003f91843..3147e278eac674ed21d714bbe318b135c0a6b408 100644
index 0c0b3616961813b54b0eb1cb29b615f8d4cd931b..635a97fb50c485f7ef2e3bdcbb6f185a4ad551bc 100644
--- a/src/main/java/org/bukkit/block/BlockState.java
+++ b/src/main/java/org/bukkit/block/BlockState.java
@@ -35,8 +35,10 @@ public interface BlockState extends Metadatable {
@@ -34,8 +34,10 @@ public interface BlockState extends Metadatable {
* Gets the metadata for this block state.
*
* @return block specific metadata
@ -322,7 +322,7 @@ index 631cbf2be51040eee00aa39a39c5ec4003f91843..3147e278eac674ed21d714bbe318b135
MaterialData getData();
/**
@@ -131,7 +133,9 @@ public interface BlockState extends Metadatable {
@@ -130,7 +132,9 @@ public interface BlockState extends Metadatable {
* Sets the metadata for this block state.
*
* @param data New block specific metadata
@ -346,7 +346,7 @@ index 4bd127b3646307398e0c937c3e36ab671235b72b..f2557a87f468ee20c2d276dbfc0e9a97
/**
diff --git a/src/main/java/org/bukkit/block/DecoratedPot.java b/src/main/java/org/bukkit/block/DecoratedPot.java
index 210f4be510c2074db3938d604937dae0270dd994..59b98f411f62e16fafb0efb489562847a090c733 100644
index df2596a7d33010e35f5898089e94e7afc1bd0553..dff7cc6a5450d806e65d45c34413542be4b22d66 100644
--- a/src/main/java/org/bukkit/block/DecoratedPot.java
+++ b/src/main/java/org/bukkit/block/DecoratedPot.java
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
@ -397,7 +397,7 @@ index f124b35ec76e6cb6a1a0dc464005087043c3efd0..f50aaddf8582be55fd4860ad374d8f22
+@Deprecated(forRemoval = true) // Paper
public interface LingeringPotion extends ThrownPotion { }
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 94fad96f8fd57314c571b6396f44cd9d91254cfc..b4c41ab64ef35ac0d172c041d97e8fe9b3eb8aa6 100644
index 65850ba1f60be988b1cdd19cc993ab9bf05717b4..2cc1d9e830dec1e0de8018e8dcadcdf0f0f0a658 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -640,7 +640,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
@ -411,7 +411,7 @@ index 94fad96f8fd57314c571b6396f44cd9d91254cfc..b4c41ab64ef35ac0d172c041d97e8fe9
/**
diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java
index 95c79c5fa0c4e30201f887da6467ce5f81c8a255..7f9c4d4b430a3f0276461346ff2621bacf864075 100644
index b7eb96a64a91175cf21e5e6bc53fbe6f045a16fe..177e12108f6108e4858910cef95f72110762b041 100644
--- a/src/main/java/org/bukkit/entity/Minecart.java
+++ b/src/main/java/org/bukkit/entity/Minecart.java
@@ -101,7 +101,9 @@ public interface Minecart extends Vehicle {
@ -564,7 +564,7 @@ index 6bafc62e2235a6b783cbf96f4dabeeaf02bd5178..50c762d777ac90a05772501a28cacff8
cancelledCollision = cancel;
}
diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java
index c0b749a5bbf4980d01fed74768bb61909b579cb9..7e7a53b41013f1bf8956c0e278820f18d77b2f0d 100644
index 82d8fe3be9ff6914b44872462c3827123459735d..633e79e076044f2bc463bd0b7029e310b7629163 100644
--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java
+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java
@@ -656,7 +656,9 @@ public abstract class ChunkGenerator {
@ -599,13 +599,13 @@ index c0b749a5bbf4980d01fed74768bb61909b579cb9..7e7a53b41013f1bf8956c0e278820f18
/**
diff --git a/src/main/java/org/bukkit/inventory/CookingRecipe.java b/src/main/java/org/bukkit/inventory/CookingRecipe.java
index 571652ba8843a9493f1843523e24145baa958637..f7fa79393aef40027446b78bac8e9490cfafd8bc 100644
index 6023e324784c200afa112415e117b63f86540e56..e17a5a0c56e76cba42b73d3143521b18539abd8c 100644
--- a/src/main/java/org/bukkit/inventory/CookingRecipe.java
+++ b/src/main/java/org/bukkit/inventory/CookingRecipe.java
@@ -68,7 +68,9 @@ public abstract class CookingRecipe<T extends CookingRecipe> implements Recipe,
* Get the input material.
@@ -73,7 +73,9 @@ public abstract class CookingRecipe<T extends CookingRecipe> implements Recipe,
* Get the input item type.
*
* @return The input material.
* @return The input item type.
+ * @deprecated Use {@link #getInputChoice()} instead for more complete data.
*/
+ @Deprecated // Paper
@ -648,7 +648,7 @@ index c69904f3ee7f3a41d6cebcd401abf8385dfbf868..62c1c3f01fd58db39f635eee415fcbc1
Entity getHolder();
}
diff --git a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java
index 1d442dc16cbb0fed21714d47007f3f11e30c57d4..af8f7b88edf0fa790edcf16356a030c4834f531e 100644
index b95b86611eea2fa9ed918d2a5a9c43103d061705..7f50c4bf3a289805e802824be3fdd1fb7f2fac8a 100644
--- a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java
+++ b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java
@@ -67,8 +67,10 @@ public class FurnaceRecipe extends CookingRecipe<FurnaceRecipe> {
@ -660,13 +660,13 @@ index 1d442dc16cbb0fed21714d47007f3f11e30c57d4..af8f7b88edf0fa790edcf16356a030c4
@NotNull
+ @Deprecated
public FurnaceRecipe setInput(@NotNull MaterialData input) {
return setInput(input.getItemType(), input.getData());
return setInput(input.getItemType().asItemType());
}
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ecd93dcd54 100644
index 889615d40eb90ba62d44d7310fad16bdfb13da36..3bec3e920178bf2f3d2158f98d026f69339ee71c 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -161,8 +161,7 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -160,8 +160,7 @@ public interface Inventory extends Iterable<ItemStack> {
*
* @return An array of ItemStacks from the inventory. Individual items may be null.
*/
@ -676,7 +676,7 @@ index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ec
/**
* Completely replaces the inventory's contents. Removes all existing
@@ -173,7 +172,7 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -172,7 +171,7 @@ public interface Inventory extends Iterable<ItemStack> {
* @throws IllegalArgumentException If the array has more items than the
* inventory.
*/
@ -685,7 +685,7 @@ index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ec
/**
* Return the contents from the section of the inventory where items can
@@ -186,8 +185,7 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -185,8 +184,7 @@ public interface Inventory extends Iterable<ItemStack> {
*
* @return inventory storage contents. Individual items may be null.
*/
@ -695,7 +695,7 @@ index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ec
/**
* Put the given ItemStacks into the storage slots
@@ -196,7 +194,7 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -195,7 +193,7 @@ public interface Inventory extends Iterable<ItemStack> {
* @throws IllegalArgumentException If the array has more items than the
* inventory.
*/
@ -705,20 +705,20 @@ index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ec
/**
* Checks if the inventory contains any ItemStacks with the given
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 349da0065ddf000cacdc259fab0f2c759332e9ad..abf95d917eca248ff3f5a5caa008c1c87fa1e029 100644
index c8e1377f804c50d41ad29c6c67dea58526d28125..bda53b9db7112e82f581af09262d59da8d7769fa 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -26,7 +26,7 @@ public interface ItemFactory {
@@ -25,7 +25,7 @@ public interface ItemFactory {
* @return a new ItemMeta that could be applied to an item stack of the
* specified material
* specified item type
*/
- @Nullable
+ @org.bukkit.UndefinedNullability // Paper
ItemMeta getItemMeta(@NotNull final Material material);
+ @org.bukkit.UndefinedNullability("null for air") // Paper
ItemMeta getItemMeta(@NotNull final ItemType itemType);
/**
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 83a0631a80db156ace1d977df71d5fc653b70bb6..60a25898fb17c467ffae05039fcd4d3b154a99ff 100644
index 8187b1b801c7a6fd71696bfe21de177705b0e3a2..f71f939ba5f02827999124c5e8dc589247f2c433 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -8,6 +8,7 @@ import java.util.Map;
@ -729,26 +729,18 @@ index 83a0631a80db156ace1d977df71d5fc653b70bb6..60a25898fb17c467ffae05039fcd4d3b
import org.bukkit.Utility;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.enchantments.Enchantment;
@@ -68,6 +69,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
* @param damage durability / damage
* @deprecated see {@link #setDurability(short)}
*/
+ @Deprecated // Paper
public ItemStack(@NotNull final Material type, final int amount, final short damage) {
this(type, amount, damage, null);
}
@@ -169,8 +171,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -214,8 +215,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
* Gets the MaterialData for this stack of items
*
* @return MaterialData for this item
+ * @deprecated cast to {@link org.bukkit.inventory.meta.BlockDataMeta} and use {@link org.bukkit.inventory.meta.BlockDataMeta#getBlockData(Material)}
+ * @deprecated cast to {@link org.bukkit.inventory.meta.BlockDataMeta} and use {@link org.bukkit.inventory.meta.BlockDataMeta#getBlockData(org.bukkit.block.BlockType)}
*/
@Nullable
+ @Deprecated // Paper
public MaterialData getData() {
Material mat = Bukkit.getUnsafe().toLegacy(getType());
Material mat = Bukkit.getUnsafe().toLegacy(Bukkit.getUnsafe().toMaterial(getType()));
if (data == null && mat != null && mat.getData() != null) {
@@ -184,7 +188,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -229,7 +232,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
* Sets the MaterialData for this stack of items
*
* @param data New MaterialData for this item
@ -758,12 +750,12 @@ index 83a0631a80db156ace1d977df71d5fc653b70bb6..60a25898fb17c467ffae05039fcd4d3b
public void setData(@Nullable MaterialData data) {
if (data == null) {
this.data = data;
@@ -546,7 +552,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -596,7 +601,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
*
* @return a copy of the current ItemStack's ItemData
*/
- @Nullable
+ @UndefinedNullability // Paper
+ @UndefinedNullability("null for air") // Paper
public ItemMeta getItemMeta() {
return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone();
}
@ -804,10 +796,10 @@ index 5461f7fa75f5a065bb333b4a113640b5fe1e3825..c4d657727e508cb941320730a9d3aa54
/**
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index c2d224b6472a65cd362e1ab55ce7e3d0b5a3befc..833322283bdddc16524ddb56aaa481bf36881eeb 100644
index 4869adf9b89f1458af5517ae5813d44630846de8..9d86f3de1bfd5beeda1f19ae9d0db9849c72b0cb 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -112,8 +112,10 @@ public class ShapedRecipe implements Recipe, Keyed {
@@ -111,8 +111,10 @@ public class ShapedRecipe implements Recipe, Keyed {
* @param ingredient The ingredient.
* @return The changed recipe, so you can chain calls.
* @throws IllegalArgumentException if the {@code key} does not appear in the shape.
@ -816,9 +808,9 @@ index c2d224b6472a65cd362e1ab55ce7e3d0b5a3befc..833322283bdddc16524ddb56aaa481bf
@NotNull
+ @Deprecated // Paper
public ShapedRecipe setIngredient(char key, @NotNull MaterialData ingredient) {
return setIngredient(key, ingredient.getItemType(), ingredient.getData());
return setIngredient(key, ingredient.getItemType().asItemType());
}
@@ -191,7 +193,9 @@ public class ShapedRecipe implements Recipe, Keyed {
@@ -166,7 +168,9 @@ public class ShapedRecipe implements Recipe, Keyed {
* Get a copy of the ingredients map.
*
* @return The mapping of character to ingredients.
@ -829,10 +821,10 @@ index c2d224b6472a65cd362e1ab55ce7e3d0b5a3befc..833322283bdddc16524ddb56aaa481bf
public Map<Character, ItemStack> getIngredientMap() {
HashMap<Character, ItemStack> result = new HashMap<Character, ItemStack>();
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index 8bf26da12dcb03f22f842a57798948d5513c227d..e5a2febc26a2b0aca0b83c48cd35ccdea1e6a222 100644
index 1ff7f7327c3462f54b8b2d1100c608f30ecabe31..90d54c39181e602af08dc43e37e66a8572fe1996 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -53,8 +53,10 @@ public class ShapelessRecipe implements Recipe, Keyed {
@@ -52,8 +52,10 @@ public class ShapelessRecipe implements Recipe, Keyed {
*
* @param ingredient The ingredient to add.
* @return The changed recipe, so you can chain calls.
@ -843,7 +835,7 @@ index 8bf26da12dcb03f22f842a57798948d5513c227d..e5a2febc26a2b0aca0b83c48cd35ccde
public ShapelessRecipe addIngredient(@NotNull MaterialData ingredient) {
return addIngredient(1, ingredient);
}
@@ -90,8 +92,10 @@ public class ShapelessRecipe implements Recipe, Keyed {
@@ -75,8 +77,10 @@ public class ShapelessRecipe implements Recipe, Keyed {
* @param count How many to add (can't be more than 9!)
* @param ingredient The ingredient to add.
* @return The changed recipe, so you can chain calls.
@ -852,9 +844,9 @@ index 8bf26da12dcb03f22f842a57798948d5513c227d..e5a2febc26a2b0aca0b83c48cd35ccde
@NotNull
+ @Deprecated // Paper
public ShapelessRecipe addIngredient(int count, @NotNull MaterialData ingredient) {
return addIngredient(count, ingredient.getItemType(), ingredient.getData());
return addIngredient(count, ingredient.getItemType().asItemType());
}
@@ -208,8 +212,10 @@ public class ShapelessRecipe implements Recipe, Keyed {
@@ -173,8 +177,10 @@ public class ShapelessRecipe implements Recipe, Keyed {
*
* @param ingredient The ingredient to remove
* @return The changed recipe.
@ -863,9 +855,9 @@ index 8bf26da12dcb03f22f842a57798948d5513c227d..e5a2febc26a2b0aca0b83c48cd35ccde
@NotNull
+ @Deprecated // Paper
public ShapelessRecipe removeIngredient(@NotNull MaterialData ingredient) {
return removeIngredient(ingredient.getItemType(), ingredient.getData());
return removeIngredient(ingredient.getItemType().asItemType());
}
@@ -236,8 +242,10 @@ public class ShapelessRecipe implements Recipe, Keyed {
@@ -209,8 +215,10 @@ public class ShapelessRecipe implements Recipe, Keyed {
* @param count The number of copies to remove.
* @param ingredient The ingredient to remove.
* @return The changed recipe.
@ -874,9 +866,9 @@ index 8bf26da12dcb03f22f842a57798948d5513c227d..e5a2febc26a2b0aca0b83c48cd35ccde
@NotNull
+ @Deprecated // Paper
public ShapelessRecipe removeIngredient(int count, @NotNull MaterialData ingredient) {
return removeIngredient(count, ingredient.getItemType(), ingredient.getData());
return removeIngredient(count, ingredient.getItemType().asItemType());
}
@@ -298,7 +306,9 @@ public class ShapelessRecipe implements Recipe, Keyed {
@@ -230,7 +238,9 @@ public class ShapelessRecipe implements Recipe, Keyed {
* Get the list of ingredients used for this recipe.
*
* @return The input list
@ -887,13 +879,13 @@ index 8bf26da12dcb03f22f842a57798948d5513c227d..e5a2febc26a2b0aca0b83c48cd35ccde
public List<ItemStack> getIngredientList() {
ArrayList<ItemStack> result = new ArrayList<ItemStack>(ingredients.size());
diff --git a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
index 597a18a767b68b47e81454b7d44613c7178c1366..bc3440eb72127824b3961fbdae583bb61385f65e 100644
index 0de3c34c67b8c37a3c7ba8bcec4404ed4ef5019e..d99c5f00905f3eaf2be20e3b68184c948c417b9e 100644
--- a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
+++ b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
@@ -57,7 +57,9 @@ public class StonecuttingRecipe implements Recipe, Keyed {
* Get the input material.
@@ -62,7 +62,9 @@ public class StonecuttingRecipe implements Recipe, Keyed {
* Get the input item stack.
*
* @return The input material.
* @return The input item stack.
+ * @deprecated Use {@link #getInputChoice()} instead for more complete data.
*/
+ @Deprecated // Paper
@ -1033,14 +1025,14 @@ index 0ea9c6b2420a0f990bd1fdf50fc015e37a7060d8..e99644eae1c662b117aa19060d2484ac
/**
diff --git a/src/test/java/org/bukkit/materials/MaterialDataTest.java b/src/test/java/org/bukkit/materials/MaterialDataTest.java
index a935ae4a25b7955416652bf8c4690a804f12e903..e83321263bb0e2b67af981dbb2e8fec4e973ae56 100644
index c5ce01d7a84d06ab4a797207377a09706882e9af..13d351af0f9dd4d27b93cf48c521dff1bdab3a38 100644
--- a/src/test/java/org/bukkit/materials/MaterialDataTest.java
+++ b/src/test/java/org/bukkit/materials/MaterialDataTest.java
@@ -22,6 +22,7 @@ import org.bukkit.material.WoodenStep;
import org.bukkit.material.types.MushroomBlockTexture;
@@ -23,6 +23,7 @@ import org.bukkit.material.types.MushroomBlockTexture;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;
+@Deprecated // Paper
public class MaterialDataTest {
public class MaterialDataTest extends AbstractTestingBase {
@Test

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Mob Spawner API Enhancements
diff --git a/src/main/java/org/bukkit/block/CreatureSpawner.java b/src/main/java/org/bukkit/block/CreatureSpawner.java
index 8dae9611e702d93b202563597c50752c5f5b77d4..3dcab76632c4f8646d7ae62bb8de287eb6ef55b5 100644
index 6586c8a81e8d9b4fc5afcb89878f2594ed4306b6..98a9d2b012f6d084ae8d1886021c3dccfbb4ca74 100644
--- a/src/main/java/org/bukkit/block/CreatureSpawner.java
+++ b/src/main/java/org/bukkit/block/CreatureSpawner.java
@@ -199,4 +199,30 @@ public interface CreatureSpawner extends TileState {
@ -27,7 +27,7 @@ index 8dae9611e702d93b202563597c50752c5f5b77d4..3dcab76632c4f8646d7ae62bb8de287e
+ public void resetTimer();
+
+ /**
+ * Sets the {@link EntityType} to {@link EntityType#DROPPED_ITEM} and sets the data to the given
+ * Sets the {@link EntityType} to {@link EntityType#ITEM} and sets the data to the given
+ * {@link org.bukkit.inventory.ItemStack ItemStack}.
+ * <p>
+ * {@link #setSpawnCount(int)} does not dictate the amount of items in the stack spawned, but rather how many

View file

@ -76,10 +76,10 @@ index 0000000000000000000000000000000000000000..ec36942128cbacae171584c89480b4aa
+ Sound getFallSound();
+}
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 78f6cc1a8a8de05aec6f551f8a5f425944f0ffa3..b0b148918eeaf10d60734def6ac84b678c0d74c7 100644
index cad80c8aeb55fe9846189c62ff9cfdb5525c7236..22926629a86b24e26a6949550178d5ead0a4ba25 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -607,4 +607,25 @@ public interface Block extends Metadatable, Translatable {
@@ -606,4 +606,25 @@ public interface Block extends Metadatable, Translatable {
* @return <code>true</code> if the block data can be placed here
*/
boolean canPlace(@NotNull BlockData data);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index ef7445fc5c169e64a73dce4f71a2885fb976caf3..d39c6b5d3fef5fe9727868175cf266fd68c2efa4 100644
index d22fde8aa7d9dc2d3e717716b4604ad8604daa61..26acb25d6cce69c3da8c345c30b48817e2be47d4 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2336,6 +2336,10 @@ public final class Bukkit {
@@ -2340,6 +2340,10 @@ public final class Bukkit {
public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) {
return server.createProfileExact(uuid, name);
}
@ -20,10 +20,10 @@ index ef7445fc5c169e64a73dce4f71a2885fb976caf3..d39c6b5d3fef5fe9727868175cf266fd
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 5edef1114f1c94e921656972141d62a9d6338105..e02bd7323e117e9977275b3a5d3e070ff891fdbd 100644
index 883d2320914d0687dcee08f078cb20fd857cf971..b8bbdc6a7ab5562eae0977f694dc1ad25652ab99 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2033,5 +2033,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2037,5 +2037,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name);

View file

@ -10,10 +10,10 @@ Adds bool param to trigger exp drops for blocks
Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index b0b148918eeaf10d60734def6ac84b678c0d74c7..232662f3130ca49156ed8b71acf4495aea33c212 100644
index 22926629a86b24e26a6949550178d5ead0a4ba25..da77f02f164998b0b8905fcf85730deda947d742 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -481,6 +481,52 @@ public interface Block extends Metadatable, Translatable {
@@ -480,6 +480,52 @@ public interface Block extends Metadatable, Translatable {
*/
boolean breakNaturally(@Nullable ItemStack tool);

View file

@ -8,7 +8,7 @@ Adds a new event similar to PlayerEggThrowEvent, but without the Player requirem
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d380187c9c
index 0000000000000000000000000000000000000000..395f8da2d344cd036ceaee5dd39662e719df4e98
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java
@@ -0,0 +1,115 @@
@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
+ private static final HandlerList handlers = new HandlerList();
+ private final Egg egg;
+ private boolean hatching;
+ private EntityType hatchType;
+ private EntityType<?> hatchType;
+ private byte numHatches;
+
+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) {
+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType<?> hatchingType) {
+ this.egg = egg;
+ this.hatching = hatching;
+ this.numHatches = numHatches;
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
+ * @return The type of the mob being hatched by the egg
+ */
+ @NotNull
+ public EntityType getHatchingType() {
+ public EntityType<?> getHatchingType() {
+ return hatchType;
+ }
+
@ -84,7 +84,7 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3
+ *
+ * @param hatchType The type of the mob being hatched by the egg
+ */
+ public void setHatchingType(@NotNull EntityType hatchType) {
+ public void setHatchingType(@NotNull EntityType<?> hatchType) {
+ if (!hatchType.isSpawnable()) throw new IllegalArgumentException("Can't spawn that entity type from an egg!");
+ this.hatchType = hatchType;
+ }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add tick times API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index d39c6b5d3fef5fe9727868175cf266fd68c2efa4..354fa01b30ec26f78f874a06e57a89f14ef13ef4 100644
index 26acb25d6cce69c3da8c345c30b48817e2be47d4..ad3de5789b2490f5f2c42cc173caa1ef18a95e53 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2008,6 +2008,25 @@ public final class Bukkit {
@@ -2009,6 +2009,25 @@ public final class Bukkit {
public static double[] getTPS() {
return server.getTPS();
}
@ -35,10 +35,10 @@ index d39c6b5d3fef5fe9727868175cf266fd68c2efa4..354fa01b30ec26f78f874a06e57a89f1
/**
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e02bd7323e117e9977275b3a5d3e070ff891fdbd..edceaefe5e46515300c819351aebe0fce576d599 100644
index b8bbdc6a7ab5562eae0977f694dc1ad25652ab99..73fc1082b3c867ec73aff12378bf0cabef97054c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1695,6 +1695,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1696,6 +1696,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
public double[] getTPS();

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 354fa01b30ec26f78f874a06e57a89f14ef13ef4..725de23dc102e3b63da5e49bb1eafca96e33fc4c 100644
index ad3de5789b2490f5f2c42cc173caa1ef18a95e53..32847b69be4c73529b54d3f717d9cf15a16e9669 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2359,6 +2359,15 @@ public final class Bukkit {
@@ -2363,6 +2363,15 @@ public final class Bukkit {
public static int getCurrentTick() {
return server.getCurrentTick();
}
@ -26,10 +26,10 @@ index 354fa01b30ec26f78f874a06e57a89f14ef13ef4..725de23dc102e3b63da5e49bb1eafca9
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index edceaefe5e46515300c819351aebe0fce576d599..960fc19a04bc3475bd81301ec283c9bb32f62821 100644
index 73fc1082b3c867ec73aff12378bf0cabef97054c..e4370e5c0e529c221e0e0a7b0b0c89f8528dae0f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2055,5 +2055,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2059,5 +2059,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return Current tick
*/
int getCurrentTick();

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index a6aa33b9574d0278e10927007a62290e1d102e73..beddcb13a598d799c8ae1cec9c01c900e38b1458 100644
index 4c2ae9cb674260deba91d734bf7bf24fd7038485..f2909100f7abe0a650cc8b2631dddcb26380344a 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -126,5 +126,9 @@ public interface UnsafeValues {
@@ -135,5 +135,9 @@ public interface UnsafeValues {
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
}
@ -20,10 +20,10 @@ index a6aa33b9574d0278e10927007a62290e1d102e73..beddcb13a598d799c8ae1cec9c01c900
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 60a25898fb17c467ffae05039fcd4d3b154a99ff..3da071798b89e1dd1453f4339af87933cdf0105e 100644
index f71f939ba5f02827999124c5e8dc589247f2c433..971df4980db6289bd11f661956d8f1d3c52b7822 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -639,6 +639,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -688,6 +688,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
}

View file

@ -229,10 +229,10 @@ index 0000000000000000000000000000000000000000..cf67dc7d465223710adbf2b798109f52
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b21834a0ec507d223cdb178b4500981c9e8dc248..e5781bec16cde82603022e117868be71c2a1faa4 100644
index 9649e65d2b0af4f72d648eb33c0de124ba4b5e34..c3387633e7192887d61b871a9af85f1e35a2eecb 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2723,6 +2723,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2711,6 +2711,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* Reset the cooldown counter to 0, effectively starting the cooldown period.
*/
void resetCooldown();

View file

@ -7,12 +7,12 @@ Subject: [PATCH] Fix Potion#toItemStack swapping the extended and upgraded
While the Potion class is deprecated, it is still used in some plugins for cross-version potion handling. This issue has existed for a long time, and has caused many heaches along the way.
diff --git a/src/main/java/org/bukkit/potion/Potion.java b/src/main/java/org/bukkit/potion/Potion.java
index 266547c6da0e3270af5c9ca81268934294a7c48d..69e7ce61090e3e3a7a337a96b380c8ffe78ffb8d 100644
index 9a670f91a4799933780fc6812e78c8df535d2ed8..c4e551e2c78e959b25c749c32c22c7f0e2f492a9 100644
--- a/src/main/java/org/bukkit/potion/Potion.java
+++ b/src/main/java/org/bukkit/potion/Potion.java
@@ -267,7 +267,7 @@ public class Potion {
}
ItemStack itemStack = new ItemStack(material, amount);
ItemStack itemStack = ItemStack.of(itemType, amount);
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
- meta.setBasePotionData(new PotionData(type, level == 2, extended));
+ meta.setBasePotionData(new PotionData(type, extended, level == 2)); // Paper - fix swapped values

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Villager Restocks API
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
index a91400cd8bb4c72d1f3200a17f6de025540fe09d..4128b848ec739308694d54d9e859c28185f42a63 100644
index a6e57f8ad3f09d05ca61c824d128221528f7a96d..5ba0ac5f8675c8db1955318355d5a16f23f55e3f 100644
--- a/src/main/java/org/bukkit/entity/Villager.java
+++ b/src/main/java/org/bukkit/entity/Villager.java
@@ -78,6 +78,20 @@ public interface Villager extends AbstractVillager {
@@ -81,6 +81,20 @@ public interface Villager extends AbstractVillager {
*/
public void setVillagerExperience(int experience);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 725de23dc102e3b63da5e49bb1eafca96e33fc4c..dfeaddc2d71f8569c349740c00c96868f9a56a12 100644
index 32847b69be4c73529b54d3f717d9cf15a16e9669..834b5fb69de90ed1b5f012887f74608fdec56f6d 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -156,6 +156,18 @@ public final class Bukkit {
@@ -157,6 +157,18 @@ public final class Bukkit {
return server.getBukkitVersion();
}
@ -28,10 +28,10 @@ index 725de23dc102e3b63da5e49bb1eafca96e33fc4c..dfeaddc2d71f8569c349740c00c96868
* Gets a view of all currently logged in players. This {@linkplain
* Collections#unmodifiableCollection(Collection) view} is a reused
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 960fc19a04bc3475bd81301ec283c9bb32f62821..ccec37c00f8ab318d41350907b40a64118e4fab1 100644
index e4370e5c0e529c221e0e0a7b0b0c89f8528dae0f..23d07141696d17c41a37dbda094d62b38386a45b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -114,6 +114,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -115,6 +115,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
public String getBukkitVersion();

View file

@ -525,10 +525,10 @@ index 0000000000000000000000000000000000000000..c9837c7c47314b5bdf6c7973e6bc962d
+ @Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21") GoalKey<Mob> UNIVERSAL_ANGER_RESET = GoalKey.of(Mob.class, NamespacedKey.minecraft("universal_anger_reset"));
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index dfeaddc2d71f8569c349740c00c96868f9a56a12..4e5e29251b713885eee562091ea4f253f027bdbb 100644
index 834b5fb69de90ed1b5f012887f74608fdec56f6d..690d8584e3f74aae87038b2b8225f28f1b912362 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2380,6 +2380,16 @@ public final class Bukkit {
@@ -2384,6 +2384,16 @@ public final class Bukkit {
public static boolean isStopping() {
return server.isStopping();
}
@ -546,10 +546,10 @@ index dfeaddc2d71f8569c349740c00c96868f9a56a12..4e5e29251b713885eee562091ea4f253
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ccec37c00f8ab318d41350907b40a64118e4fab1..9634d82d603426979cab978f9474cc041e1cb701 100644
index 23d07141696d17c41a37dbda094d62b38386a45b..e8a735a3035fe214889738bd0220dae8b51a9535 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2072,5 +2072,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2076,5 +2076,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if server is in the process of being shutdown
*/
boolean isStopping();

View file

@ -110,20 +110,20 @@ index 0000000000000000000000000000000000000000..5600fcdc9795a9f49091db48d73bbd49
+ TRADING,
+}
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
index 4128b848ec739308694d54d9e859c28185f42a63..d841d94d46462e0ceb7c6b04cc8fc36792bd9201 100644
index 5ba0ac5f8675c8db1955318355d5a16f23f55e3f..74cc876788674f64ca0451f5fb7c0da23b168d0c 100644
--- a/src/main/java/org/bukkit/entity/Villager.java
+++ b/src/main/java/org/bukkit/entity/Villager.java
@@ -1,6 +1,8 @@
package org.bukkit.entity;
@@ -2,6 +2,8 @@ package org.bukkit.entity;
import java.util.Locale;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import java.util.Map; // Paper
+import java.util.UUID; // Paper
import org.bukkit.Keyed;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
@@ -242,4 +244,50 @@ public interface Villager extends AbstractVillager {
return key;
@@ -285,4 +287,50 @@ public interface Villager extends AbstractVillager {
return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]);
}
}
+

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Spawn Reason API
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
index 05c29cbd2ae1ca0434a90f8389479bd608ca2ac1..66bc6da2a482bb207ec50beb22fd62aeda90cc34 100644
index 8264599a873ed23ec6552d1550a414ec3712487b..3806e420af559ddb26c567523b656c79a635b229 100644
--- a/src/main/java/org/bukkit/RegionAccessor.java
+++ b/src/main/java/org/bukkit/RegionAccessor.java
@@ -10,6 +10,7 @@ import org.bukkit.block.data.BlockData;
@@ -11,6 +11,7 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@ -16,7 +16,7 @@ index 05c29cbd2ae1ca0434a90f8389479bd608ca2ac1..66bc6da2a482bb207ec50beb22fd62ae
import org.bukkit.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -309,7 +310,34 @@ public interface RegionAccessor {
@@ -312,7 +313,36 @@ public interface RegionAccessor {
* {@link Entity} requested cannot be spawned
*/
@NotNull
@ -37,13 +37,15 @@ index 05c29cbd2ae1ca0434a90f8389479bd608ca2ac1..66bc6da2a482bb207ec50beb22fd62ae
+ }
+
+ @NotNull
+ public default Entity spawnEntity(@NotNull Location loc, @NotNull org.bukkit.entity.EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
+ return spawn(loc, (Class<Entity>) type.getEntityClass(), reason, null);
+ public default <T extends Entity> Entity spawnEntity(@NotNull Location loc, @NotNull EntityType<T> type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
+ com.google.common.base.Preconditions.checkArgument(type.getEntityClass() != null);
+ return spawn(loc, type.getEntityClass(), reason, null);
+ }
+
+ @NotNull
+ public default Entity spawnEntity(@NotNull Location loc, @NotNull org.bukkit.entity.EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer<Entity> function) {
+ return spawn(loc, (Class<Entity>) type.getEntityClass(), reason, function);
+ public default <T extends Entity> Entity spawnEntity(@NotNull Location loc, @NotNull EntityType<T> type, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer<T> function) {
+ com.google.common.base.Preconditions.checkArgument(type.getEntityClass() != null);
+ return spawn(loc, type.getEntityClass(), reason, function);
+ }
+
+ @NotNull

View file

@ -8,10 +8,10 @@ Adds a new method to fetch the location of a player's bed without generating any
getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index d44c5a3fda0b159dc541246cb2fca8427cb38243..7e9e1e0b21314e6542f5f40503cd6926c75cc369 100644
index 384e310c725e53276886fe5ab3239d911aabc350..7bfc78cff563bc104a29b9d58befcd29a78653f3 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -269,6 +269,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@@ -266,6 +266,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/
public int getSleepTicks();

View file

@ -28,10 +28,10 @@ index 83a4642119c3f33749e04c774cf2b39839f797e2..a39d2f1acbbd84ae0e2cf29f85594e09
public Location getLocation() {
return getInventory().getLocation();
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 466d1bd7089b76f48f953e1a51c611ecd93dcd54..129b5ab5062beeb9bb52465a788bc3a3aee9c49e 100644
index 3bec3e920178bf2f3d2158f98d026f69339ee71c..af6bfacd5f209e75b7c5f37201c3ba9e8e74d885 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -385,6 +385,17 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -384,6 +384,17 @@ public interface Inventory extends Iterable<ItemStack> {
@Nullable
public InventoryHolder getHolder();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index e5781bec16cde82603022e117868be71c2a1faa4..f42bc869ab78abb4f05d36c9a6563c71dfe1ea4f 100644
index c3387633e7192887d61b871a9af85f1e35a2eecb..c6ee16a347dc10c718c2d277dba1eff76f7edbbf 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2832,6 +2832,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2820,6 +2820,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
// Paper end
}

View file

@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..df05153397b42930cd53d37b30824c7e
+ }
+}
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
index 66bc6da2a482bb207ec50beb22fd62aeda90cc34..501dd5a26c27294420821b3d75f8938596afb1a8 100644
index 3806e420af559ddb26c567523b656c79a635b229..d039095a2c2f2c61b5596aa33e98e7cc95818678 100644
--- a/src/main/java/org/bukkit/RegionAccessor.java
+++ b/src/main/java/org/bukkit/RegionAccessor.java
@@ -421,4 +421,12 @@ public interface RegionAccessor {
@@ -426,4 +426,12 @@ public interface RegionAccessor {
* {@link HeightMap}
*/
public int getHighestBlockYAt(@NotNull Location location, @NotNull HeightMap heightMap);

View file

@ -144,19 +144,19 @@ index 753bfcec441533071120d925c83789ef53afa176..c6bc84a8755b2fe5d7d8d3ec857700ec
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 7705fece7f58bd66f7d68da85f8f34e43b4bae12..6a89eab53f21bc4420e616cc299864fb564e1045 100644
index e022c70ba53d623053f1c826d57e47fb102dfce0..be4f6fbf013a4259b04f805b4265750bb7fcd0c3 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -119,7 +119,7 @@ import org.jetbrains.annotations.Nullable;
* An enum of all material IDs accepted by the official server and client
@@ -122,7 +122,7 @@ import org.jetbrains.annotations.Nullable;
* @deprecated Material was split up into {@link ItemType} and {@link BlockType}
*/
@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper
@Deprecated
-public enum Material implements Keyed, Translatable {
+public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper
//<editor-fold desc="Materials" defaultstate="collapsed">
AIR(9648, 0),
STONE(22948),
@@ -4450,6 +4450,15 @@ public enum Material implements Keyed, Translatable {
@@ -4454,6 +4454,15 @@ public enum Material implements Keyed, Translatable {
}
return false;
}
@ -172,7 +172,7 @@ index 7705fece7f58bd66f7d68da85f8f34e43b4bae12..6a89eab53f21bc4420e616cc299864fb
// Paper end
/**
@@ -10949,9 +10958,11 @@ public enum Material implements Keyed, Translatable {
@@ -10953,9 +10962,11 @@ public enum Material implements Keyed, Translatable {
* material
* @see #getBlockTranslationKey()
* @see #getItemTranslationKey()
@ -208,59 +208,36 @@ index e3faa2c675c85a9cbdbbb1debec0ff81c58a1bbd..fd1629c2d2028a88fb3d56b0aeb833d1
String getTranslationKey();
}
diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java
index 13eac9ad2c1672051635d1c35cc49239252e7a61..107e36ef02a9481954bd770ce9a55a0b1e84be7a 100644
index adccc6e33447006beefbd6165fe749dad4516852..e9b2f8622683b3293a99b99d77e0d9618e45d682 100644
--- a/src/main/java/org/bukkit/attribute/Attribute.java
+++ b/src/main/java/org/bukkit/attribute/Attribute.java
@@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Types of attributes which may be present on an {@link Attributable}.
*/
-public enum Attribute implements Keyed {
+public enum Attribute implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
-public abstract class Attribute extends OldEnum<Attribute> implements Keyed {
+public abstract class Attribute extends OldEnum<Attribute> implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
/**
* Maximum health of an Entity.
@@ -73,4 +73,10 @@ public enum Attribute implements Keyed {
public NamespacedKey getKey() {
return key;
}
+ // Paper start
+ @Override
+ public @NotNull String translationKey() {
+ return "attribute.name." + this.key.getKey();
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java
index d3087d60378822cdd7cea25fd63d3f496e3cd2fb..5d8fa5b39a5d50cca48ba63af3a84b80f279b649 100644
index a1e90ed16a9b1daafeb593fec7e894dde383fd52..93c2b0ce11cc16dccb829e57f61f5ca0f417716a 100644
--- a/src/main/java/org/bukkit/block/Biome.java
+++ b/src/main/java/org/bukkit/block/Biome.java
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Holds all accepted Biomes in the default server
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
* Depending on the server there might be additional biomes present (for example biomes created by data packs),
* which you can get via {@link Registry#BIOME}.
*/
-public enum Biome implements Keyed {
+public enum Biome implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
OCEAN,
PLAINS,
DESERT,
@@ -89,4 +89,11 @@ public enum Biome implements Keyed {
public NamespacedKey getKey() {
return key;
}
+
+ // Paper start
+ @Override
+ public @NotNull String translationKey() {
+ return "biome.minecraft." + this.key.getKey();
+ }
+ // Paper end
}
-public abstract class Biome extends OldEnum<Biome> implements Keyed {
+public abstract class Biome extends OldEnum<Biome> implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
public static final Biome OCEAN = getBiome("ocean");
public static final Biome PLAINS = getBiome("plains");
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 232662f3130ca49156ed8b71acf4495aea33c212..5ae85ddc2cff3145dcba877a7bf55abd818f6881 100644
index da77f02f164998b0b8905fcf85730deda947d742..bf50f6f1a6cb4f2493fe29d517289913d767ba26 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
* (i.e. lighting and power) may not be able to be safely accessed during world
* generation when used in cases like BlockPhysicsEvent!!!!
*/
@ -269,7 +246,7 @@ index 232662f3130ca49156ed8b71acf4495aea33c212..5ae85ddc2cff3145dcba877a7bf55abd
/**
* Gets the metadata for this block
@@ -673,5 +673,12 @@ public interface Block extends Metadatable, Translatable {
@@ -672,5 +672,12 @@ public interface Block extends Metadatable, Translatable {
* @return the sound group for this block
*/
@NotNull org.bukkit.SoundGroup getBlockSoundGroup();
@ -282,11 +259,24 @@ index 232662f3130ca49156ed8b71acf4495aea33c212..5ae85ddc2cff3145dcba877a7bf55abd
+ String getTranslationKey();
// Paper end
}
diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java
index f39a7fa2e2b70a458e97f727ef8f4c696a859b71..9f77976b2f33ba2d5af89ea143a39a0f417a4429 100644
--- a/src/main/java/org/bukkit/block/BlockType.java
+++ b/src/main/java/org/bukkit/block/BlockType.java
@@ -109,7 +109,7 @@ import org.bukkit.inventory.ItemType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-public interface BlockType<B extends BlockData> extends Keyed, Translatable {
+public interface BlockType<B extends BlockData> extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
//<editor-fold desc="BlockTypes" defaultstate="collapsed">
BlockType<BlockData> AIR = getBlockType("air");
BlockType<BlockData> STONE = getBlockType("stone");
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
index 2dc749936df6168073a5bb9f9051d55f8589ac62..1b6f42ff632b1f3f5034c825e99b72f389a890b4 100644
index 340a06329e6603fb20d02eda294972fc18508543..0eb240094901b66c118c5a68bc0b2d0396ec6835 100644
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable;
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
/**
* The various type of enchantments that may be added to armour or weapons
*/
@ -296,10 +286,10 @@ index 2dc749936df6168073a5bb9f9051d55f8589ac62..1b6f42ff632b1f3f5034c825e99b72f3
* Provides protection against environmental damage
*/
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
index 4d5f0837bd0e02a30c943d8969fb6b13452322e0..a39f9c078f42451bd122f3e3729d10ca299bee5f 100644
index 3f432a055d9fc70e6b16bf87c209be50232f2e93..fa6613efcfcee70507c77ee40460d35c3957d91b 100644
--- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
@@ -69,5 +69,10 @@ public class EnchantmentWrapper extends Enchantment {
@@ -77,5 +77,10 @@ public class EnchantmentWrapper extends Enchantment {
public net.kyori.adventure.text.Component displayName(int level) {
return getEnchantment().displayName(level);
}
@ -311,68 +301,31 @@ index 4d5f0837bd0e02a30c943d8969fb6b13452322e0..a39f9c078f42451bd122f3e3729d10ca
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
index bb9ae81870a340c00d7480aff5106dc2c44dab8a..6c40a989eff1163c19106c1e6b4c8fc01ace7280 100644
index 9bb9b2d164a027ab8e9e5b05a819c902d5ef2fe4..a086c3472fa12667e5ca9276a201dbd731101602 100644
--- a/src/main/java/org/bukkit/entity/EntityType.java
+++ b/src/main/java/org/bukkit/entity/EntityType.java
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Contract;
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-public enum EntityType implements Keyed, Translatable {
+public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable
-public abstract class EntityType<E extends Entity> extends OldEnum<EntityType<E>> implements Keyed, Translatable {
+public abstract class EntityType<E extends Entity> extends OldEnum<EntityType<E>> implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable
private static final BiMap<Short, EntityType> ID_MAP = HashBiMap.create();
// These strings MUST match the strings in nms.EntityTypes and are case sensitive.
/**
@@ -435,10 +435,22 @@ public enum EntityType implements Keyed, Translatable {
@Override
@NotNull
+ @Deprecated(forRemoval = true) // Paper
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
+ // Paper start
+ /**
+ * @throws IllegalArgumentException if the entity does not have a translation key (is probably a custom entity)
+ */
+ @Override
+ public @NotNull String translationKey() {
+ Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys");
+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
+ }
+ // Paper end
+
/**
* Gets if this EntityType is enabled by feature in a world.
*
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
index d841d94d46462e0ceb7c6b04cc8fc36792bd9201..8c8176121cafed0ed09239b6a7b392dc846438e2 100644
index 74cc876788674f64ca0451f5fb7c0da23b168d0c..767f940149821a2a31124d3186229deadbb53c67 100644
--- a/src/main/java/org/bukkit/entity/Villager.java
+++ b/src/main/java/org/bukkit/entity/Villager.java
@@ -160,7 +160,7 @@ public interface Villager extends AbstractVillager {
@@ -183,7 +183,7 @@ public interface Villager extends AbstractVillager {
* Represents the various different Villager professions there may be.
* Villagers have different trading options depending on their profession,
*/
- public enum Profession implements Keyed {
+ public enum Profession implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
NONE,
- public abstract class Profession extends OldEnum<Profession> implements Keyed {
+ public abstract class Profession extends OldEnum<Profession> implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
public static final Profession NONE = getProfession("none");
/**
* Armorer profession. Wears a black apron. Armorers primarily trade for
@@ -243,6 +243,13 @@ public interface Villager extends AbstractVillager {
public NamespacedKey getKey() {
return key;
}
+
+ // Paper start
+ @Override
+ public @NotNull String translationKey() {
+ return "entity.minecraft.villager." + this.key.getKey();
+ }
+ // Paper end
}
// Paper start - Add villager reputation API
diff --git a/src/main/java/org/bukkit/inventory/CreativeCategory.java b/src/main/java/org/bukkit/inventory/CreativeCategory.java
index 5bd252c0ae3b09fe141d131360c67bb9bfbf5422..78587d9fabe6371a23a7963917b054dbe7603694 100644
--- a/src/main/java/org/bukkit/inventory/CreativeCategory.java
@ -453,7 +406,7 @@ index 5bd252c0ae3b09fe141d131360c67bb9bfbf5422..78587d9fabe6371a23a7963917b054db
+
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 3da071798b89e1dd1453f4339af87933cdf0105e..e4ad3a550050c4bf9cc7a2a1082bfdf668050efe 100644
index 971df4980db6289bd11f661956d8f1d3c52b7822..89fe32de713df3a5f2a25d72cbfe316e5b6c3f1b 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
@ -462,10 +415,10 @@ index 3da071798b89e1dd1453f4339af87933cdf0105e..e4ad3a550050c4bf9cc7a2a1082bfdf6
*/
-public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper
+public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable { // Paper
private Material type = Material.AIR;
private int amount = 0;
private MaterialData data = null;
@@ -606,6 +606,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
/**
* Creates a new ItemStack with an amount of 1.
@@ -655,6 +655,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@Override
@NotNull
@ -473,7 +426,7 @@ index 3da071798b89e1dd1453f4339af87933cdf0105e..e4ad3a550050c4bf9cc7a2a1082bfdf6
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
@@ -865,5 +866,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -914,5 +915,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
ItemMeta itemMeta = getItemMeta();
return itemMeta != null && itemMeta.hasItemFlag(flag);
}
@ -490,3 +443,16 @@ index 3da071798b89e1dd1453f4339af87933cdf0105e..e4ad3a550050c4bf9cc7a2a1082bfdf6
+ }
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
index ad7f415dcd9ca38c53cae75798d84a74b39ae7de..834c6b0ba732a8f5c2bdb3163a74efb3aa687ba9 100644
--- a/src/main/java/org/bukkit/inventory/ItemType.java
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
@@ -12,7 +12,7 @@ import org.bukkit.block.BlockType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-public interface ItemType extends Keyed, Translatable {
+public interface ItemType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
//<editor-fold desc="ItemTypes" defaultstate="collapsed">
ItemType AIR = getItemType("air");
ItemType STONE = getItemType("stone");

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Create HoverEvent from ItemStack Entity
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index abf95d917eca248ff3f5a5caa008c1c87fa1e029..11e59068b8a8ef1128e3c75283d161c39e2a3a99 100644
index bda53b9db7112e82f581af09262d59da8d7769fa..c6f910af4d6e6f2a5afe23a6a86433ac4ff4d68d 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -204,5 +204,64 @@ public interface ItemFactory {
@@ -203,5 +203,64 @@ public interface ItemFactory {
*/
@NotNull
ItemStack ensureServerConversions(@NotNull ItemStack item);

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index beddcb13a598d799c8ae1cec9c01c900e38b1458..eabbe1cd18316948f70e7b56fb80827fdd3672f0 100644
index f2909100f7abe0a650cc8b2631dddcb26380344a..29d3dccb81f48c6743c01cc875621257752ebea6 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -130,5 +130,12 @@ public interface UnsafeValues {
@@ -139,5 +139,12 @@ public interface UnsafeValues {
byte[] serializeItem(ItemStack item);
ItemStack deserializeItem(byte[] data);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Player elytra boost API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index f42bc869ab78abb4f05d36c9a6563c71dfe1ea4f..e232de8c09397fd7a539f15e326a8344358a7d2a 100644
index c1225aa642eba0e0553131034ee7c55e78b13d10..cfdf406f9b65710438949cc8effe8c3641fe69b7 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2729,6 +2729,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2717,6 +2717,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
@NotNull
<T> T getClientOption(@NotNull com.destroystokyo.paper.ClientOption<T> option);
@ -18,10 +18,10 @@ index f42bc869ab78abb4f05d36c9a6563c71dfe1ea4f..e232de8c09397fd7a539f15e326a8344
+ * If the creation of the entity is cancelled, no boosting is done.
+ * This method does not fire {@link com.destroystokyo.paper.event.player.PlayerElytraBoostEvent}.
+ *
+ * @param firework The {@link Material#FIREWORK_ROCKET} to boost the player with
+ * @param firework The {@link ItemType#FIREWORK_ROCKET} to boost the player with
+ * @return The {@link Firework} boosting the Player or null if the spawning of the entity was cancelled
+ * @throws IllegalArgumentException if {@link #isGliding()} is false
+ * or if the {@code firework} isn't a {@link Material#FIREWORK_ROCKET}
+ * or if the {@code firework} isn't a {@link ItemType#FIREWORK_ROCKET}
+ */
+ @Nullable
+ Firework boostElytra(@NotNull ItemStack firework);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 4e5e29251b713885eee562091ea4f253f027bdbb..6d5423f6b6b1aa013a1f77d368058e4cdf2cbe84 100644
index 690d8584e3f74aae87038b2b8225f28f1b912362..3d52f199c7635e0c89dd6540c7dc0fbf60177d1b 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1248,6 +1248,27 @@ public final class Bukkit {
@@ -1249,6 +1249,27 @@ public final class Bukkit {
return server.getOfflinePlayer(name);
}
@ -37,10 +37,10 @@ index 4e5e29251b713885eee562091ea4f253f027bdbb..6d5423f6b6b1aa013a1f77d368058e4c
* Gets the player by the given UUID, regardless if they are offline or
* online.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 9634d82d603426979cab978f9474cc041e1cb701..f8ef98c9d266e12a3a3f69647cf4d7a9bc633419 100644
index e8a735a3035fe214889738bd0220dae8b51a9535..94cccd613394b587c6df5b4feea354f883f83e50 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1047,6 +1047,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1048,6 +1048,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
public OfflinePlayer getOfflinePlayer(@NotNull String name);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add ignore discounts API
diff --git a/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/src/main/java/org/bukkit/inventory/MerchantRecipe.java
index d33b66facf36587d703c29e9085289ce919ae621..afaa21b9347683fa373a938d9b1aa01c2058192a 100644
index abea2a7ae3a2e70faa96038699bbafb494896617..03366a1d84b7037de7af18b057872c65d7a425bf 100644
--- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java
+++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java
@@ -57,6 +57,7 @@ public class MerchantRecipe implements Recipe {
@@ -56,6 +56,7 @@ public class MerchantRecipe implements Recipe {
private int demand;
private int villagerExperience;
private float priceMultiplier;
@ -16,7 +16,7 @@ index d33b66facf36587d703c29e9085289ce919ae621..afaa21b9347683fa373a938d9b1aa01c
public MerchantRecipe(@NotNull ItemStack result, int maxUses) {
this(result, 0, maxUses, false);
@@ -71,6 +72,15 @@ public class MerchantRecipe implements Recipe {
@@ -70,6 +71,15 @@ public class MerchantRecipe implements Recipe {
}
public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice) {
@ -32,7 +32,7 @@ index d33b66facf36587d703c29e9085289ce919ae621..afaa21b9347683fa373a938d9b1aa01c
this.result = result;
this.uses = uses;
this.maxUses = maxUses;
@@ -283,4 +293,20 @@ public class MerchantRecipe implements Recipe {
@@ -282,4 +292,20 @@ public class MerchantRecipe implements Recipe {
public void setPriceMultiplier(float priceMultiplier) {
this.priceMultiplier = priceMultiplier;
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add Destroy Speed API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 5ae85ddc2cff3145dcba877a7bf55abd818f6881..546c6709383edb0007b9a8a560af0b64f498dadd 100644
index bf50f6f1a6cb4f2493fe29d517289913d767ba26..11fd5db6243413b86e5a3a5b8017df988b16d48b 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -680,5 +680,29 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
@@ -679,5 +679,29 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
@NotNull
@Deprecated(forRemoval = true)
String getTranslationKey();

View file

@ -6,18 +6,20 @@ Subject: [PATCH] Add PlayerItemCooldownEvent
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb06f07c57c
index 0000000000000000000000000000000000000000..74fb75e153f027cd04df160943322341c205129e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java
@@ -0,0 +1,77 @@
@@ -0,0 +1,90 @@
+package io.papermc.paper.event.player;
+
+import com.google.common.base.Preconditions;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemType;
+import org.jetbrains.annotations.NotNull;
+
+/**
@ -26,11 +28,11 @@ index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb0
+public class PlayerItemCooldownEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ @NotNull
+ private final Material type;
+ private final ItemType type;
+ private boolean cancelled;
+ private int cooldown;
+
+ public PlayerItemCooldownEvent(@NotNull Player player, @NotNull Material type, int cooldown) {
+ public PlayerItemCooldownEvent(@NotNull Player player, @NotNull ItemType type, int cooldown) {
+ super(player);
+ this.type = type;
+ this.cooldown = cooldown;
@ -40,10 +42,21 @@ index 0000000000000000000000000000000000000000..58d18f05af13d836ddc62fcd30befcb0
+ * Get the material affected by the cooldown.
+ *
+ * @return material affected by the cooldown
+ * @deprecated use {@link #getItemType()}
+ */
+ @NotNull
+ @Deprecated
+ public Material getType() {
+ return type;
+ return Bukkit.getUnsafe().toMaterial(this.type);
+ }
+
+ /**
+ * Get the item type affected by the cooldown.
+ *
+ * @return item type affected by the cooldown
+ */
+ public @NotNull ItemType getItemType() {
+ return this.type;
+ }
+
+ /**

View file

@ -5,12 +5,12 @@ Subject: [PATCH] Expose LivingEntity hurt direction
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 94f2c3167f4ce7f5f2b4ecc067739c64af0a2508..4054d2c836342f0e4bcbd33adb13f50daea5086a 100644
index 629c19ae29ce9b215364e2fca41b1fbb608c0493..1a6b22c41863315ec577fc42996b3264598219bf 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -348,6 +348,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@@ -345,6 +345,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/
public void setCooldown(@NotNull Material material, int ticks);
public void setCooldown(@NotNull ItemType itemType, int ticks);
+ // Paper start
+ /**
@ -26,7 +26,7 @@ index 94f2c3167f4ce7f5f2b4ecc067739c64af0a2508..4054d2c836342f0e4bcbd33adb13f50d
* Get the sleep ticks of the player. This value may be capped.
*
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 511a48df780364d054858079273fe408aa0bc749..6a4c54ea92478be6e53b62ebe4e73068b9ed4a29 100644
index 4809201b15b82bf9526367295de5030b267cb4fa..bae92046540a7446a78114dc69a2236c1af26121 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -997,5 +997,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource

View file

@ -9,10 +9,10 @@ process to do this in the Bukkit API
Adds API for buildable, replaceable, burnable too.
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 546c6709383edb0007b9a8a560af0b64f498dadd..6c0249863601e8f0fc06828574315a9f0af66e5b 100644
index 11fd5db6243413b86e5a3a5b8017df988b16d48b..30c7dc35bea310358ba92a8488981fff8132c049 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -439,6 +439,42 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
@@ -438,6 +438,42 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
*/
boolean isLiquid();

View file

@ -5,26 +5,35 @@ Subject: [PATCH] Add API to get Material from Boats and Minecarts
diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java
index 88852215d01f3fc4866449f7b826f6603b0ed9d8..f7548098bcdd033d9c530fdc584fc5538c635ca1 100644
index d6e114107c3990d91b179cd2cc3a8c04d4df0a2a..7410d0ec4f00ae275544ea67a0908df0e9a36ceb 100644
--- a/src/main/java/org/bukkit/entity/Boat.java
+++ b/src/main/java/org/bukkit/entity/Boat.java
@@ -175,4 +175,14 @@ public interface Boat extends Vehicle {
@@ -175,4 +175,23 @@ public interface Boat extends Vehicle {
ON_LAND,
IN_AIR;
}
+
+ // Paper start
+ /**
+ * Gets the {@link Material} that represents this Boat type.
+ * Gets the {@link org.bukkit.Material} that represents this Boat type.
+ *
+ * @return the boat material.
+ * @deprecated use {@link #getBoatItem()}
+ */
+ @NotNull
+ public Material getBoatMaterial();
+ @Deprecated
+ public org.bukkit.Material getBoatMaterial();
+
+ /**
+ * Gets the {@link ItemType} that represents this Boat type.
+ *
+ * @return the boat item type
+ */
+ @NotNull ItemType getBoatItem();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java
index 7f9c4d4b430a3f0276461346ff2621bacf864075..bc1e62759c995a1463ebcd10d73c7d502c9acc45 100644
index 177e12108f6108e4858910cef95f72110762b041..320058c7fc7b965ccf134b0686bfaacf8ed8111d 100644
--- a/src/main/java/org/bukkit/entity/Minecart.java
+++ b/src/main/java/org/bukkit/entity/Minecart.java
@@ -1,5 +1,6 @@

View file

@ -5,16 +5,16 @@ Subject: [PATCH] Add API to get exact interaction point in PlayerInteractEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
index 1208e1f8c2163d83c5b12bbb9b7ac044c72380e0..a01f86e6aba8b66ecc713da0787cd861e2930a2a 100644
index f5bb9eb36d810d2ad988b71951b4029c70704287..16a0d738706b7aac1490a875a7052ce5490c6655 100644
--- a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
@@ -1,5 +1,6 @@
package org.bukkit.event.player;
+import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
@@ -34,22 +35,30 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
private Result useClickedBlock;
private Result useItemInHand;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index e232de8c09397fd7a539f15e326a8344358a7d2a..4e8f58d57d0273ef6a9ed75cdf195149dea44df7 100644
index 873a7bafe2631d012d00eb813889b31ec02d0e30..48f55ea0db1bd9ac24e44b1f1fa83ea58609fd48 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2742,6 +2742,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2730,6 +2730,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
@Nullable
Firework boostElytra(@NotNull ItemStack firework);

View file

@ -505,13 +505,13 @@ index 0000000000000000000000000000000000000000..1e7b53f9bc13dcd5a0a4a40004591e4f
+ }
+}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 09e3c2872462da546b891cbc396aaffb77f6aadf..c21aefb63678d78a441436761373e9710c1e543a 100644
index e84b3e488003bff973b77cec08f7429fce6364fa..413156927cfea8e73f9f3475e1a0da99169b8d4d 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -228,6 +228,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
return GameEvent.getByKey(key);
}
};
@@ -259,6 +259,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*/
Registry<PotionEffectType> POTION_EFFECT_TYPE = Objects.requireNonNull(Bukkit.getRegistry(PotionEffectType.class), "No registry present for Potion Effect Type. This is a bug.");
+ // Paper start
+ /**
+ * Configured structures.
@ -519,8 +519,9 @@ index 09e3c2872462da546b891cbc396aaffb77f6aadf..c21aefb63678d78a441436761373e971
+ * @deprecated use {@link #STRUCTURE}
+ */
+ @Deprecated(forRemoval = true)
+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Bukkit.getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class);
+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Objects.requireNonNull(Bukkit.getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for Configured Structure. This is a bug.");
+ // Paper end
+
/**
* Get the object by its key.
*

View file

@ -5,18 +5,18 @@ Subject: [PATCH] Added missing vanilla tags
diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java
index 82d34e9aae42dfafd900dc0e610bf1dc82a5a6f3..3e9f1ee242b8087759c98b54ebb3cc3b8f5fcbd5 100644
index bbf7dd8ca90ba1c3626e87ca221201568163101f..974dcacb09ec05c98a4a6af28f86694b97b9c925 100644
--- a/src/main/java/org/bukkit/Tag.java
+++ b/src/main/java/org/bukkit/Tag.java
@@ -759,6 +759,12 @@ public interface Tag<T extends Keyed> extends Keyed {
@@ -761,6 +761,12 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla item tag representing all chest boat items.
*/
Tag<Material> ITEMS_CHEST_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chest_boats"), Material.class);
Tag<ItemType> ITEMS_CHEST_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chest_boats"), ItemType.class);
+ // Paper start
+ /**
+ * Vanilla item tag representing all non-flammable wood items.
+ */
+ Tag<Material> ITEMS_NON_FLAMMABLE_WOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("non_flammable_wood"), Material.class);
+ Tag<ItemType> ITEMS_NON_FLAMMABLE_WOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("non_flammable_wood"), ItemType.class);
+ // Paper end
/**
* Vanilla item tag representing all fish items.

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add missing effects
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
index 879d637691683ca862045402f74b751a892bf3ff..3ae64e7e42338a2a550917ccd01d755a1ba0bf03 100644
index 7dc00d1ab2e845ef57c650faea77363023964712..1c7dd6f7e2eff67a025461ef0119037ddf0e0073 100644
--- a/src/main/java/org/bukkit/Effect.java
+++ b/src/main/java/org/bukkit/Effect.java
@@ -337,7 +337,100 @@ public enum Effect {
@@ -339,7 +339,100 @@ public enum Effect {
* block.
*/
OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL),
@ -109,7 +109,7 @@ index 879d637691683ca862045402f74b751a892bf3ff..3ae64e7e42338a2a550917ccd01d755a
private final int id;
private final Type type;
@@ -397,10 +490,22 @@ public enum Effect {
@@ -399,10 +492,22 @@ public enum Effect {
static {
for (Effect effect : values()) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Cache the result of Material#isBlock
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 6a89eab53f21bc4420e616cc299864fb564e1045..37898f36f859eda945471fa9b00fcabbc3d211df 100644
index be4f6fbf013a4259b04f805b4265750bb7fcd0c3..ffcb8e24a553f0cd81ec8c48511f28d284dbbd42 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4394,6 +4394,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -4397,6 +4397,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
public final Class<?> data;
private final boolean legacy;
private final NamespacedKey key;
@ -16,7 +16,7 @@ index 6a89eab53f21bc4420e616cc299864fb564e1045..37898f36f859eda945471fa9b00fcabb
private Material(final int id) {
this(id, 64);
@@ -4592,6 +4593,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -4596,6 +4597,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
* @return true if this material is a block
*/
public boolean isBlock() {
@ -28,7 +28,7 @@ index 6a89eab53f21bc4420e616cc299864fb564e1045..37898f36f859eda945471fa9b00fcabb
switch (this) {
//<editor-fold defaultstate="collapsed" desc="isBlock">
case ACACIA_BUTTON:
@@ -5778,6 +5784,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -5782,6 +5788,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
static {
for (Material material : values()) {
BY_NAME.put(material.name(), material);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add Block#isValidTool
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 6c0249863601e8f0fc06828574315a9f0af66e5b..93b9b57c95a0d24e885a205cd9d9e05a5631806a 100644
index 30c7dc35bea310358ba92a8488981fff8132c049..6f6d7816f4e928e849e6e4f7265c977437ccf1bf 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -230,6 +230,15 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
@@ -229,6 +229,15 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
public static int getBlockKeyZ(long packed) {
return (int) ((packed << 10) >> 37);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expand world key API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 6d5423f6b6b1aa013a1f77d368058e4cdf2cbe84..be32ddb8ad5d6290b76cb520d159d456ed16f1b1 100644
index dd7dd73b5c6da8a09c0cf227837919c80601a005..2efebdb38cbe768a186321a14f3a67f38682ca17 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -830,6 +830,18 @@ public final class Bukkit {
@@ -831,6 +831,18 @@ public final class Bukkit {
public static World getWorld(@NotNull UUID uid) {
return server.getWorld(uid);
}
@ -28,10 +28,10 @@ index 6d5423f6b6b1aa013a1f77d368058e4cdf2cbe84..be32ddb8ad5d6290b76cb520d159d456
/**
* Create a new virtual {@link WorldBorder}.
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
index 501dd5a26c27294420821b3d75f8938596afb1a8..71ef9b479888aa83455757560b60745572c7196d 100644
index d039095a2c2f2c61b5596aa33e98e7cc95818678..fc7e604a7195259e8a91b461d25b65155adfcff0 100644
--- a/src/main/java/org/bukkit/RegionAccessor.java
+++ b/src/main/java/org/bukkit/RegionAccessor.java
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable;
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
* A RegionAccessor gives access to getting, modifying and spawning {@link Biome}, {@link BlockState} and {@link Entity},
* as well as generating some basic structures.
*/
@ -40,7 +40,7 @@ index 501dd5a26c27294420821b3d75f8938596afb1a8..71ef9b479888aa83455757560b607455
/**
* Gets the {@link Biome} at the given {@link Location}.
@@ -428,5 +428,14 @@ public interface RegionAccessor {
@@ -433,5 +433,14 @@ public interface RegionAccessor {
*/
@NotNull
io.papermc.paper.world.MoonPhase getMoonPhase();
@ -56,10 +56,10 @@ index 501dd5a26c27294420821b3d75f8938596afb1a8..71ef9b479888aa83455757560b607455
// Paper end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f8ef98c9d266e12a3a3f69647cf4d7a9bc633419..d1d035ee86264b38b6bb50135d031946daf25a00 100644
index f2c66b23e9394cae680d29407226888ca3241b69..c59269a67b803ccc56acf376f14e9d8cb484cef3 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -694,6 +694,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -695,6 +695,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
public World getWorld(@NotNull UUID uid);
@ -78,10 +78,10 @@ index f8ef98c9d266e12a3a3f69647cf4d7a9bc633419..d1d035ee86264b38b6bb50135d031946
* Create a new virtual {@link WorldBorder}.
* <p>
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index eabbe1cd18316948f70e7b56fb80827fdd3672f0..a00d93eee9710bb0fdf0fb791ef1a9262f89ef60 100644
index 97aa67b52903e5a13860048ba2937822cc771d21..c86bf2004e186e20d1cbc97c6d8efb04607a8fc7 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -137,5 +137,10 @@ public interface UnsafeValues {
@@ -146,5 +146,10 @@ public interface UnsafeValues {
* Use this when sending custom packets, so that there are no collisions on the client or server.
*/
public int nextEntityId();

View file

@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..74ef8395cc040ce488c2acaa416db202
+ }
+}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 37898f36f859eda945471fa9b00fcabbc3d211df..85d19b0c659c75472aa91d18fdf17f25bd6a2e04 100644
index ffcb8e24a553f0cd81ec8c48511f28d284dbbd42..d6c3c6b320e4996dfbc185d594d94efbedf453c9 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4460,6 +4460,17 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -4464,6 +4464,20 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
return Bukkit.getUnsafe().getBlockTranslationKey(this);
}
}
@ -52,33 +52,27 @@ index 37898f36f859eda945471fa9b00fcabbc3d211df..85d19b0c659c75472aa91d18fdf17f25
+ * Use {@link #isItem()} before this.
+ *
+ * @return the item rarity
+ * @deprecated use {@link ItemType#getItemRarity()}
+ */
+ @Deprecated
+ @NotNull
+ public io.papermc.paper.inventory.ItemRarity getItemRarity() {
+ return Bukkit.getUnsafe().getItemRarity(this);
+ Preconditions.checkArgument(this.isItem(), this + " must be an item");
+ return this.asItemType().getItemRarity();
+ }
// Paper end
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index a00d93eee9710bb0fdf0fb791ef1a9262f89ef60..f79784e1823f646181a434a6dbce3bac0eaf25c9 100644
index 413085e6793a17762685198a5416cc3dfcc88995..4fbb9153c34ef95170e62e4e519ce4ea2e685558 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -142,5 +142,22 @@ public interface UnsafeValues {
@@ -151,5 +151,13 @@ public interface UnsafeValues {
* Just don't use it.
*/
@org.jetbrains.annotations.NotNull String getMainLevelName();
+
+ /**
+ * Gets the item rarity of a material. The material <b>MUST</b> be an item.
+ * Use {@link Material#isItem()} before this.
+ *
+ * @param material the material to get the rarity of
+ * @return the item rarity
+ */
+ public io.papermc.paper.inventory.ItemRarity getItemRarity(Material material);
+
+ /**
+ * Gets the item rarity of the itemstack. The rarity can change based on enchantements.
+ *
+ * @param itemStack the itemstack to get the rarity of
@ -88,10 +82,10 @@ index a00d93eee9710bb0fdf0fb791ef1a9262f89ef60..f79784e1823f646181a434a6dbce3bac
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index e4ad3a550050c4bf9cc7a2a1082bfdf668050efe..4f867ba2bc9b1a7c277e4a5f0ea8b452315f3272 100644
index 89fe32de713df3a5f2a25d72cbfe316e5b6c3f1b..d4bc360cf7f0b0fbed07dc10b5778605fde7c219 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -877,5 +877,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -926,5 +926,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public @NotNull String translationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
@ -107,3 +101,22 @@ index e4ad3a550050c4bf9cc7a2a1082bfdf668050efe..4f867ba2bc9b1a7c277e4a5f0ea8b452
+ }
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
index 834c6b0ba732a8f5c2bdb3163a74efb3aa687ba9..27a1d255b8fcbd6487e4d4eb1abf784b43eaf90e 100644
--- a/src/main/java/org/bukkit/inventory/ItemType.java
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
@@ -1371,4 +1371,14 @@ public interface ItemType extends Keyed, Translatable, net.kyori.adventure.trans
*/
@Nullable
CreativeCategory getCreativeCategory();
+
+ // Paper start - Item Rarity API
+ /**
+ * Returns the item rarity for the item.
+ *
+ * @return the item rarity
+ */
+ @NotNull
+ io.papermc.paper.inventory.ItemRarity getItemRarity();
+ // Paper end
}

Some files were not shown because too many files have changed in this diff Show more