Added `/marker remove` and made the icon a config option (#43)

1.16
Joey Hines 2019-10-13 02:45:53 +02:00 committed by Gitea
parent e75d8efdfc
commit 6a746d5702
5 changed files with 27 additions and 5 deletions

View File

@ -45,4 +45,4 @@ Alias ``/names`` and ``/name``
``/dynmaplink [<map>] [<zoom>]`` Get a link to Dynmap with your current location. Optionally choose the map (flat, surface, etc.) and zoom level. ``/dynmaplink [<map>] [<zoom>]`` Get a link to Dynmap with your current location. Optionally choose the map (flat, surface, etc.) and zoom level.
``/marker`` Creates a marker on the dynmap at the players current location. ``/marker <set|remove>`` Creates or removes a marker on the dynmap at the players current location.

View File

@ -59,4 +59,8 @@ World View Distance Override
.. note:: .. note::
Paper has removed this feature in ``1.14.x`` and so it has been disabled in QoL until it is re-implemented by Paper. Paper has removed this feature in ``1.14.x`` and so it has been disabled in QoL until it is re-implemented by Paper.
Each world can have its own view distance. View distances of each world can be set in the config file. If no view distance is set, the view distance defaults to the one in server.properties. Each world can have its own view distance. View distances of each world can be set in the config file. If no view distance is set, the view distance defaults to the one in server.properties.
QoL Dynmap Markers
------------------
QoL Markers are placed on their own layer hidden by default. A player with permission can have one marker. When a player loses the `qol.marker` permission, their marker is removed. The icon of the marker can be set in the `dynmap.marker_icon` config option

View File

@ -26,7 +26,7 @@ public class QoL extends JavaPlugin {
static private final String qolMarkerSetName = "qolMarkerSet"; static private final String qolMarkerSetName = "qolMarkerSet";
static private final String qolMarkerSetLabel = "QoL Markers"; static private final String qolMarkerSetLabel = "QoL Markers";
static private final String qolMarkerIcon = "blueflag"; private String qolMarkerIcon = null;
private static QoL instance; private static QoL instance;
private IEssentials essentials = null; private IEssentials essentials = null;
@ -230,6 +230,8 @@ public class QoL extends JavaPlugin {
viewDistances.put(worldName, viewDistance); viewDistances.put(worldName, viewDistance);
} }
qolMarkerIcon = config.getString("dynmap.marker_icon", "blueflag");
} }

View File

@ -1,6 +1,7 @@
package xyz.etztech.qol.commands; package xyz.etztech.qol.commands;
import org.bukkit.ChatColor;
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;
@ -29,9 +30,23 @@ public class MarkerCommand implements CommandExecutor {
return true; return true;
} }
plugin.createMarkerAtPlayer((Player) commandSender); if (args.length < 1) {
EtzTechUtil.sms(commandSender, ChatColor.RED + "/marker set");
EtzTechUtil.sms(commandSender, ChatColor.RED + "/marker remove");
return true;
}
else {
String action = args[0].toLowerCase();
if (action.equals("set")) {
plugin.createMarkerAtPlayer((Player) commandSender);
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Location Marker Created!");
}
else if (action.equals("remove")) {
plugin.getPlayerMarker((Player)commandSender).deleteMarker();
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Location Marker Removed!");
}
}
EtzTechUtil.sms(commandSender, "Location Marker Created!");
return true; return true;
} }

View File

@ -103,6 +103,7 @@ spec-confirm:
# Dynmap link # Dynmap link
# Leave url blank to disable # Leave url blank to disable
dynmap: dynmap:
marker_icon: "blueflag"
url: "" url: ""
defaults: defaults:
map: "surface" map: "surface"