append new text instead of concatenating (#330)

This commit is contained in:
Chipmunk 2022-12-27 17:49:24 +00:00 committed by GitHub
parent baddda61aa
commit 411cdaa104
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View file

@ -35,9 +35,13 @@ public final class CommandDestroyEntities implements CommandExecutor {
worldCount++; worldCount++;
} }
sender.sendMessage(Component.text( sender.sendMessage(
"Successfully destroyed " + entityCount + " entities in " Component.text("Successfully destroyed ")
+ worldCount + " worlds")); .append(Component.text(entityCount))
.append(Component.text(" entities in "))
.append(Component.text(worldCount))
.append(Component.text(" worlds"))
);
return true; return true;
} }
} }

View file

@ -54,8 +54,12 @@ public final class CommandPing implements CommandExecutor {
break; break;
} }
sender.sendMessage(Component.text((args.length == 0 ? Component namePrefix = args.length == 0
"Your" : target.getName() + "'s") + " ping is ") ? Component.text("Your")
: Component.text(target.getName()).append(Component.text("'s"));
sender.sendMessage(namePrefix
.append(Component.text(" ping is "))
.append(Component.text(ping, highlighting)) .append(Component.text(ping, highlighting))
.append(Component.text("ms.", highlighting))); .append(Component.text("ms.", highlighting)));
return true; return true;