mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-06-23 13:15:11 +02:00
51422108c6
Admin command cadmin to create and manage challenges in-game. Challenges are saved as yml files. Note that admins cannot edit yml files directly if server is running because they will be overwritten. User UI sort of works if challenge files are hand tailored. More to do!
42 lines
1.2 KiB
Java
42 lines
1.2 KiB
Java
package bskyblock.addon.challenges.commands.admin;
|
|
|
|
import java.util.List;
|
|
|
|
import bskyblock.addon.challenges.Challenges;
|
|
import us.tastybento.bskyblock.Constants;
|
|
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
|
import us.tastybento.bskyblock.api.commands.User;
|
|
|
|
public class ChallengesAdminCommand extends CompositeCommand {
|
|
private static final String CHALLENGE_ADMIN_COMMAND = "cadmin";
|
|
private Challenges addon;
|
|
|
|
public ChallengesAdminCommand(Challenges addon) {
|
|
super(CHALLENGE_ADMIN_COMMAND);
|
|
this.addon = addon;
|
|
// Set up create command
|
|
new CreateChallenge(addon, this);
|
|
}
|
|
|
|
@Override
|
|
public boolean execute(User user, List<String> args) {
|
|
// Open up the challenges GUI
|
|
if (user.isPlayer()) {
|
|
addon.getChallengesManager().getChallengesPanels().getChallenges(user);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public void setup() {
|
|
this.setOnlyPlayer(true);
|
|
this.setPermission(Constants.PERMPREFIX + "challenges.admin");
|
|
this.setParameters("challaneges.admin.parameters");
|
|
this.setDescription("challenges.admin.description");
|
|
this.setOnlyPlayer(true);
|
|
}
|
|
|
|
|
|
}
|