2018-12-30 14:31:26 +01:00
|
|
|
package world.bentobox.challenges.commands.admin;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
|
|
|
import world.bentobox.bentobox.api.user.User;
|
2020-04-22 00:19:46 +02:00
|
|
|
import world.bentobox.challenges.ChallengesAddon;
|
2019-01-23 16:30:30 +01:00
|
|
|
import world.bentobox.challenges.panel.admin.AdminGUI;
|
|
|
|
|
2018-12-30 14:31:26 +01:00
|
|
|
|
2019-05-01 11:46:54 +02:00
|
|
|
public class Challenges extends CompositeCommand
|
|
|
|
{
|
2018-12-30 14:31:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Admin command for challenges
|
2019-05-01 11:46:54 +02:00
|
|
|
*
|
2018-12-30 14:31:26 +01:00
|
|
|
* @param parent
|
|
|
|
*/
|
2019-05-01 11:46:54 +02:00
|
|
|
public Challenges(ChallengesAddon addon, CompositeCommand parent)
|
|
|
|
{
|
2018-12-30 14:31:26 +01:00
|
|
|
super(addon, parent, "challenges");
|
|
|
|
}
|
|
|
|
|
2019-05-01 11:46:54 +02:00
|
|
|
|
2018-12-30 14:31:26 +01:00
|
|
|
@Override
|
2019-05-01 11:46:54 +02:00
|
|
|
public void setup()
|
|
|
|
{
|
2018-12-30 14:31:26 +01:00
|
|
|
this.setPermission("admin.challenges");
|
2019-02-12 00:38:16 +01:00
|
|
|
this.setParametersHelp("challenges.commands.admin.main.parameters");
|
|
|
|
this.setDescription("challenges.commands.admin.main.description");
|
2019-05-01 11:46:54 +02:00
|
|
|
|
2018-12-30 14:31:26 +01:00
|
|
|
// Register sub commands
|
|
|
|
|
2019-05-01 11:46:54 +02:00
|
|
|
// This method reloads challenges addon
|
|
|
|
new ReloadChallenges(getAddon(), this);
|
2019-08-26 08:08:56 +02:00
|
|
|
|
2019-05-01 11:46:54 +02:00
|
|
|
// Defaults processing command
|
|
|
|
new DefaultsCommand(this.getAddon(), this);
|
2019-06-16 20:21:25 +02:00
|
|
|
|
2019-06-23 15:51:49 +02:00
|
|
|
// Complete challenge command
|
2019-06-16 20:21:25 +02:00
|
|
|
new CompleteCommand(this.getAddon(), this);
|
2019-06-23 15:51:49 +02:00
|
|
|
|
|
|
|
// Reset challenge command
|
|
|
|
new ResetCommand(this.getAddon(), this);
|
2019-08-02 11:22:52 +02:00
|
|
|
|
|
|
|
new ShowChallenges(this.getAddon(), this);
|
|
|
|
|
|
|
|
new MigrateCommand(this.getAddon(), this);
|
2018-12-30 14:31:26 +01:00
|
|
|
}
|
|
|
|
|
2019-05-01 11:46:54 +02:00
|
|
|
|
2018-12-30 14:31:26 +01:00
|
|
|
@Override
|
2019-05-01 11:46:54 +02:00
|
|
|
public boolean execute(User user, String label, List<String> args)
|
|
|
|
{
|
2018-12-30 14:31:26 +01:00
|
|
|
// Open up the admin challenges GUI
|
2019-05-01 11:46:54 +02:00
|
|
|
if (user.isPlayer())
|
|
|
|
{
|
2019-01-23 16:30:30 +01:00
|
|
|
new AdminGUI((ChallengesAddon) this.getAddon(),
|
|
|
|
this.getWorld(),
|
|
|
|
user,
|
|
|
|
this.getTopLabel(),
|
|
|
|
this.getPermissionPrefix()).build();
|
|
|
|
|
2018-12-30 14:31:26 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|