Greenhouses/src/main/java/world/bentobox/greenhouses/ui/user/UserCommand.java

61 lines
1.7 KiB
Java
Raw Normal View History

2019-01-19 16:52:04 +01:00
package world.bentobox.greenhouses.ui.user;
2019-03-02 19:53:15 +01:00
import java.util.ArrayList;
2019-01-19 16:52:04 +01:00
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
2019-01-22 00:44:01 +01:00
import world.bentobox.greenhouses.Greenhouses;
2019-01-19 16:52:04 +01:00
/**
* @author tastybento
*
*/
2019-01-22 00:44:01 +01:00
public class UserCommand extends CompositeCommand {
2019-01-19 16:52:04 +01:00
2019-02-08 00:17:55 +01:00
private MakeCommand makeCommand;
2019-01-19 16:52:04 +01:00
/**
2019-01-26 17:38:13 +01:00
* @param gh - addon
* @param parent - parent command
2019-01-19 16:52:04 +01:00
*/
2019-01-22 00:44:01 +01:00
public UserCommand(Greenhouses gh, CompositeCommand parent) {
2019-08-12 02:43:17 +02:00
super(gh, parent, "greenhouse", "gh", "greenhouses");
2019-01-19 16:52:04 +01:00
}
/* (non-Javadoc)
* @see world.bentobox.bentobox.api.commands.BentoBoxCommand#setup()
*/
@Override
public void setup() {
2019-01-26 20:10:30 +01:00
this.setPermission("greenhouses.player");
2019-01-19 16:52:04 +01:00
this.setOnlyPlayer(true);
this.setDescription("greenhouses.commands.user.description");
2019-01-19 16:52:04 +01:00
2019-01-22 00:44:01 +01:00
//new InfoCommand(this);
//new ListCommand(this);
2019-02-08 00:17:55 +01:00
makeCommand = new MakeCommand(this);
2019-01-22 00:44:01 +01:00
//new RecipeCommand(this);
2019-01-26 20:10:30 +01:00
new RemoveCommand(this);
2019-01-19 16:52:04 +01:00
}
/* (non-Javadoc)
* @see world.bentobox.bentobox.api.commands.BentoBoxCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)
*/
@Override
public boolean execute(User user, String label, List<String> args) {
2019-03-02 19:53:15 +01:00
if (args.isEmpty() && getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) != null) {
return getSubCommand("make").map(c -> c.execute(user, c.getLabel(), new ArrayList<>())).orElse(false);
}
return showHelp(this, user);
2019-01-19 16:52:04 +01:00
}
2019-02-08 00:17:55 +01:00
/**
* @return the makeCommand
*/
public MakeCommand getMakeCommand() {
return makeCommand;
}
2019-01-19 16:52:04 +01:00
}