#154: Added reset function

This commit is contained in:
Daniel Saukel 2016-09-13 18:39:22 +02:00
parent 7066c113b7
commit c79867d44c
3 changed files with 16 additions and 2 deletions

View File

@ -45,6 +45,12 @@ public class ResourcePackCommand extends BRCommand {
public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender;
if (args[1].equalsIgnoreCase("reset")) {
// Placeholder to reset to default
ResourcePackAPI.setResourcepack(player, "http://google.com");
return;
}
String url = (String) plugin.getMainConfig().getResourcePacks().get(args[1]);
if (url == null) {
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_RESOURCE_PACK.getMessage(args[1]));

View File

@ -85,6 +85,7 @@ public enum DMessages implements Messages {
ERROR_NO_SUCH_GROUP("Error_NoSuchGroup", "&4The group &6&v1&4 does not exist!"),
ERROR_NO_SUCH_MAP("Error_NoSuchMap", "&4The world &6&v1&4 does not exist!"),
ERROR_NO_SUCH_PLAYER("Error_NoSuchPlayer", "&4The player &6&v1&4 does not exist!"),
ERROR_NO_SUCH_RESOURCE_PACK("Error_NoSuchResourcePack", "&4The resource pack &6&v1 &4is not registered in the main configuration file!"),
ERROR_NO_SUCH_SHOP("Error_NoSuchShop", "&4Shop &v1 &4not found..."),
ERROR_NOT_CAPTAIN("Error_NotCaptain", "&4You are not the captain of your group!"),
ERROR_NOT_IN_DUNGEON("Error_NotInDungeon", "&4You are not in a dungeon!"),
@ -130,6 +131,7 @@ public enum DMessages implements Messages {
HELP_CMD_PORTAL("Help_Cmd_Portal", "/dxl portal ([material=portal])- Creates a portal that leads into a dungeon"),
HELP_CMD_RELOAD("Help_Cmd_Reload", "/dxl reload - Reloads the plugin"),
HELP_CMD_REWARDS("Help_Cmd_Rewards", "/dxl rewards - Gives all left item rewards to the player"),
HELP_CMD_RESOURCE_PACK("Help_Cmd_ResourcePack", "/dxl resourcepack [ID] - Downloads a resourcepack registered in the main configuration file; use 'reset' to reset"),
HELP_CMD_SAVE("Help_Cmd_Save", "/dxl save - Saves the current dungeon"),
HELP_CMD_STATUS("Help_Cmd_Status", "/dxl status - Shows the technical status of DungeonsXL"),
HELP_CMD_SETTINGS("Help_Cmd_Settings", "/dxl settings ([edit|global|player])- Opens the settings menu"),

View File

@ -61,12 +61,18 @@ public class ResourcePackSign extends DSign {
/* Actions */
@Override
public boolean check() {
return plugin.getMainConfig().getResourcePacks().get(lines[1]) != null;
return plugin.getMainConfig().getResourcePacks().get(lines[1]) != null || lines[1].equalsIgnoreCase("reset");
}
@Override
public void onInit() {
Object url = plugin.getMainConfig().getResourcePacks().get(lines[1]);
Object url = null;
if (lines[1].equalsIgnoreCase("reset")) {
// Placeholder to reset to default
url = "http://google.com";
} else {
url = plugin.getMainConfig().getResourcePacks().get(lines[1]);
}
if (url instanceof String) {
resourcePack = (String) url;