mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-30 12:57:52 +01:00
Fixes issue with Level not being referenced correctly.
https://github.com/BentoBoxWorld/addon-challenges/issues/26
This commit is contained in:
parent
c70f5cf2f3
commit
1e07223d61
31
pom.xml
31
pom.xml
@ -63,11 +63,6 @@
|
||||
<version>${powermock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongodb-driver</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>bentobox</artifactId>
|
||||
@ -209,30 +204,4 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>sonar</id>
|
||||
<properties>
|
||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||
<sonar.organization>tastybento-github</sonar.organization>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>3.4.1.1168</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sonar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
@ -17,6 +17,7 @@ public class ChallengesAddon extends Addon {
|
||||
private ChallengesManager challengesManager;
|
||||
private String permissionPrefix = "addon";
|
||||
private FreshSqueezedChallenges importManager;
|
||||
private boolean hooked;
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
@ -41,13 +42,14 @@ public class ChallengesAddon extends Addon {
|
||||
// Register commands - run one tick later to allow all addons to load
|
||||
// AcidIsland hook in
|
||||
getServer().getScheduler().runTask(getPlugin(), () -> {
|
||||
|
||||
this.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().getAddonByName("BSkyBlock").ifPresent(a -> {
|
||||
@ -57,10 +59,18 @@ public class ChallengesAddon extends Addon {
|
||||
new ChallengesCommand(this, bsbIslandCmd);
|
||||
CompositeCommand bsbAdminCmd = getPlugin().getCommandsManager().getCommand("bsbadmin");
|
||||
new Challenges(this, bsbAdminCmd);
|
||||
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!");
|
||||
}
|
||||
// Try to find Level addon and if it does not exist, display a warning
|
||||
if (!getAddonByName("Level").isPresent()) {
|
||||
logWarning("Level add-on not found so level challenges will not work!");
|
||||
}
|
||||
// Done
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ public class TryToComplete {
|
||||
|
||||
private ChallengeResult checkLevel() {
|
||||
// Check if the level addon is installed or not
|
||||
long level = addon.getAddonByName("BentoBox-Level")
|
||||
long level = addon.getAddonByName("Level")
|
||||
.map(l -> ((Level)l).getIslandLevel(world, user.getUniqueId())).orElse(0L);
|
||||
if (level >= challenge.getReqIslandlevel()) {
|
||||
return new ChallengeResult().setMeetsRequirements();
|
||||
|
@ -4,7 +4,7 @@ version: ${version}
|
||||
|
||||
authors: tastybento
|
||||
|
||||
softdepend: AcidIsland, BSkyBlock
|
||||
softdepend: AcidIsland, BSkyBlock, Level
|
||||
|
||||
permissions:
|
||||
bskyblock.challenges:
|
||||
|
Loading…
Reference in New Issue
Block a user