mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-12-01 06:53:26 +01:00
#154: Added command to download registered RPs
This commit is contained in:
parent
65cb1ebd16
commit
7066c113b7
@ -48,6 +48,7 @@ public class DCommands extends BRCommands {
|
|||||||
public static PlayCommand PLAY = new PlayCommand();
|
public static PlayCommand PLAY = new PlayCommand();
|
||||||
public static PortalCommand PORTAL = new PortalCommand();
|
public static PortalCommand PORTAL = new PortalCommand();
|
||||||
public static ReloadCommand RELOAD = new ReloadCommand();
|
public static ReloadCommand RELOAD = new ReloadCommand();
|
||||||
|
public static ResourcePackCommand RESOURCE_PACK = new ResourcePackCommand();
|
||||||
public static RewardsCommand REWARDS = new RewardsCommand();
|
public static RewardsCommand REWARDS = new RewardsCommand();
|
||||||
public static SaveCommand SAVE = new SaveCommand();
|
public static SaveCommand SAVE = new SaveCommand();
|
||||||
public static StatusCommand STATUS = new StatusCommand();
|
public static StatusCommand STATUS = new StatusCommand();
|
||||||
@ -78,6 +79,7 @@ public class DCommands extends BRCommands {
|
|||||||
PLAY,
|
PLAY,
|
||||||
PORTAL,
|
PORTAL,
|
||||||
RELOAD,
|
RELOAD,
|
||||||
|
RESOURCE_PACK,
|
||||||
REWARDS,
|
REWARDS,
|
||||||
SAVE,
|
SAVE,
|
||||||
STATUS,
|
STATUS,
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -59,6 +59,7 @@ public enum DPermissions {
|
|||||||
PLAY("play", OP),
|
PLAY("play", OP),
|
||||||
PORTAL("portal", OP),
|
PORTAL("portal", OP),
|
||||||
RELOAD("reload", OP),
|
RELOAD("reload", OP),
|
||||||
|
RESOURCE_PACK("resourcepack", OP),
|
||||||
REWARDS("rewards", TRUE),
|
REWARDS("rewards", TRUE),
|
||||||
SAVE("save", OP),
|
SAVE("save", OP),
|
||||||
STATUS("status", OP),
|
STATUS("status", OP),
|
||||||
|
Loading…
Reference in New Issue
Block a user