mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
RedisEconomy compatibility
This commit is contained in:
1 parent
dc099b84fc
commit
69e1a5e083
6 files changed
+39
-4
No files matched your search
@@ -174,9 +174,12 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes {
|
||||
|
||||
// Register plugin hooks (Economy, Maps, Plan)
|
||||
this.pluginHooks = new HashSet<>();
|
||||
if (settings.economy && Bukkit.getPluginManager().getPlugin("Vault") != null) {
|
||||
pluginHooks.add(new VaultEconomyHook(this));
|
||||
}
|
||||
if(settings.economy)
|
||||
if (Bukkit.getPluginManager().getPlugin("RedisEconomy") != null) {
|
||||
pluginHooks.add(new RedisEconomyHook(this));
|
||||
}else if (Bukkit.getPluginManager().getPlugin("Vault") != null) {
|
||||
pluginHooks.add(new VaultEconomyHook(this));
|
||||
}
|
||||
if (settings.doMapHook) {
|
||||
switch (settings.mappingPlugin) {
|
||||
case DYNMAP -> {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package net.william278.huskhomes.hook;
|
||||
|
||||
import dev.unnm3d.rediseconomy.api.RedisEconomyAPI;
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.HuskHomesInitializationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RedisEconomyHook extends VaultEconomyHook {
|
||||
|
||||
|
||||
public RedisEconomyHook(@NotNull HuskHomes implementor) {
|
||||
super(implementor);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean initialize() throws HuskHomesInitializationException {
|
||||
RedisEconomyAPI api=RedisEconomyAPI.getAPI();
|
||||
if(api!=null){
|
||||
economy=api.getCurrencyByName(plugin.getSettings().currencyName);
|
||||
return true;
|
||||
}else
|
||||
return super.initialize();
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class VaultEconomyHook extends EconomyHook {
|
||||
|
||||
private Economy economy;
|
||||
protected Economy economy;
|
||||
|
||||
public VaultEconomyHook(@NotNull HuskHomes implementor) {
|
||||
super(implementor, "Vault (Economy)");
|
||||
|
||||
Reference in new issue
Block a user