mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 17:52:02 -07:00
rebase
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
--- 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) {
|
||||
@@ -69,7 +_,7 @@
|
||||
ItemStack itemStack1 = item.createItemStack(min, false);
|
||||
boolean flag = serverPlayer.getInventory().add(itemStack1);
|
||||
@@ -26,17 +18,3 @@
|
||||
if (itemEntity != null) {
|
||||
itemEntity.setNoPickUpDelay();
|
||||
itemEntity.setTarget(serverPlayer.getUUID());
|
||||
@@ -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();
|
||||
|
Reference in New Issue
Block a user