mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
RedisEconomy compatibility
This commit is contained in:
1 parent
dc099b84fc
commit
69e1a5e083
6 files changed
+39
-4
No files matched your search
@@ -5,6 +5,7 @@ dependencies {
|
||||
implementation 'io.papermc:paperlib:1.0.7'
|
||||
implementation 'me.lucko:commodore:2.2'
|
||||
implementation 'net.kyori:adventure-platform-bukkit:4.1.2'
|
||||
implementation 'com.github.Emibergo02:RedisEconomy:master-SNAPSHOT'
|
||||
|
||||
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
|
||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||
@@ -43,6 +44,7 @@ shadowJar {
|
||||
relocate 'org.yaml.snakeyaml', 'net.william278.huskhomes.libraries.snakeyaml'
|
||||
relocate 'com.google.gson', 'net.william278.huskhomes.libraries.gson'
|
||||
relocate 'net.kyori', 'net.william278.huskhomes.libraries'
|
||||
relocate 'com.github.Emibergo02', 'net.william278.huskhomes.libraries'
|
||||
|
||||
relocate 'org.bstats', 'net.william278.huskhomes.libraries.bstats'
|
||||
relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib'
|
||||
|
||||
@@ -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)");
|
||||
|
||||
@@ -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.currency")
|
||||
public String currencyName="vault";
|
||||
|
||||
@YamlKey("economy.free_home_slots")
|
||||
public int freeHomeSlots = 5;
|
||||
|
||||
|
||||
Reference in new issue
Block a user