From 094ca5018b88cb8b0de2fc02428f3536f2a30011 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 16 Apr 2023 16:47:58 +0700 Subject: [PATCH] improve rtp --- .../chomens_bot/commands/RandomTeleportCommand.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java index dbd4d50..ec32f49 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java @@ -1,9 +1,9 @@ package land.chipmunk.chayapak.chomens_bot.commands; import land.chipmunk.chayapak.chomens_bot.Bot; +import land.chipmunk.chayapak.chomens_bot.chatParsers.data.MutablePlayerListEntry; import land.chipmunk.chayapak.chomens_bot.command.Command; import land.chipmunk.chayapak.chomens_bot.command.CommandContext; -import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.NumberUtilities; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -39,23 +39,22 @@ public class RandomTeleportCommand implements Command { public Component execute(CommandContext context, String[] args, String[] fullArgs) { final Bot bot = context.bot(); - final String stringDisplayName = ComponentUtilities.stringify(context.displayName()); + final MutablePlayerListEntry sender = context.sender(); - final int positionX = NumberUtilities.between(1_000, 10_000); - final int positionZ = NumberUtilities.between(1_000, 10_000); + final int positionX = NumberUtilities.between(1_000, 1_000_000); + final int positionZ = NumberUtilities.between(1_000, 1_000_000); final String stringPosition = positionX + " 100 " + positionZ; // very 100 y context.sendOutput( Component.empty() .append(Component.text("Teleporting ")) - .append(context.displayName().color(NamedTextColor.AQUA)) + .append(sender.displayName().color(NamedTextColor.AQUA)) .append(Component.text(" to ").color(NamedTextColor.WHITE)) .append(Component.text(stringPosition).color(NamedTextColor.GREEN)) .append(Component.text("...").color(NamedTextColor.WHITE)) ); - // TODO: Use UUID instead of display name because it is a bad idea!!11 - bot.core().run("essentials:teleport " + stringDisplayName + " " + stringPosition); + bot.core().run("essentials:teleport " + sender.profile().getIdAsString() + " " + stringPosition); return Component.text("success"); }