mirror of
https://github.com/Auxilor/Reforges.git
synced 2025-12-22 08:29:34 +00:00
Updated to 3.7.3 and eco 6.12.2
This commit is contained in:
@@ -38,8 +38,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'org.black_ixx:playerpoints:3.0.0'
|
compileOnly 'com.willfp:eco:6.12.2'
|
||||||
compileOnly 'com.willfp:eco:6.9.0'
|
|
||||||
|
|
||||||
compileOnly 'org.jetbrains:annotations:19.0.0'
|
compileOnly 'org.jetbrains:annotations:19.0.0'
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ dependencies {
|
|||||||
compileOnly 'com.willfp:EcoSkills:1.4.0'
|
compileOnly 'com.willfp:EcoSkills:1.4.0'
|
||||||
compileOnly 'com.willfp:Talismans:4.6.0'
|
compileOnly 'com.willfp:Talismans:4.6.0'
|
||||||
compileOnly 'com.github.Archy-X:AureliumSkills:Beta1.2.4'
|
compileOnly 'com.github.Archy-X:AureliumSkills:Beta1.2.4'
|
||||||
compileOnly 'org.black_ixx:playerpoints:3.0.0'
|
|
||||||
compileOnly fileTree(dir: '../../lib', include: ['*.jar'])
|
compileOnly fileTree(dir: '../../lib', include: ['*.jar'])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.willfp.reforges.reforges.util.ReforgeLookup;
|
|||||||
import com.willfp.reforges.reforges.util.WatcherTriggers;
|
import com.willfp.reforges.reforges.util.WatcherTriggers;
|
||||||
import com.willfp.reforges.util.AntiPlaceListener;
|
import com.willfp.reforges.util.AntiPlaceListener;
|
||||||
import com.willfp.reforges.util.DiscoverRecipeListener;
|
import com.willfp.reforges.util.DiscoverRecipeListener;
|
||||||
import com.willfp.reforges.vault.EconomyHandler;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -80,15 +79,6 @@ public class ReforgesPlugin extends EcoPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void handleAfterLoad() {
|
|
||||||
EconomyHandler.setEnabled(EconomyHandler.init());
|
|
||||||
|
|
||||||
if (!EconomyHandler.isEnabled()) {
|
|
||||||
this.getLogger().severe("Vault economy support not enabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleReload() {
|
protected void handleReload() {
|
||||||
for (Effect effect : Effects.values()) {
|
for (Effect effect : Effects.values()) {
|
||||||
@@ -132,14 +122,13 @@ public class ReforgesPlugin extends EcoPlugin {
|
|||||||
new IntegrationLoader("UltimateCore-Skills", UltimateSkillsIntegration::load),
|
new IntegrationLoader("UltimateCore-Skills", UltimateSkillsIntegration::load),
|
||||||
new IntegrationLoader("EcoSkills", EcoSkillsIntegration::load),
|
new IntegrationLoader("EcoSkills", EcoSkillsIntegration::load),
|
||||||
new IntegrationLoader("Talismans", TalismansIntegration::registerProvider),
|
new IntegrationLoader("Talismans", TalismansIntegration::registerProvider),
|
||||||
new IntegrationLoader("PlayerPoints", () -> EconomyHandler.setUsePlayerPoints(true)),
|
|
||||||
new IntegrationLoader("AureliumSkills", AureliumSkillsIntegration::load)
|
new IntegrationLoader("AureliumSkills", AureliumSkillsIntegration::load)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMinimumEcoVersion() {
|
public String getMinimumEcoVersion() {
|
||||||
return "6.9.0";
|
return "6.12.2";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import com.willfp.eco.core.EcoPlugin;
|
|||||||
import com.willfp.eco.core.PluginDependent;
|
import com.willfp.eco.core.PluginDependent;
|
||||||
import com.willfp.eco.core.gui.menu.Menu;
|
import com.willfp.eco.core.gui.menu.Menu;
|
||||||
import com.willfp.eco.core.gui.slot.Slot;
|
import com.willfp.eco.core.gui.slot.Slot;
|
||||||
|
import com.willfp.eco.core.integrations.economy.EconomyManager;
|
||||||
import com.willfp.reforges.reforges.Reforge;
|
import com.willfp.reforges.reforges.Reforge;
|
||||||
import com.willfp.reforges.reforges.meta.ReforgeTarget;
|
import com.willfp.reforges.reforges.meta.ReforgeTarget;
|
||||||
import com.willfp.reforges.vault.EconomyHandler;
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
@@ -58,7 +58,7 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double cost = 0;
|
double cost = 0;
|
||||||
if (EconomyHandler.isEnabled()) {
|
if (EconomyManager.hasRegistrations()) {
|
||||||
cost = this.getPlugin().getConfigYml().getDouble("reforge.cost");
|
cost = this.getPlugin().getConfigYml().getDouble("reforge.cost");
|
||||||
int reforges = ReforgeUtils.getReforges(toReforge);
|
int reforges = ReforgeUtils.getReforges(toReforge);
|
||||||
cost *= Math.pow(this.getPlugin().getConfigYml().getDouble("reforge.cost-exponent"), reforges);
|
cost *= Math.pow(this.getPlugin().getConfigYml().getDouble("reforge.cost-exponent"), reforges);
|
||||||
@@ -66,7 +66,7 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
|||||||
cost = reforge.getStonePrice();
|
cost = reforge.getStonePrice();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EconomyHandler.has(player, cost)) {
|
if (!EconomyManager.hasAmount(player, cost)) {
|
||||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("insufficient-money"));
|
player.sendMessage(this.getPlugin().getLangYml().getMessage("insufficient-money"));
|
||||||
|
|
||||||
player.playSound(
|
player.playSound(
|
||||||
@@ -96,8 +96,8 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EconomyHandler.isEnabled()) {
|
if (EconomyManager.hasRegistrations()) {
|
||||||
EconomyHandler.getInstance().withdrawPlayer(player, cost);
|
EconomyManager.removeMoney(player, cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setLevel(player.getLevel() - xpCost);
|
player.setLevel(player.getLevel() - xpCost);
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
package com.willfp.reforges.vault;
|
|
||||||
|
|
||||||
import com.willfp.reforges.ReforgesPlugin;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.experimental.UtilityClass;
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
|
||||||
import org.black_ixx.playerpoints.PlayerPoints;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
@UtilityClass
|
|
||||||
public final class EconomyHandler {
|
|
||||||
/**
|
|
||||||
* The instance.
|
|
||||||
*/
|
|
||||||
private static Economy instance = null;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private static boolean usePlayerPoints = false;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private static boolean enabled = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the economy manager.
|
|
||||||
*
|
|
||||||
* @return If was successful.
|
|
||||||
*/
|
|
||||||
public static boolean init() {
|
|
||||||
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
|
||||||
if (rsp == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
instance = rsp.getProvider();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Economy getInstance() {
|
|
||||||
return EconomyHandler.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
} catch (ExecutionException | InterruptedException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getInstance().has(player, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
|
||||||
return EconomyHandler.enabled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
version = 3.7.2
|
version = 3.7.3
|
||||||
plugin-name = Reforges
|
plugin-name = Reforges
|
||||||
Reference in New Issue
Block a user