Merge PR #596 from PyvesB/aach to 4.3.3

* Updated hook to use new Advanced Achievements API Maven artifact

* Removed spurious tab
This commit is contained in:
Pyves 2018-06-02 10:32:57 +01:00 committed by Rsl1122
parent bd06c709f8
commit 3412968039
2 changed files with 13 additions and 10 deletions

View File

@ -69,6 +69,10 @@
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>advanced-achievements-repo</id>
<url>https://raw.github.com/PyvesB/AdvancedAchievements/mvn-repo/</url>
</repository>
</repositories>
<dependencies>
@ -94,9 +98,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.hm</groupId>
<artifactId>advanced.achievements</artifactId>
<version>5.2</version>
<groupId>com.hm.achievement</groupId>
<artifactId>advanced-achievements-api</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -2,11 +2,10 @@ package com.djrapitops.pluginbridge.plan.advancedachievements;
import com.djrapitops.plan.data.plugin.HookHandler;
import com.djrapitops.pluginbridge.plan.Hook;
import com.hm.achievement.AdvancedAchievements;
import com.hm.achievement.api.AdvancedAchievementsAPI;
import com.hm.achievement.api.AdvancedAchievementsBukkitAPI;
import com.hm.achievement.api.AdvancedAchievementsAPIFetcher;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
import java.util.Optional;
/**
* A Class responsible for hooking to AdvancedAchievements and registering 2
@ -29,12 +28,12 @@ public class AdvancedAchievementsHook extends Hook {
super("com.hm.achievement.AdvancedAchievements", hookH);
}
@Override
public void hook() throws NoClassDefFoundError {
if (enabled) {
AdvancedAchievements aa = getPlugin(AdvancedAchievements.class);
if (Integer.parseInt(Character.toString(aa.getDescription().getVersion().charAt(0))) >= 5) {
AdvancedAchievementsAPI aaAPI = AdvancedAchievementsBukkitAPI.linkAdvancedAchievements();
addPluginDataSource(new AdvancedAchievementsData(aaAPI));
Optional<AdvancedAchievementsAPI> aaAPI = AdvancedAchievementsAPIFetcher.fetchInstance();
if (aaAPI.isPresent()) {
addPluginDataSource(new AdvancedAchievementsData(aaAPI.get()));
} else {
enabled = false;
}