3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

enhance comments

Dieser Commit ist enthalten in:
chmodsayshello 2023-05-07 16:51:42 +02:00
Ursprung c4635b5501
Commit fd3b3e3f50

Datei anzeigen

@ -12,7 +12,7 @@ index e92bb09dd3218d5a13e6251bddd0812acadda2be..8b07c86f22299e9c89e70603abf77ef7
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
+import io.papermc.paper.event.player.PlayerCreateMapEvent; // Paper
public class EmptyMapItem extends ComplexItem {
public EmptyMapItem(Item.Properties settings) {
@ -27,15 +27,15 @@ index e92bb09dd3218d5a13e6251bddd0812acadda2be..8b07c86f22299e9c89e70603abf77ef7
user.awardStat(Stats.ITEM_USED.get(this));
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
+ // Paper start
+ PlayerCreateMapEvent playerCreateMapEvent = new PlayerCreateMapEvent((org.bukkit.entity.Player) user.getBukkitEntity(), itemStack2.asBukkitCopy());
+ world.getCraftServer().getPluginManager().callEvent(playerCreateMapEvent);
+ if(playerCreateMapEvent.isCancelled()){
+ return InteractionResultHolder.consume(itemStack);
+ }else if (!user.getAbilities().instabuild) { //moved down here 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);
+ }
+ //Paper end
+ // Paper end
if (itemStack.isEmpty()) {
return InteractionResultHolder.consume(itemStack2);
} else {