9
0
mirror of https://github.com/Auxilor/Reforges.git synced 2025-12-28 11:29:20 +00:00

Minor internal changes

This commit is contained in:
Auxilor
2021-10-27 19:02:53 +01:00
parent dfdac65526
commit 42aa948d0b
9 changed files with 17 additions and 18 deletions

View File

@@ -129,11 +129,11 @@ public class ReforgesPlugin extends EcoPlugin {
@Override
protected List<IntegrationLoader> loadIntegrationLoaders() {
return Arrays.asList(
new IntegrationLoader("UltimateSkills", UltimateSkillsIntegration.INSTANCE::load),
new IntegrationLoader("EcoSkills", EcoSkillsIntegration.INSTANCE::load),
new IntegrationLoader("Talismans", TalismansIntegration.INSTANCE::registerProvider),
new IntegrationLoader("UltimateSkills", UltimateSkillsIntegration::load),
new IntegrationLoader("EcoSkills", EcoSkillsIntegration::load),
new IntegrationLoader("Talismans", TalismansIntegration::registerProvider),
new IntegrationLoader("PlayerPoints", () -> EconomyHandler.setUsePlayerPoints(true)),
new IntegrationLoader("AureliumSkills", AureliumSkillsIntegration.INSTANCE::load)
new IntegrationLoader("AureliumSkills", AureliumSkillsIntegration::load)
);
}

View File

@@ -65,7 +65,7 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
cost = reforge.getStonePrice();
}
if (!EconomyHandler.getInstance().has(player, cost)) {
if (!EconomyHandler.has(player, cost)) {
player.sendMessage(this.getPlugin().getLangYml().getMessage("insufficient-money"));
player.playSound(

View File

@@ -10,8 +10,6 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
@UtilityClass
public final class EconomyHandler {
@@ -44,7 +42,14 @@ public final class EconomyHandler {
return EconomyHandler.instance;
}
public static boolean has(Player player, double amount) {
/**
* Get if a player has a specified amount.
*
* @param player The player.
* @param amount The amount.
* @return If a player has the amount.
*/
public static boolean has(Player player, double amount) {
if (usePlayerPoints && ReforgesPlugin.getInstance().getConfigYml().getBool("reforge.use-player-points")) {
try {
return PlayerPoints.getInstance().getAPI().lookAsync(player.getUniqueId()).get() >= amount;
@@ -53,7 +58,6 @@ public final class EconomyHandler {
}
}
return getInstance().has(player, amount);
}
public static boolean isEnabled() {

View File

@@ -6,6 +6,7 @@ import com.willfp.reforges.effects.Effect
object AureliumSkillsIntegration : Integration {
private lateinit var ADD_STAT: Effect
@JvmStatic
fun load() {
ADD_STAT = EffectAddStat()
}

View File

@@ -6,6 +6,7 @@ import com.willfp.reforges.effects.Effect
object EcoSkillsIntegration : Integration {
private lateinit var ADD_STAT: Effect
@JvmStatic
fun load() {
ADD_STAT = EffectAddStat()
}

View File

@@ -7,6 +7,7 @@ import com.willfp.talismans.talismans.util.TalismanChecks
import org.bukkit.inventory.ItemStack
object TalismansIntegration : Integration {
@JvmStatic
fun registerProvider() {
ReforgeLookup.registerProvider { player ->
val provided = mutableMapOf<ItemStack, ReforgeTarget.Slot>()

View File

@@ -6,12 +6,10 @@ import com.willfp.reforges.ReforgesPlugin
import com.willfp.reforges.effects.Effect
import mc.ultimatecore.skills.HyperSkills
import mc.ultimatecore.skills.objects.abilities.Ability
import mc.ultimatecore.skills.objects.perks.Perk
import org.bukkit.entity.Player
import org.bukkit.persistence.PersistentDataType
class EffectAddAbility : Effect("add_ultimateskills_ability") {
override fun handleEnable(
player: Player,
config: JSONConfig
@@ -37,5 +35,4 @@ class EffectAddAbility : Effect("add_ultimateskills_ability") {
)
}
}
}

View File

@@ -1,20 +1,15 @@
package com.willfp.reforges.integrations.ultimateskills
import com.archyx.aureliumskills.api.AureliumAPI
import com.archyx.aureliumskills.stats.Stats
import com.willfp.eco.core.config.interfaces.JSONConfig
import com.willfp.eco.util.NumberUtils
import com.willfp.reforges.ReforgesPlugin
import com.willfp.reforges.effects.Effect
import com.willfp.reforges.effects.getEffectAmount
import mc.ultimatecore.skills.HyperSkills
import mc.ultimatecore.skills.api.HyperSkillsAPI
import mc.ultimatecore.skills.objects.perks.Perk
import org.bukkit.entity.Player
import org.bukkit.persistence.PersistentDataType
class EffectAddPerk : Effect("add_ultimateskills_perk") {
override fun handleEnable(
player: Player,
config: JSONConfig
@@ -39,5 +34,4 @@ class EffectAddPerk : Effect("add_ultimateskills_perk") {
)
}
}
}

View File

@@ -7,6 +7,7 @@ object UltimateSkillsIntegration : Integration {
private lateinit var ADD_PERK: Effect
private lateinit var ADD_ABILITY: Effect
@JvmStatic
fun load() {
ADD_PERK = EffectAddPerk()
ADD_ABILITY = EffectAddAbility()