Skip to content

Commit

Permalink
v7.3.57 - add AuraSkill support
Browse files Browse the repository at this point in the history
  • Loading branch information
slipcor committed Aug 1, 2024
1 parent a360cce commit 10682ec
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## v7.3 - API Expansion

- v7.3.57 - add AuraSkill support
- v7.3.56 - drop items if the auto adding did not fit - defaults to false for backwards compatibility!
- v7.3.55 - clarify debug for custom drops deny reason
- v7.3.54 - fix a diagonal loop determination issue resulting in false negative tree validity checks
Expand Down
Binary file added lib/AuraSkills-2.2.1.jar
Binary file not shown.
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/AureliumSkills-Beta1.2.11.jar</systemPath>
</dependency>
<dependency>
<groupId>dev.aurelium</groupId>
<artifactId>auraskills</artifactId>
<version>2.2.1</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/lib/AuraSkills-2.2.1.jar</systemPath>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ It also will take down an entire tree when it is enabled in the config.

## Changelog

- v7.3.56 - drop items if the auto adding did not fit - defaults to false for backwards compatibility!
- v7.3.57 - add AuraSkill support
- [read more](doc/changelog.md)

***
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/slipcor/treeassist/TreeAssist.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class TreeAssist extends CorePlugin {
public boolean mcMMO = false; // Whether mcMMO has been found and hooked into
public boolean jobs = false; // Whether Jobs has been found and hooked into
public boolean aurelium = false; // Whether AureliumSkills has been found and hooked into
public boolean auraskills = false; // Whether AuraSkills has been found and hooked into
public boolean makeEvents = false;

private File configFile;
Expand Down Expand Up @@ -105,8 +106,10 @@ public class TreeAssist extends CorePlugin {
private void checkAureliumSkills() {
if (config.getBoolean(MainConfig.CFG.PLUGINS_USE_AURELIUMSKILLS)) {
this.aurelium = getServer().getPluginManager().isPluginEnabled("AureliumSkills");
this.auraskills = getServer().getPluginManager().isPluginEnabled("AuraSkills");
} else {
this.aurelium = false;
this.auraskills = false;
}
}

Expand Down
21 changes: 21 additions & 0 deletions src/main/java/net/slipcor/treeassist/externals/AuraSkillsHook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.slipcor.treeassist.externals;

import dev.aurelium.auraskills.api.AuraSkillsApi;
import dev.aurelium.auraskills.api.skill.Skills;
import org.bukkit.entity.Player;

/**
* Hook into AureliumSkills, giving EXP
*/
public class AuraSkillsHook {

/**
* Add Aurelium Skills EXP
*
* @param player the player who should gain the EXP
* @param value the EXP amount to give
*/
public static void addAuraExp(Player player, Double value) {
AuraSkillsApi.get().getUserManager().getUser(player.getUniqueId()).addSkillXp(Skills.FORAGING, value);
}
}
23 changes: 23 additions & 0 deletions src/main/java/net/slipcor/treeassist/utils/BlockUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.slipcor.treeassist.discovery.LeavesStructure;
import net.slipcor.treeassist.discovery.TreeStructure;
import net.slipcor.treeassist.events.TALeafDecay;
import net.slipcor.treeassist.externals.AuraSkillsHook;
import net.slipcor.treeassist.externals.AureliumSkillsHook;
import net.slipcor.treeassist.externals.JobsHook;
import net.slipcor.treeassist.externals.mcMMOHook;
Expand Down Expand Up @@ -348,6 +349,28 @@ public static void callExternals(Block block, Player player, boolean fullTree) {
}
}
}
if (TreeAssist.instance.auraskills) {

if (fullTree) {
double value = TreeAssist.instance.config().getDouble(MainConfig.CFG.PLUGINS_USE_AURELIUMSKILLS_TREE);

if (value > 0) {
TreeStructure.debug.i("Adding AuraSkills Tree EXP!");
AuraSkillsHook.addAuraExp(player, value);
} else {
TreeStructure.debug.i("AuraSkills selected but no exp amount given?!");
}
} else {
double value = TreeAssist.instance.config().getDouble(MainConfig.CFG.PLUGINS_USE_AURELIUMSKILLS_BLOCK);

if (value > 0) {
TreeStructure.debug.i("Adding AuraSkills Block EXP!");
AuraSkillsHook.addAuraExp(player, value);
} else {
TreeStructure.debug.i("AuraSkills selected but no exp amount given?!");
}
}
}
if (TreeAssist.instance.mcMMO &&
(fullTree == TreeAssist.instance.config().getBoolean(MainConfig.CFG.PLUGINS_USE_TREEMCMMO))) {
TreeStructure.debug.i("Adding mcMMO EXP!");
Expand Down

0 comments on commit 10682ec

Please sign in to comment.