Add VanillaCrafts style coordinates and teleport buttons

This commit is contained in:
whitebelyash 2026-02-08 22:04:41 +04:00
parent 52f3e8929d
commit 1a09bd59c0

View file

@ -8,6 +8,7 @@ import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.format.TextDecoration;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@ -47,6 +48,19 @@ public class ChatUtils {
return message.append("</hover></click>").toString(); // griefus return message.append("</hover></click>").toString(); // griefus
} }
public static String getShowCoordinatesButton(int x, int y, int z) {
return "<dark_gray><hover:show_text:\"" +
"X: <yellow>" + x + "</yellow> " +
"Y: <yellow>" + y + "</yellow> " +
"Z: <yellow>" + z + "</yellow> " +
"\">[координаты]</hover></dark_gray>";
}
public static String getTeleportButton(int worldId, int x, int y, int z) {
// May break if worldId index is outdated
return "<dark_gray><click:run_command:/tppos " + x + " " + y + " " + z + " " + Bukkit.getWorlds().get(worldId).getName() +
">[телепортироваться]</click></dark_gray>";
}
public static String getPageNavigation(String command, int page, int totalPages) { public static String getPageNavigation(String command, int page, int totalPages) {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();