forked from Minecraft/QoL
Update colors to JSON message format
Signed-off-by: Etzelia <etzelia@hotmail.com>dynmap_link
parent
39cf5cbb7a
commit
1880a61b2d
|
@ -43,4 +43,4 @@ Alias ``/names`` and ``/name``
|
||||||
|
|
||||||
``/checkup <start|next|stop>`` Start a checkup, teleporting to all online players.
|
``/checkup <start|next|stop>`` Start a checkup, teleporting to all online players.
|
||||||
|
|
||||||
``/dynmaplink [<map>] [<zoom>]`` Start a checkup, teleporting to all online players.
|
``/dynmaplink [<map>] [<zoom>]`` Get a link to Dynmap with your current location. Optionally choose the map (flat, surface, etc.) and zoom level.
|
||||||
|
|
|
@ -1,22 +1,17 @@
|
||||||
package xyz.etztech.qol.commands;
|
package xyz.etztech.qol.commands;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.dynmap.DynmapAPI;
|
|
||||||
import xyz.etztech.qol.EtzTechUtil;
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
import xyz.etztech.qol.Lang;
|
import xyz.etztech.qol.Lang;
|
||||||
import xyz.etztech.qol.QoL;
|
import xyz.etztech.qol.QoL;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class DynmapLinkCommand implements CommandExecutor {
|
public class DynmapLinkCommand implements CommandExecutor {
|
||||||
|
|
||||||
QoL plugin;
|
QoL plugin;
|
||||||
|
@ -48,10 +43,12 @@ public class DynmapLinkCommand implements CommandExecutor {
|
||||||
String map = args.length > 0 ? args[0] : defaultMap;
|
String map = args.length > 0 ? args[0] : defaultMap;
|
||||||
String zoom = args.length > 1 ? args[1] : defaultZoom;
|
String zoom = args.length > 1 ? args[1] : defaultZoom;
|
||||||
String url = String.format("%s?worldname=%s&mapname=%s&zoom=%s&x=%s&y=%s&z=%s", base, world, map, zoom, x, y, z);
|
String url = String.format("%s?worldname=%s&mapname=%s&zoom=%s&x=%s&y=%s&z=%s", base, world, map, zoom, x, y, z);
|
||||||
message = new TextComponent(ChatColor.YELLOW + "Click here to see your location on Dynmap.");
|
message = new TextComponent("Click here to see your location on Dynmap.");
|
||||||
|
message.setColor(ChatColor.YELLOW);
|
||||||
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
|
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
|
||||||
} else {
|
} else {
|
||||||
message = new TextComponent(ChatColor.RED + "This command is currently disabled or the server has no Dynmap!");
|
message = new TextComponent("This command is currently disabled or the server has no Dynmap!");
|
||||||
|
message.setColor(ChatColor.RED);
|
||||||
}
|
}
|
||||||
player.spigot().sendMessage(message);
|
player.spigot().sendMessage(message);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue