mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-09-27 06:03:15 +02:00
7fbffbb6d2
Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways.
69 lines
1.8 KiB
Java
69 lines
1.8 KiB
Java
package world.bentobox.challenges.commands.admin;
|
|
|
|
import java.util.List;
|
|
|
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
|
import world.bentobox.bentobox.api.user.User;
|
|
import world.bentobox.challenges.ChallengesAddon;
|
|
import world.bentobox.challenges.panel.admin.AdminPanel;
|
|
|
|
|
|
public class ChallengesAdminCommand extends CompositeCommand
|
|
{
|
|
/**
|
|
* Instantiates a new Challenges' admin command.
|
|
*
|
|
* @param addon the addon
|
|
* @param parent the parent
|
|
*/
|
|
public ChallengesAdminCommand(ChallengesAddon addon, CompositeCommand parent)
|
|
{
|
|
super(addon,
|
|
parent,
|
|
addon.getChallengesSettings().getAdminMainCommand().split(" ")[0],
|
|
addon.getChallengesSettings().getAdminMainCommand().split(" "));
|
|
}
|
|
|
|
|
|
@Override
|
|
public void setup()
|
|
{
|
|
this.setPermission("admin.challenges");
|
|
this.setParametersHelp("challenges.commands.admin.main.parameters");
|
|
this.setDescription("challenges.commands.admin.main.description");
|
|
|
|
// Register sub commands
|
|
|
|
// This method reloads challenges addon
|
|
new ReloadChallenges(getAddon(), this);
|
|
|
|
// Complete challenge command
|
|
new CompleteCommand(this.getAddon(), this);
|
|
|
|
// Reset challenge command
|
|
new ResetCommand(this.getAddon(), this);
|
|
|
|
new ShowChallenges(this.getAddon(), this);
|
|
|
|
new MigrateCommand(this.getAddon(), this);
|
|
}
|
|
|
|
|
|
@Override
|
|
public boolean execute(User user, String label, List<String> args)
|
|
{
|
|
// Open up the admin challenges GUI
|
|
if (user.isPlayer())
|
|
{
|
|
AdminPanel.open(this.getAddon(),
|
|
this.getWorld(),
|
|
user,
|
|
this.getTopLabel(),
|
|
this.getPermissionPrefix());
|
|
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|