mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-02 05:02:10 -07:00
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
25 lines
1.4 KiB
Diff
25 lines
1.4 KiB
Diff
--- a/net/minecraft/server/commands/GiveCommand.java
|
|
+++ b/net/minecraft/server/commands/GiveCommand.java
|
|
@@ -54,6 +_,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 maxStackSize = itemStack.getMaxStackSize();
|
|
int i = maxStackSize * 100;
|
|
if (count > i) {
|
|
@@ -98,11 +_,11 @@
|
|
|
|
if (targets.size() == 1) {
|
|
source.sendSuccess(
|
|
- () -> Component.translatable("commands.give.success.single", count, itemStack.getDisplayName(), targets.iterator().next().getDisplayName()),
|
|
+ () -> Component.translatable("commands.give.success.single", count, displayName, targets.iterator().next().getDisplayName()), // Paper - use cached display name
|
|
true
|
|
);
|
|
} else {
|
|
- source.sendSuccess(() -> Component.translatable("commands.give.success.single", count, itemStack.getDisplayName(), targets.size()), true);
|
|
+ source.sendSuccess(() -> Component.translatable("commands.give.success.single", count, displayName, targets.size()), true); // Paper - use cached display name
|
|
}
|
|
|
|
return targets.size();
|