-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added challenges reload admin command.
This reloads from the database files so admins can edit the challenges and then reload them without restarting the server. #27
- Loading branch information
1 parent
b55cc82
commit e5e0227
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/bentobox/addon/challenges/commands/admin/ReloadChallenges.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package bentobox.addon.challenges.commands.admin; | ||
|
||
import java.util.List; | ||
|
||
import bentobox.addon.challenges.ChallengesAddon; | ||
import bentobox.addon.challenges.ChallengesManager; | ||
import world.bentobox.bentobox.api.addons.Addon; | ||
import world.bentobox.bentobox.api.commands.CompositeCommand; | ||
import world.bentobox.bentobox.api.user.User; | ||
|
||
public class ReloadChallenges extends CompositeCommand { | ||
|
||
private ChallengesManager manager; | ||
|
||
/** | ||
* Admin command to complete user challenges | ||
* @param parent | ||
*/ | ||
public ReloadChallenges(Addon addon, CompositeCommand parent) { | ||
super(addon, parent, "reload"); | ||
} | ||
|
||
@Override | ||
public void setup() { | ||
this.setPermission("admin.challenges"); | ||
this.setParametersHelp("challenges.admin.reload.parameters"); | ||
this.setDescription("challenges.admin.reload.description"); | ||
manager = ((ChallengesAddon)getAddon()).getChallengesManager(); | ||
} | ||
|
||
@Override | ||
public boolean execute(User user, String label, List<String> args) { | ||
if (!args.isEmpty()) { | ||
// Show help | ||
showHelp(this, user); | ||
return false; | ||
} | ||
manager.load(); | ||
user.sendMessage("general.success"); | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters