Add getWorld method that uses adventure Key (#11199)

Dieser Commit ist enthalten in:
kokiriglade 2024-08-19 10:41:55 +01:00 committet von GitHub
Ursprung 8fd3a67138
Commit dae906ba45
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
11 geänderte Dateien mit 75 neuen und 52 gelöschten Zeilen

Datei anzeigen

@ -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 fbe14c327ee9c1ac07893853ca7c699e81225281..a2ced20efd2c6be2fe63d80f444c8cb608c37eef 100644
index fbe14c327ee9c1ac07893853ca7c699e81225281..b558fa73dbcf3747690933e6aadf7061a0de2630 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -865,6 +865,18 @@ public final class Bukkit {
@@ -865,6 +865,29 @@ public final class Bukkit {
public static World getWorld(@NotNull UUID uid) {
return server.getWorld(uid);
}
@ -23,6 +23,17 @@ index fbe14c327ee9c1ac07893853ca7c699e81225281..a2ced20efd2c6be2fe63d80f444c8cb6
+ public static World getWorld(@NotNull NamespacedKey worldKey) {
+ return server.getWorld(worldKey);
+ }
+
+ /**
+ * Gets the world from the given Key
+ *
+ * @param worldKey the Key of the world to retrieve
+ * @return a world with the given Key, or null if none exists
+ */
+ @Nullable
+ public static World getWorld(@NotNull net.kyori.adventure.key.Key worldKey) {
+ return server.getWorld(worldKey);
+ }
+ // Paper end
/**
@ -56,10 +67,10 @@ index 27eff0826d5b5b48697fefd9571886e7bbce74b1..d8b1fa79dc24138dc71e32c14bda71c1
// Paper end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..8b52e9a41ea9ba38117d42224811ff28663ef980 100644
index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..42930006b6425b5d82233e4ffe7025ce5397b277 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -726,6 +726,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -726,6 +726,28 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
public World getWorld(@NotNull UUID uid);
@ -71,7 +82,18 @@ index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..8b52e9a41ea9ba38117d42224811ff28
+ * @return a world with the given NamespacedKey, or null if none exists
+ */
+ @Nullable
+ public World getWorld(@NotNull NamespacedKey worldKey);
+ default World getWorld(@NotNull NamespacedKey worldKey) {
+ return getWorld((net.kyori.adventure.key.Key) worldKey);
+ }
+
+ /**
+ * Gets the world from the given Key
+ *
+ * @param worldKey the Key of the world to retrieve
+ * @return a world with the given Key, or null if none exists
+ */
+ @Nullable
+ World getWorld(@NotNull net.kyori.adventure.key.Key worldKey);
+ // Paper end
+
/**

Datei anzeigen

@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f7
+
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a2ced20efd2c6be2fe63d80f444c8cb608c37eef..a6e87d06e439bfa85512891da300e2de60b0af95 100644
index b558fa73dbcf3747690933e6aadf7061a0de2630..8a22c242a93b0e16e0bca583d0918bab695248b1 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -328,9 +328,11 @@ public final class Bukkit {
@ -85,7 +85,7 @@ index a2ced20efd2c6be2fe63d80f444c8cb608c37eef..a6e87d06e439bfa85512891da300e2de
public static DataPackManager getDataPackManager() {
return server.getDataPackManager();
}
@@ -2606,6 +2608,14 @@ public final class Bukkit {
@@ -2617,6 +2619,14 @@ public final class Bukkit {
public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return server.getMobGoals();
}
@ -101,7 +101,7 @@ index a2ced20efd2c6be2fe63d80f444c8cb608c37eef..a6e87d06e439bfa85512891da300e2de
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 8b52e9a41ea9ba38117d42224811ff28663ef980..c3f32db8ccd31e3ee8a544dc165540c0fa8bcc35 100644
index 42930006b6425b5d82233e4ffe7025ce5397b277..67b5cb7635c4251c259b1fb1ef50f99a0b2647e5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -267,9 +267,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -116,7 +116,7 @@ index 8b52e9a41ea9ba38117d42224811ff28663ef980..c3f32db8ccd31e3ee8a544dc165540c0
public DataPackManager getDataPackManager();
/**
@@ -2273,5 +2275,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2284,5 +2286,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] API for creating command sender which forwards feedback
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a6e87d06e439bfa85512891da300e2de60b0af95..65e02f66fd275045bd1889b460cc6c0613e19755 100644
index 8a22c242a93b0e16e0bca583d0918bab695248b1..aa1795b9640a5e39cc5063dd3c389f6d5815ed36 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1584,6 +1584,20 @@ public final class Bukkit {
@@ -1595,6 +1595,20 @@ public final class Bukkit {
return server.getConsoleSender();
}
@ -30,10 +30,10 @@ index a6e87d06e439bfa85512891da300e2de60b0af95..65e02f66fd275045bd1889b460cc6c06
* Gets the folder that contains all of the various {@link World}s.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c3f32db8ccd31e3ee8a544dc165540c0fa8bcc35..04b7225486ee61ee66bc8423e46e620c6da9e41d 100644
index 67b5cb7635c4251c259b1fb1ef50f99a0b2647e5..65060c06c1e5521656bd88547b8d0df5975c1d29 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1338,6 +1338,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1349,6 +1349,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
public ConsoleCommandSender getConsoleSender();

Datei anzeigen

@ -155,10 +155,10 @@ index 0000000000000000000000000000000000000000..3ede1e8f7bf0436fdc5bf395c0f9eaf1
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 65e02f66fd275045bd1889b460cc6c0613e19755..702e622a2ef2c3dcb0e582e38b3b10f9c939ed97 100644
index aa1795b9640a5e39cc5063dd3c389f6d5815ed36..30cb0f2c4d53a7ad473812810c4f50173b7d7391 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2630,6 +2630,15 @@ public final class Bukkit {
@@ -2641,6 +2641,15 @@ public final class Bukkit {
public static io.papermc.paper.datapack.DatapackManager getDatapackManager() {
return server.getDatapackManager();
}
@ -175,10 +175,10 @@ index 65e02f66fd275045bd1889b460cc6c0613e19755..702e622a2ef2c3dcb0e582e38b3b10f9
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 04b7225486ee61ee66bc8423e46e620c6da9e41d..28e883ffb5c4db22613035899be4a627c230fbf4 100644
index 65060c06c1e5521656bd88547b8d0df5975c1d29..7c33c9489e0f3c4429e9bc30d87a3f4c29ca010f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2293,5 +2293,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2304,5 +2304,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
io.papermc.paper.datapack.DatapackManager getDatapackManager();

Datei anzeigen

@ -23,10 +23,10 @@ index 0000000000000000000000000000000000000000..f309961e0e96b6baacc4fe6d80dabd6c
+}
diff --git a/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0974c0572
index 0000000000000000000000000000000000000000..5e2c8ad26dea2c8a84ae10f7da8cb836e78d7b68
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java
@@ -0,0 +1,186 @@
@@ -0,0 +1,187 @@
+package io.papermc.paper.event.block;
+
+import com.google.common.base.Preconditions;
@ -34,6 +34,7 @@ index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0
+import net.kyori.adventure.sound.Sound;
+import net.kyori.adventure.text.Component;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockState;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
@ -53,7 +54,6 @@ index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final LockableTileState state;
+ private final Player player;
+ private Component lockedMessage;
+ private Sound lockedSound;
@ -61,9 +61,8 @@ index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0
+ private Result result = Result.DEFAULT;
+
+ @ApiStatus.Internal
+ public BlockLockCheckEvent(final @NotNull Block block, final @NotNull LockableTileState state, final @NotNull Player player, final @NotNull Component lockedMessage, final @NotNull Sound lockedSound) {
+ public BlockLockCheckEvent(final @NotNull Block block, final @NotNull Player player, final @NotNull Component lockedMessage, final @NotNull Sound lockedSound) {
+ super(block);
+ this.state = state;
+ this.player = player;
+ this.lockedMessage = lockedMessage;
+ this.lockedSound = lockedSound;
@ -76,7 +75,9 @@ index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0
+ * @return the snapshot block state.
+ */
+ public @NotNull LockableTileState getBlockState() {
+ return this.state;
+ final BlockState blockState = this.getBlock().getState();
+ Preconditions.checkState(blockState instanceof LockableTileState, "Block state of lock-checked block is no longer a lockable tile state!");
+ return (LockableTileState) blockState;
+ }
+
+ /**

Datei anzeigen

@ -499,10 +499,10 @@ index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 3a8be5316229f372b471549a00eae958543ac91d..51eaeb14c87e317c37fb6d4082d82542b4b925ee 100644
index 556e8c6cf90af9c90ded18be013167fa440d6505..9265ee60edfb3df797e425e854c7d3c9c034a85c 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2661,6 +2661,141 @@ public final class Bukkit {
@@ -2672,6 +2672,141 @@ public final class Bukkit {
}
// Paper end
@ -645,10 +645,10 @@ index 3a8be5316229f372b471549a00eae958543ac91d..51eaeb14c87e317c37fb6d4082d82542
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 547ba309beb6a4d1fdfadb234d671c1475abaae5..9354a0bb002ddfaf8df90a963ae5be577efb8aee 100644
index a859d7bc870e5ef16793c2da453c84685b78ee47..968a5e18a023c92158a753f6d8fce4b2d0f0de48 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2322,4 +2322,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2333,4 +2333,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
// Paper end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] API for updating recipes on clients
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 51eaeb14c87e317c37fb6d4082d82542b4b925ee..c9046e30ae9ffe90a1835316e87988ccca25fb4d 100644
index 9265ee60edfb3df797e425e854c7d3c9c034a85c..f2753ef7d53ff3ff3531eaea89e816d7d8ce8b15 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -993,6 +993,26 @@ public final class Bukkit {
@@ -1004,6 +1004,26 @@ public final class Bukkit {
server.reloadData();
}
@ -35,7 +35,7 @@ index 51eaeb14c87e317c37fb6d4082d82542b4b925ee..c9046e30ae9ffe90a1835316e87988cc
/**
* Returns the primary logger associated with this server instance.
*
@@ -1053,6 +1073,20 @@ public final class Bukkit {
@@ -1064,6 +1084,20 @@ public final class Bukkit {
return server.addRecipe(recipe);
}
@ -56,7 +56,7 @@ index 51eaeb14c87e317c37fb6d4082d82542b4b925ee..c9046e30ae9ffe90a1835316e87988cc
/**
* Get a list of all recipes for a given item. The stack size is ignored
* in comparisons. If the durability is -1, it will match any data value.
@@ -1244,6 +1278,24 @@ public final class Bukkit {
@@ -1255,6 +1289,24 @@ public final class Bukkit {
return server.removeRecipe(key);
}
@ -82,10 +82,10 @@ index 51eaeb14c87e317c37fb6d4082d82542b4b925ee..c9046e30ae9ffe90a1835316e87988cc
* Gets a list of command aliases defined in the server properties.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 9354a0bb002ddfaf8df90a963ae5be577efb8aee..e07fa603227dd936146d1bb810559df527aee0c1 100644
index 968a5e18a023c92158a753f6d8fce4b2d0f0de48..b93359e86db14e3a680bcdd8d935e2692c8b64e0 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -842,6 +842,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -853,6 +853,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
public void reloadData();
@ -108,7 +108,7 @@ index 9354a0bb002ddfaf8df90a963ae5be577efb8aee..e07fa603227dd936146d1bb810559df5
/**
* Returns the primary logger associated with this server instance.
*
@@ -883,15 +899,34 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -894,15 +910,34 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
public boolean dispatchCommand(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException;
/**
@ -144,7 +144,7 @@ index 9354a0bb002ddfaf8df90a963ae5be577efb8aee..e07fa603227dd936146d1bb810559df5
/**
* Get a list of all recipes for a given item. The stack size is ignored
* in comparisons. If the durability is -1, it will match any data value.
@@ -1060,6 +1095,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1071,6 +1106,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
public boolean removeRecipe(@NotNull NamespacedKey key);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index c9046e30ae9ffe90a1835316e87988ccca25fb4d..fffd4b72672d2e3f82c6a018dfc7e95b6eb3fc2d 100644
index f2753ef7d53ff3ff3531eaea89e816d7d8ce8b15..7e70b9b34b170b1c00dd920fabc0e14ed4a14955 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -938,9 +938,6 @@ public final class Bukkit {
@@ -949,9 +949,6 @@ public final class Bukkit {
/**
* Create a new explorer map targeting the closest nearby structure of a
* given {@link StructureType}.
@ -18,7 +18,7 @@ index c9046e30ae9ffe90a1835316e87988ccca25fb4d..fffd4b72672d2e3f82c6a018dfc7e95b
*
* @param world the world the map will belong to
* @param location the origin location to find the nearest structure
@@ -949,7 +946,9 @@ public final class Bukkit {
@@ -960,7 +957,9 @@ public final class Bukkit {
*
* @see World#locateNearestStructure(org.bukkit.Location,
* org.bukkit.StructureType, int, boolean)
@ -28,7 +28,7 @@ index c9046e30ae9ffe90a1835316e87988ccca25fb4d..fffd4b72672d2e3f82c6a018dfc7e95b
@NotNull
public static ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType) {
return server.createExplorerMap(world, location, structureType);
@@ -972,11 +971,54 @@ public final class Bukkit {
@@ -983,11 +982,54 @@ public final class Bukkit {
*
* @see World#locateNearestStructure(org.bukkit.Location,
* org.bukkit.StructureType, int, boolean)
@ -84,10 +84,10 @@ index c9046e30ae9ffe90a1835316e87988ccca25fb4d..fffd4b72672d2e3f82c6a018dfc7e95b
/**
* Reloads the server, refreshing settings and plugin information.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e07fa603227dd936146d1bb810559df527aee0c1..6d36734580eb411b00757a1cf63a4e05acbae6b2 100644
index b93359e86db14e3a680bcdd8d935e2692c8b64e0..f2be9647e015761ef7f56331be932a39cb6a5e8b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -806,16 +806,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -817,16 +817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*
* @see World#locateNearestStructure(org.bukkit.Location,
* org.bukkit.StructureType, int, boolean)
@ -106,7 +106,7 @@ index e07fa603227dd936146d1bb810559df527aee0c1..6d36734580eb411b00757a1cf63a4e05
*
* @param world the world the map will belong to
* @param location the origin location to find the nearest structure
@@ -827,9 +826,50 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -838,9 +837,50 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*
* @see World#locateNearestStructure(org.bukkit.Location,
* org.bukkit.StructureType, int, boolean)

Datei anzeigen

@ -68,10 +68,10 @@ index a77c0411a68a9bad33ddfb335b7a996a843e478c..739d9d3ec789e58c10c8d818a9ca59ce
/**
* Banned player names
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index fffd4b72672d2e3f82c6a018dfc7e95b6eb3fc2d..4705c1d91e39fcc3c608b1f1a38a30d063ccf06e 100644
index 7e70b9b34b170b1c00dd920fabc0e14ed4a14955..419c056faf0d49d9b0435feb01252e87e227b9a9 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1652,11 +1652,27 @@ public final class Bukkit {
@@ -1663,11 +1663,27 @@ public final class Bukkit {
* @param <T> The ban target
*
* @return a ban list of the specified type
@ -100,10 +100,10 @@ index fffd4b72672d2e3f82c6a018dfc7e95b6eb3fc2d..4705c1d91e39fcc3c608b1f1a38a30d0
/**
* Gets a set containing all player operators.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 6d36734580eb411b00757a1cf63a4e05acbae6b2..c043d239c449bf4bb13a24467f2f6c67b4d28d2d 100644
index f2be9647e015761ef7f56331be932a39cb6a5e8b..5aa64ea39ebd92e5067c53cea49a8685c0b9eee4 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1414,10 +1414,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1425,10 +1425,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param <T> The ban target
*
* @return a ban list of the specified type

Datei anzeigen

@ -20,7 +20,7 @@ index 1963e826548c5a8859c50f57654784c3aef50e44..04a39cb6c13c26e2cb1d73a9da98df5d
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c6566a5af 100644
index f79af6910c4c83f1c56bc73434846f3e5270509f..3b1e073f8873e23eee187a2d60529c044e3d2f55 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1181,9 +1181,15 @@ public final class CraftServer implements Server {
@ -56,8 +56,8 @@ index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c
+ // Paper start
+ @Override
+ public World getWorld(NamespacedKey worldKey) {
+ ServerLevel worldServer = console.getLevel(ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, CraftNamespacedKey.toMinecraft(worldKey)));
+ public World getWorld(net.kyori.adventure.key.Key worldKey) {
+ ServerLevel worldServer = console.getLevel(ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, io.papermc.paper.adventure.PaperAdventure.asVanilla(worldKey)));
+ if (worldServer == null) return null;
+ return worldServer.getWorld();
+ }
@ -67,7 +67,7 @@ index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c
// Check if a World already exists with the UID.
if (this.getWorld(world.getUID()) != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 5fe9b94c342a91d6fb3bc582ac7e84cb25b90a9e..e44bcf61c09245a63d50dd1be3c5b1fca7225ff9 100644
index 481aeb922952578ea68ce2425c84e1a93eff0cf9..b075d4b21b53a3f39094444e4024556b23e399f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -516,6 +516,11 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add BlockLockCheckEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
index bf9ae460bdfb247456b895f026f6a7a2e162c5f5..15fd1fe1b55b6421d2c09e8385c9f69fa0152e56 100644
index bf9ae460bdfb247456b895f026f6a7a2e162c5f5..2ddf349fde5b310ec3f74baee1f3d33e09d5286c 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
@@ -73,17 +73,44 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
@ -26,7 +26,7 @@ index bf9ae460bdfb247456b895f026f6a7a2e162c5f5..15fd1fe1b55b6421d2c09e8385c9f69f
+ final org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos());
+ net.kyori.adventure.text.Component lockedMessage = net.kyori.adventure.text.Component.translatable("container.isLocked", io.papermc.paper.adventure.PaperAdventure.asAdventure(containerName));
+ net.kyori.adventure.sound.Sound lockedSound = net.kyori.adventure.sound.Sound.sound(org.bukkit.Sound.BLOCK_CHEST_LOCKED, net.kyori.adventure.sound.Sound.Source.BLOCK, 1.0F, 1.0F);
+ final io.papermc.paper.event.block.BlockLockCheckEvent event = new io.papermc.paper.event.block.BlockLockCheckEvent(block, (io.papermc.paper.block.LockableTileState) block.getState(), serverPlayer.getBukkitEntity(), lockedMessage, lockedSound);
+ final io.papermc.paper.event.block.BlockLockCheckEvent event = new io.papermc.paper.event.block.BlockLockCheckEvent(block, serverPlayer.getBukkitEntity(), lockedMessage, lockedSound);
+ event.callEvent();
+ if (event.getResult() == org.bukkit.event.Event.Result.ALLOW) {
+ return true;