mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
33 lines
1.9 KiB
Diff
33 lines
1.9 KiB
Diff
--- a/net/minecraft/server/commands/GiveCommand.java
|
|
+++ b/net/minecraft/server/commands/GiveCommand.java
|
|
@@ -38,6 +38,7 @@
|
|
|
|
private static int giveItem(CommandSourceStack source, ItemInput item, Collection<ServerPlayer> targets, int count) throws CommandSyntaxException {
|
|
ItemStack itemstack = item.createItemStack(1, false);
|
|
+ final Component displayName = itemstack.getDisplayName(); // Paper - get display name early
|
|
int j = itemstack.getMaxStackSize();
|
|
int k = j * 100;
|
|
|
|
@@ -60,7 +61,7 @@
|
|
ItemEntity entityitem;
|
|
|
|
if (flag && itemstack1.isEmpty()) {
|
|
- entityitem = entityplayer.drop(itemstack, false);
|
|
+ entityitem = entityplayer.drop(itemstack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event
|
|
if (entityitem != null) {
|
|
entityitem.makeFakeItem();
|
|
}
|
|
@@ -79,11 +80,11 @@
|
|
|
|
if (targets.size() == 1) {
|
|
source.sendSuccess(() -> {
|
|
- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), ((ServerPlayer) targets.iterator().next()).getDisplayName());
|
|
+ return Component.translatable("commands.give.success.single", count, displayName, ((ServerPlayer) targets.iterator().next()).getDisplayName()); // Paper - use cached display name
|
|
}, true);
|
|
} else {
|
|
source.sendSuccess(() -> {
|
|
- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), targets.size());
|
|
+ return Component.translatable("commands.give.success.single", count, displayName, targets.size()); // Paper - use cached display name
|
|
}, true);
|
|
}
|
|
|