#154: Added command to download registered RPs

This commit is contained in:
Daniel Saukel 2016-09-11 22:51:59 +02:00
parent 65cb1ebd16
commit 7066c113b7
3 changed files with 60 additions and 0 deletions

View File

@ -48,6 +48,7 @@ public class DCommands extends BRCommands {
public static PlayCommand PLAY = new PlayCommand();
public static PortalCommand PORTAL = new PortalCommand();
public static ReloadCommand RELOAD = new ReloadCommand();
public static ResourcePackCommand RESOURCE_PACK = new ResourcePackCommand();
public static RewardsCommand REWARDS = new RewardsCommand();
public static SaveCommand SAVE = new SaveCommand();
public static StatusCommand STATUS = new StatusCommand();
@ -78,6 +79,7 @@ public class DCommands extends BRCommands {
PLAY,
PORTAL,
RELOAD,
RESOURCE_PACK,
REWARDS,
SAVE,
STATUS,

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2012-2016 Frank Baumann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DPermissions;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.inventivetalent.rpapi.ResourcePackAPI;
/**
* @author Daniel Saukel
*/
public class ResourcePackCommand extends BRCommand {
DungeonsXL plugin = DungeonsXL.getInstance();
public ResourcePackCommand() {
setCommand("resourcepack");
setMinArgs(1);
setMaxArgs(1);
setHelp(DMessages.HELP_CMD_RESOURCE_PACK.getMessage());
setPermission(DPermissions.RESOURCE_PACK.getNode());
setPlayerCommand(true);
}
@Override
public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender;
String url = (String) plugin.getMainConfig().getResourcePacks().get(args[1]);
if (url == null) {
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_RESOURCE_PACK.getMessage(args[1]));
return;
}
ResourcePackAPI.setResourcepack(player, url);
}
}

View File

@ -59,6 +59,7 @@ public enum DPermissions {
PLAY("play", OP),
PORTAL("portal", OP),
RELOAD("reload", OP),
RESOURCE_PACK("resourcepack", OP),
REWARDS("rewards", TRUE),
SAVE("save", OP),
STATUS("status", OP),