Skip to content

Commit

Permalink
Update to BentoBox 1.2
Browse files Browse the repository at this point in the history
For users who are not ready to use unfinished Challenges 0.5
  • Loading branch information
BONNe committed Jan 28, 2019
1 parent 4c3026f commit fbe7f15
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/main/java/world/bentobox/challenges/ChallengesAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,20 @@ public void onEnable() {
// Challenge import setup
importManager = new FreshSqueezedChallenges(this);

// Register commands - run one tick later to allow all addons to load
// AcidIsland hook in
getPlugin().getAddonsManager().getAddonByName("AcidIsland").ifPresent(a -> {
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand("ai");
if (acidIslandCmd != null) {
new ChallengesCommand(this, acidIslandCmd);
CompositeCommand acidCmd = getPlugin().getCommandsManager().getCommand("acid");
new Challenges(this, acidCmd);
hooked = true;
this.getPlugin().getAddonsManager().getGameModeAddons().forEach(gameModeAddon -> {
if (gameModeAddon.getPlayerCommand().isPresent())
{
new ChallengesCommand(this, gameModeAddon.getPlayerCommand().get());
this.hooked = true;
}
});
getPlugin().getAddonsManager().getAddonByName("BSkyBlock").ifPresent(a -> {
// BSkyBlock hook in
CompositeCommand bsbIslandCmd = getPlugin().getCommandsManager().getCommand("island");
if (bsbIslandCmd != null) {
new ChallengesCommand(this, bsbIslandCmd);
CompositeCommand bsbAdminCmd = getPlugin().getCommandsManager().getCommand("bsbadmin");
new Challenges(this, bsbAdminCmd);
hooked = true;

if (gameModeAddon.getAdminCommand().isPresent())
{
new Challenges(this, gameModeAddon.getAdminCommand().get());
this.hooked = true;
}
});

// If the add-on never hooks in, then it is useless
if (!hooked) {
logError("Challenges could not hook into AcidIsland or BSkyBlock so will not do anything!");
Expand Down

0 comments on commit fbe7f15

Please sign in to comment.