mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Merge pull request #259 from Emibergo02/rediseconomy
This commit is contained in:
6 files changed
+38
-3
No files matched your search
@@ -15,6 +15,7 @@ dependencies {
|
||||
compileOnly 'net.william278:Annotaml:2.0'
|
||||
compileOnly 'net.william278:DesertWell:1.1'
|
||||
compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1'
|
||||
compileOnly 'com.github.Emibergo02:RedisEconomy:2.1-SNAPSHOT'
|
||||
compileOnly 'us.dynmap:dynmap-api:3.1'
|
||||
|
||||
testImplementation 'com.github.seeseemelk:MockBukkit-v1.16:1.5.2'
|
||||
|
||||
@@ -174,8 +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) {
|
||||
|
||||
@@ -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().redisEconomyName);
|
||||
if (economy != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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)");
|
||||
|
||||
@@ -7,6 +7,7 @@ version: '${version}'
|
||||
api-version: 1.16
|
||||
softdepend:
|
||||
- Vault
|
||||
- RedisEconomy
|
||||
- dynmap
|
||||
- BlueMap
|
||||
- Plan
|
||||
|
||||
@@ -215,6 +215,10 @@ public class Settings {
|
||||
@YamlKey("economy.enabled")
|
||||
public boolean economy = false;
|
||||
|
||||
@YamlComment("Use this currency for payments (works only with RedisEconomy), defaults to Vault currency")
|
||||
@YamlKey("economy.redis_economy_name")
|
||||
public String redisEconomyName = "vault";
|
||||
|
||||
@YamlKey("economy.free_home_slots")
|
||||
public int freeHomeSlots = 5;
|
||||
|
||||
|
||||
Reference in new issue
Block a user