Merge branch 'master' of git.etztech.xyz:24CarrotCraft/QoL into spec_confirm
Signed-off-by: Etzelia <etzelia@hotmail.com>spec_confirm
commit
d26a46f9a0
|
@ -17,10 +17,13 @@ Additions
|
||||||
``~~strikethrough~~``
|
``~~strikethrough~~``
|
||||||
|
|
||||||
* `Spec Confirm`_ - Updates the TP confirmation to allow for a configurable list of commands
|
* `Spec Confirm`_ - Updates the TP confirmation to allow for a configurable list of commands
|
||||||
|
* `Dynmap Link Command`_ - Allows a user to get a link to dynmap pointing to their current location
|
||||||
|
|
||||||
.. _Checkup Command: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/33
|
.. _Checkup Command: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/33
|
||||||
.. _Discord Syntax: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/36
|
.. _Discord Syntax: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/36
|
||||||
.. _Spec Confirm: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/39
|
.. _Spec Confirm: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/39
|
||||||
|
.. _Dynmap Link Command: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/40
|
||||||
|
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
---------
|
---------
|
||||||
|
|
|
@ -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>]`` Get a link to Dynmap with your current location. Optionally choose the map (flat, surface, etc.) and zoom level.
|
||||||
|
|
|
@ -40,6 +40,8 @@ Permissions
|
||||||
|
|
||||||
``qol.karattrophy`` - Ability to use the Karat Trophy command
|
``qol.karattrophy`` - Ability to use the Karat Trophy command
|
||||||
|
|
||||||
|
``qol.dynmaplink`` - Ability to use the Dynmap Link command
|
||||||
|
|
||||||
``qol.deathmute`` - Ability to use the Death Mute command
|
``qol.deathmute`` - Ability to use the Death Mute command
|
||||||
|
|
||||||
``qol.griefalert`` - Receive GriefAlert alerts
|
``qol.griefalert`` - Receive GriefAlert alerts
|
||||||
|
|
|
@ -107,6 +107,8 @@ public class QoL extends JavaPlugin {
|
||||||
this.getCommand("karattrophy").setExecutor(karatTrophyCommand);
|
this.getCommand("karattrophy").setExecutor(karatTrophyCommand);
|
||||||
CheckupCommand checkupCommand = new CheckupCommand(this);
|
CheckupCommand checkupCommand = new CheckupCommand(this);
|
||||||
this.getCommand("checkup").setExecutor(checkupCommand);
|
this.getCommand("checkup").setExecutor(checkupCommand);
|
||||||
|
DynmapLinkCommand dynmapLinkCommand = new DynmapLinkCommand(this);
|
||||||
|
this.getCommand("dynmaplink").setExecutor(dynmapLinkCommand);
|
||||||
|
|
||||||
if (getConfig().getStringList("list").size() > 0) {
|
if (getConfig().getStringList("list").size() > 0) {
|
||||||
ListCommand listCommand = new ListCommand(this);
|
ListCommand listCommand = new ListCommand(this);
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
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.TextComponent;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
|
import xyz.etztech.qol.Lang;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
|
||||||
|
public class DynmapLinkCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
QoL plugin;
|
||||||
|
|
||||||
|
public DynmapLinkCommand(QoL plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||||
|
if (!( commandSender instanceof Player)) {
|
||||||
|
EtzTechUtil.sms(commandSender, Lang.NO_CONSOLE.getDef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) commandSender;
|
||||||
|
|
||||||
|
String base = plugin.getConfig().getString("dynmap.url", "");
|
||||||
|
String defaultMap = plugin.getConfig().getString("dynmap.defaults.map", "surface");
|
||||||
|
String defaultZoom = String.valueOf(plugin.getConfig().getInt("dynmap.defaults.zoom", 5));
|
||||||
|
|
||||||
|
TextComponent message;
|
||||||
|
if (base.trim().length() > 0) {
|
||||||
|
String world = player.getWorld().getName();
|
||||||
|
Location location = player.getLocation();
|
||||||
|
String x = String.valueOf(location.getX());
|
||||||
|
String y = String.valueOf(location.getY());
|
||||||
|
String z = String.valueOf(location.getZ());
|
||||||
|
String map = args.length > 0 ? args[0] : defaultMap;
|
||||||
|
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);
|
||||||
|
message = new TextComponent("Click here to see your location on Dynmap.");
|
||||||
|
message.setColor(ChatColor.YELLOW);
|
||||||
|
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
|
||||||
|
} else {
|
||||||
|
message = new TextComponent("This command is currently disabled or the server has no Dynmap!");
|
||||||
|
message.setColor(ChatColor.RED);
|
||||||
|
}
|
||||||
|
player.spigot().sendMessage(message);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -99,3 +99,11 @@ spec-confirm:
|
||||||
- "tp"
|
- "tp"
|
||||||
- "checkup"
|
- "checkup"
|
||||||
- "lagg tpchunk"
|
- "lagg tpchunk"
|
||||||
|
|
||||||
|
# Dynmap link
|
||||||
|
# Leave url blank to disable
|
||||||
|
dynmap:
|
||||||
|
url: ""
|
||||||
|
defaults:
|
||||||
|
map: "surface"
|
||||||
|
zoom: 5
|
||||||
|
|
|
@ -45,6 +45,9 @@ commands:
|
||||||
aliases: [trophy]
|
aliases: [trophy]
|
||||||
checkup:
|
checkup:
|
||||||
description: Checkup command
|
description: Checkup command
|
||||||
|
dynmaplink:
|
||||||
|
description: Dynmap Link command
|
||||||
|
aliases: [dlink]
|
||||||
permissions:
|
permissions:
|
||||||
qol.admin:
|
qol.admin:
|
||||||
description: Ability to reload the plugin
|
description: Ability to reload the plugin
|
||||||
|
@ -85,6 +88,9 @@ permissions:
|
||||||
qol.checkup:
|
qol.checkup:
|
||||||
description: Ability to use the Checkup Command
|
description: Ability to use the Checkup Command
|
||||||
default: op
|
default: op
|
||||||
|
qol.dynmaplink:
|
||||||
|
description: Ability to use the Dynmap Link Command
|
||||||
|
default: op
|
||||||
qol.auditable:
|
qol.auditable:
|
||||||
description: Audits command usage
|
description: Audits command usage
|
||||||
default: op
|
default: op
|
||||||
|
|
Loading…
Reference in New Issue