2019-12-16 16:47:51 +01:00
|
|
|
package world.bentobox.limits.commands;
|
2019-02-09 19:07:16 +01:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
|
|
|
import world.bentobox.bentobox.api.user.User;
|
2019-12-16 16:47:51 +01:00
|
|
|
import world.bentobox.limits.Limits;
|
2019-02-09 19:07:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* User command for limits
|
|
|
|
* @author tastybento
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class PlayerCommand extends CompositeCommand {
|
|
|
|
|
2019-02-09 19:30:02 +01:00
|
|
|
private final Limits addon;
|
2019-02-09 19:07:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Top level command
|
2019-02-09 19:30:02 +01:00
|
|
|
* @param addon - addon
|
2019-02-09 19:07:16 +01:00
|
|
|
*/
|
|
|
|
public PlayerCommand(Limits addon, CompositeCommand parent) {
|
|
|
|
super(parent, "limits");
|
|
|
|
this.addon = addon;
|
2019-09-11 04:01:39 +02:00
|
|
|
new RecountCommand(addon, this);
|
2019-02-09 19:07:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* (non-Javadoc)
|
|
|
|
* @see world.bentobox.bentobox.api.commands.BentoBoxCommand#setup()
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setup() {
|
|
|
|
this.setPermission("limits.player.limits");
|
|
|
|
this.setOnlyPlayer(true);
|
|
|
|
this.setParametersHelp("island.limits.parameters");
|
|
|
|
this.setDescription("island.limits.description");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* (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) {
|
|
|
|
if (!args.isEmpty()) {
|
|
|
|
showHelp(this, user);
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
new LimitPanel(addon).showLimits(getWorld(), user, user.getUniqueId());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|