mirror of
https://github.com/PryPurity/WorldBorder.git
synced 2024-11-21 11:25:42 +01:00
Add option to change the Dynmap layer label
This commit is contained in:
parent
0ee59f99f4
commit
70927b7ecd
@ -39,6 +39,7 @@ public class Config {
|
||||
private static boolean whooshEffect = false;
|
||||
private static boolean portalRedirection = true;
|
||||
private static boolean dynmapEnable = false;
|
||||
private static String dynmapLayerLabel;
|
||||
private static String dynmapMessage;
|
||||
private static int dynmapPriority = 0;
|
||||
private static boolean dynmapHideByDefault = false;
|
||||
@ -341,6 +342,17 @@ public class Config {
|
||||
return dynmapEnable;
|
||||
}
|
||||
|
||||
public static void setDynmapLayerLabel(String label) {
|
||||
dynmapLayerLabel = label;
|
||||
log("DynMap layer label is now set to: " + label);
|
||||
save(true);
|
||||
DynMapFeatures.showAllBorders();
|
||||
}
|
||||
|
||||
public static String DynmapLayerLabel() {
|
||||
return dynmapLayerLabel;
|
||||
}
|
||||
|
||||
public static void setDynmapMessage(String msg) {
|
||||
dynmapMessage = msg;
|
||||
log("DynMap border label is now set to: " + msg);
|
||||
@ -520,6 +532,7 @@ public class Config {
|
||||
timerTicks = cfg.getInt("timer-delay-ticks", 5);
|
||||
remountDelayTicks = cfg.getInt("remount-delay-ticks", 0);
|
||||
dynmapEnable = cfg.getBoolean("dynmap-border-enabled", true);
|
||||
dynmapLayerLabel = cfg.getString("dynmap-border-layer-label", "WorldBorder");
|
||||
dynmapMessage = cfg.getString("dynmap-border-message", "The border of the world.");
|
||||
dynmapHideByDefault = cfg.getBoolean("dynmap-border-hideByDefault", false);
|
||||
dynmapPriority = cfg.getInt("dynmap-border-priority", 0);
|
||||
@ -624,6 +637,7 @@ public class Config {
|
||||
cfg.set("timer-delay-ticks", timerTicks);
|
||||
cfg.set("remount-delay-ticks", remountDelayTicks);
|
||||
cfg.set("dynmap-border-enabled", dynmapEnable);
|
||||
cfg.set("dynmap-border-layer-label", dynmapLayerLabel);
|
||||
cfg.set("dynmap-border-message", dynmapMessage);
|
||||
cfg.set("dynmap-border-hideByDefault", dynmapHideByDefault);
|
||||
cfg.set("dynmap-border-priority", dynmapPriority);
|
||||
|
@ -127,9 +127,9 @@ public class DynMapFeatures {
|
||||
// make sure the marker set is initialized
|
||||
markSet = markApi.getMarkerSet("worldborder.markerset");
|
||||
if (markSet == null)
|
||||
markSet = markApi.createMarkerSet("worldborder.markerset", "WorldBorder", null, false);
|
||||
markSet = markApi.createMarkerSet("worldborder.markerset", Config.DynmapLayerLabel(), null, false);
|
||||
else
|
||||
markSet.setMarkerSetLabel("WorldBorder");
|
||||
markSet.setMarkerSetLabel(Config.DynmapLayerLabel());
|
||||
markSet.setLayerPriority(Config.DynmapPriority());
|
||||
markSet.setHideByDefault(Config.DynmapHideByDefault());
|
||||
Map<String, BorderData> borders = Config.getBorders();
|
||||
|
@ -43,6 +43,7 @@ public class WBCommand implements CommandExecutor {
|
||||
addCmd(new CmdPreventSpawn()); // 1
|
||||
addCmd(new CmdDelay()); // 1
|
||||
addCmd(new CmdDynmap()); // 1
|
||||
addCmd(new CmdDynmaplabel()); // 1
|
||||
addCmd(new CmdDynmapmsg()); // 1
|
||||
addCmd(new CmdRemount()); // 1
|
||||
addCmd(new CmdFillautosave()); // 1
|
||||
|
42
src/main/java/com/wimbli/WorldBorder/cmd/CmdDynmaplabel.java
Normal file
42
src/main/java/com/wimbli/WorldBorder/cmd/CmdDynmaplabel.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.wimbli.WorldBorder.cmd;
|
||||
|
||||
import com.wimbli.WorldBorder.Config;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class CmdDynmaplabel extends WBCmd {
|
||||
public CmdDynmaplabel() {
|
||||
name = permission = "dynmaplabel";
|
||||
minParams = 1;
|
||||
|
||||
addCmdExample(nameEmphasized() + "<text> - DynMap border layer labels will show this.");
|
||||
helpText = "Default value: \"WorldBorder.\". If you are running the DynMap plugin and the " +
|
||||
commandEmphasized("dynmap") + C_DESC + "command setting is enabled, the border layer shown in DynMap will " +
|
||||
"be labelled with this text.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cmdStatus(CommandSender sender) {
|
||||
sender.sendMessage(C_HEAD + "DynMap border layer label is set to: " + C_ERR + Config.DynmapLayerLabel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Player player, List<String> params, String worldName) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (String param : params) {
|
||||
if (!first)
|
||||
message.append(" ");
|
||||
message.append(param);
|
||||
first = false;
|
||||
}
|
||||
|
||||
Config.setDynmapLayerLabel(message.toString());
|
||||
|
||||
if (player != null)
|
||||
cmdStatus(sender);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user