Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
update 'PlayerCreateMapEvent' patch
Dieser Commit ist enthalten in:
Ursprung
fd3b3e3f50
Commit
d828e37224
@ -6,7 +6,7 @@ Subject: [PATCH] add PlayerCreateMapEvent
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerCreateMapEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerCreateMapEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ea6a9b7d98161bfaf41c397d30b23af1ba2dffa0
|
||||
index 0000000000000000000000000000000000000000..7a9a77f4c7f02369b29b1d996abd168d30d6db5f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerCreateMapEvent.java
|
||||
@@ -0,0 +1,53 @@
|
||||
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..ea6a9b7d98161bfaf41c397d30b23af1
|
||||
+public class PlayerCreateMapEvent extends PlayerEvent implements Cancellable {
|
||||
+ private boolean cancelled = false;
|
||||
+ private final ItemStack mapStack;
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+ public PlayerCreateMapEvent(Player player, ItemStack mapStack){
|
||||
+ super(player);
|
||||
+ this.mapStack = mapStack;
|
||||
@ -56,10 +56,10 @@ index 0000000000000000000000000000000000000000..ea6a9b7d98161bfaf41c397d30b23af1
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList(){
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -5,18 +5,10 @@ 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
|
||||
index e92bb09dd3218d5a13e6251bddd0812acadda2be..8b07c86f22299e9c89e70603abf77ef78209ac31 100644
|
||||
index e92bb09dd3218d5a13e6251bddd0812acadda2be..3e4a20de2140615afd7ff271a072b11caef9b214 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/EmptyMapItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/EmptyMapItem.java
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
+import io.papermc.paper.event.player.PlayerCreateMapEvent; // Paper
|
||||
|
||||
public class EmptyMapItem extends ComplexItem {
|
||||
public EmptyMapItem(Item.Properties settings) {
|
||||
@@ -18,13 +19,18 @@ public class EmptyMapItem extends ComplexItem {
|
||||
@@ -18,13 +18,18 @@ public class EmptyMapItem extends ComplexItem {
|
||||
if (world.isClientSide) {
|
||||
return InteractionResultHolder.success(itemStack);
|
||||
} else {
|
||||
@ -28,7 +20,7 @@ index e92bb09dd3218d5a13e6251bddd0812acadda2be..8b07c86f22299e9c89e70603abf77ef7
|
||||
user.level.playSound((Player)null, user, SoundEvents.UI_CARTOGRAPHY_TABLE_TAKE_RESULT, user.getSoundSource(), 1.0F, 1.0F);
|
||||
ItemStack itemStack2 = MapItem.create(world, user.getBlockX(), user.getBlockZ(), (byte)0, true, false);
|
||||
+ // Paper start
|
||||
+ PlayerCreateMapEvent playerCreateMapEvent = new 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);
|
||||
+ if(playerCreateMapEvent.isCancelled()){
|
||||
+ return InteractionResultHolder.consume(itemStack);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren