addon-welcomewarpsigns/src/main/java/world/bentobox/warps/commands/WarpsCommand.java

50 lines
1.3 KiB
Java

/**
*
*/
package world.bentobox.warps.commands;
import java.util.List;
import world.bentobox.warps.Warp;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
/**
* @author ben
*
*/
public class WarpsCommand extends CompositeCommand {
private Warp plugin;
public WarpsCommand(Warp plugin, CompositeCommand bsbIslandCmd) {
super(bsbIslandCmd, "warps");
this.plugin = plugin;
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.BSBCommand#setup()
*/
@Override
public void setup() {
this.setPermission("island.warp");
this.setOnlyPlayer(true);
this.setDescription("warps.help.description");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.commands.User, java.util.List)
*/
@Override
public boolean execute(User user, String label, List<String> args) {
if (plugin.getWarpSignsManager().listWarps(getWorld()).isEmpty()) {
user.sendMessage("warps.error.no-warps-yet");
user.sendMessage("warps.warpTip", "[text]", getAddon().getConfig().getString("welcomeLine", "[WELCOME]"));
} else {
plugin.getWarpPanelManager().showWarpPanel(getWorld(), user,0);
}
return true;
}
}