3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Dieser Commit ist enthalten in:
chmodsayshello 2023-05-07 17:18:45 +02:00
Ursprung d828e37224
Commit 8a0fee1d63

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] add PlayerCreateMapEvent
diff --git a/src/main/java/net/minecraft/world/item/EmptyMapItem.java b/src/main/java/net/minecraft/world/item/EmptyMapItem.java diff --git a/src/main/java/net/minecraft/world/item/EmptyMapItem.java b/src/main/java/net/minecraft/world/item/EmptyMapItem.java
index e92bb09dd3218d5a13e6251bddd0812acadda2be..3e4a20de2140615afd7ff271a072b11caef9b214 100644 index e92bb09dd3218d5a13e6251bddd0812acadda2be..7da8084db2ad53d2d467e3b9868a523f7ce3970a 100644
--- a/src/main/java/net/minecraft/world/item/EmptyMapItem.java --- a/src/main/java/net/minecraft/world/item/EmptyMapItem.java
+++ b/src/main/java/net/minecraft/world/item/EmptyMapItem.java +++ b/src/main/java/net/minecraft/world/item/EmptyMapItem.java
@@ -18,13 +18,18 @@ public class EmptyMapItem extends ComplexItem { @@ -18,13 +18,18 @@ public class EmptyMapItem extends ComplexItem {
@ -22,9 +22,9 @@ index e92bb09dd3218d5a13e6251bddd0812acadda2be..3e4a20de2140615afd7ff271a072b11c
+ // Paper start + // Paper start
+ io.papermc.paper.event.player.PlayerCreateMapEvent playerCreateMapEvent = new io.papermc.paper.event.player.PlayerCreateMapEvent((org.bukkit.entity.Player) user.getBukkitEntity(), itemStack2.asBukkitCopy()); + io.papermc.paper.event.player.PlayerCreateMapEvent playerCreateMapEvent = new io.papermc.paper.event.player.PlayerCreateMapEvent((org.bukkit.entity.Player) user.getBukkitEntity(), itemStack2.asBukkitCopy());
+ world.getCraftServer().getPluginManager().callEvent(playerCreateMapEvent); + world.getCraftServer().getPluginManager().callEvent(playerCreateMapEvent);
+ if(playerCreateMapEvent.isCancelled()){ + if (playerCreateMapEvent.isCancelled()) {
+ return InteractionResultHolder.consume(itemStack); + return InteractionResultHolder.consume(itemStack);
+ }else if (!user.getAbilities().instabuild) { // Paper - moved down a couple of lines so an item gets removed only if the event wasn't cancelled! + } else if (!user.getAbilities().instabuild) { // Paper - moved down a couple of lines so an item gets removed only if the event wasn't cancelled!
+ itemStack.shrink(1); + itemStack.shrink(1);
+ } + }
+ // Paper end + // Paper end