From 377e46ff92a59419d002e1c56f8179c3036c3650 Mon Sep 17 00:00:00 2001 From: William Date: Wed, 28 Jun 2023 12:29:17 +0100 Subject: [PATCH] Remove RedisEconomy hook due to instability (#447) --- bukkit/build.gradle | 1 - .../william278/huskhomes/BukkitHuskHomes.java | 9 +--- .../huskhomes/hook/RedisEconomyHook.java | 43 ------------------- bukkit/src/main/resources/plugin.yml | 17 ++++---- .../william278/huskhomes/config/Settings.java | 8 ---- .../huskhomes/util/TransactionResolver.java | 1 - docs/Config-Files.md | 2 - docs/Economy-Hook.md | 2 +- paper/build.gradle | 1 - paper/src/main/resources/paper-plugin.yml | 4 -- 10 files changed, 11 insertions(+), 77 deletions(-) delete mode 100644 bukkit/src/main/java/net/william278/huskhomes/hook/RedisEconomyHook.java diff --git a/bukkit/build.gradle b/bukkit/build.gradle index 9f948489..a556ee12 100644 --- a/bukkit/build.gradle +++ b/bukkit/build.gradle @@ -13,7 +13,6 @@ dependencies { compileOnly 'net.william278:Annotaml:2.0.1' compileOnly 'net.william278:DesertWell:2.0.4' compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1' - compileOnly 'com.github.Emibergo02:RedisEconomy:3.4-SNAPSHOT' compileOnly 'me.clip:placeholderapi:2.11.3' compileOnly 'net.essentialsx:EssentialsX:2.20.0' diff --git a/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java b/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java index 22d3cecd..9c66e661 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java +++ b/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java @@ -35,7 +35,6 @@ import net.william278.huskhomes.database.SqLiteDatabase; import net.william278.huskhomes.event.BukkitEventDispatcher; import net.william278.huskhomes.hook.Hook; import net.william278.huskhomes.hook.PlaceholderAPIHook; -import net.william278.huskhomes.hook.RedisEconomyHook; import net.william278.huskhomes.hook.VaultEconomyHook; import net.william278.huskhomes.importer.EssentialsXImporter; import net.william278.huskhomes.listener.BukkitEventListener; @@ -218,12 +217,8 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes, BukkitTask HuskHomes.super.registerHooks(); // Hooks - if (getSettings().doEconomy()) { - if (isDependencyLoaded("RedisEconomy")) { - getHooks().add(new RedisEconomyHook(this)); - } else if (isDependencyLoaded("Vault")) { - getHooks().add(new VaultEconomyHook(this)); - } + if (getSettings().doEconomy() && isDependencyLoaded("Vault")) { + getHooks().add(new VaultEconomyHook(this)); } if (isDependencyLoaded("PlaceholderAPI")) { getHooks().add(new PlaceholderAPIHook(this)); diff --git a/bukkit/src/main/java/net/william278/huskhomes/hook/RedisEconomyHook.java b/bukkit/src/main/java/net/william278/huskhomes/hook/RedisEconomyHook.java deleted file mode 100644 index 0c48b93c..00000000 --- a/bukkit/src/main/java/net/william278/huskhomes/hook/RedisEconomyHook.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of HuskHomes, licensed under the Apache License 2.0. - * - * Copyright (c) William278 - * Copyright (c) contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.william278.huskhomes.hook; - -import dev.unnm3d.rediseconomy.api.RedisEconomyAPI; -import net.william278.huskhomes.HuskHomes; -import org.jetbrains.annotations.NotNull; - -public class RedisEconomyHook extends VaultEconomyHook { - - public RedisEconomyHook(@NotNull HuskHomes plugin) { - super(plugin); - } - - @Override - public void initialize() { - RedisEconomyAPI api = RedisEconomyAPI.getAPI(); - if (api != null && !plugin.getSettings().getRedisEconomyName().equalsIgnoreCase("vault")) { - economy = api.getCurrencyByName(plugin.getSettings().getRedisEconomyName()); - if (economy != null) { - return; - } - } - super.initialize(); - } -} diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 15dc6e48..4fc5e7fb 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -7,7 +7,6 @@ version: '${version}' api-version: '1.16' softdepend: - Vault - - RedisEconomy - PlaceholderAPI - dynmap - BlueMap @@ -25,44 +24,44 @@ commands: usage: / homelist: usage: / [player] [page] - aliases: [homes] + aliases: [ homes ] delhome: usage: / edithome: usage: / [rename|description|relocate|privacy] [args] phome: usage: / [.] - aliases: [publichome] + aliases: [ publichome ] phomelist: usage: / [page] - aliases: [publichomelist, phomes] + aliases: [ publichomelist, phomes ] warp: usage: / setwarp: usage: / warplist: usage: / [page] - aliases: [warps] + aliases: [ warps ] delwarp: usage: / editwarp: usage: / [rename|description|relocate] [args] tp: usage: / [destination] - aliases: [tpo] + aliases: [ tpo ] tphere: usage: / - aliases: [tpohere] + aliases: [ tpohere ] tpa: usage: / tpahere: usage: / tpaccept: usage: / [player] - aliases: [tpyes] + aliases: [ tpyes ] tpdecline: usage: / [player] - aliases: [tpdeny, tpno] + aliases: [ tpdeny, tpno ] rtp: usage: / [player] [world] tpignore: diff --git a/common/src/main/java/net/william278/huskhomes/config/Settings.java b/common/src/main/java/net/william278/huskhomes/config/Settings.java index 50e35462..c87426e8 100644 --- a/common/src/main/java/net/william278/huskhomes/config/Settings.java +++ b/common/src/main/java/net/william278/huskhomes/config/Settings.java @@ -271,10 +271,6 @@ public class Settings { @YamlKey("economy.enabled") private boolean economy = false; - @YamlComment("Use this currency for payments (works only with RedisEconomy), defaults to Vault currency") - @YamlKey("economy.redis_economy_name") - private String redisEconomyName = "vault"; - @YamlComment("Specify how many homes players can set for free, before they need to pay for more slots") @YamlKey("economy.free_home_slots") private int freeHomeSlots = 5; @@ -536,10 +532,6 @@ public class Settings { return economy; } - public String getRedisEconomyName() { - return redisEconomyName; - } - public int getFreeHomeSlots() { return freeHomeSlots; } diff --git a/common/src/main/java/net/william278/huskhomes/util/TransactionResolver.java b/common/src/main/java/net/william278/huskhomes/util/TransactionResolver.java index 1cbebe2c..145bc514 100644 --- a/common/src/main/java/net/william278/huskhomes/util/TransactionResolver.java +++ b/common/src/main/java/net/william278/huskhomes/util/TransactionResolver.java @@ -28,7 +28,6 @@ import java.time.Duration; import java.time.Instant; import java.util.Optional; import java.util.StringJoiner; -import java.util.logging.Level; /** * Class for validating and performing economy and cooldown transactions involving {@link Action}s diff --git a/docs/Config-Files.md b/docs/Config-Files.md index 65b826cc..e2a486f0 100644 --- a/docs/Config-Files.md +++ b/docs/Config-Files.md @@ -136,8 +136,6 @@ cooldowns: economy: # Enable economy plugin integration (requires Vault) enabled: false - # Use this currency for payments (works only with RedisEconomy), defaults to Vault currency - redis_economy_name: vault # Specify how many homes players can set for free, before they need to pay for more slots free_home_slots: 5 # Charge money for perform certain actions. Docs: https://william278.net/docs/huskhomes/economy-hook/ diff --git a/docs/Economy-Hook.md b/docs/Economy-Hook.md index f39d18dd..01ccd5f7 100644 --- a/docs/Economy-Hook.md +++ b/docs/Economy-Hook.md @@ -6,7 +6,7 @@ HuskHomes supports restricting certain actions behind an economic cost. Players > **Applies to:** Spigot, Paper -To enable the Economy Hook on Sponge server, install both [Vault](https://www.spigotmc.org/resources/vault.34315/) and a compatible economy plugin. Extended support for [RedisEconomy](https://github.com/Emibergo02/RedisEconomy) is also provided, and the `redis_economy_name` setting can be used to specify the currency to use for transactions. Then, set `enabled` to `true` under the `economy` section of [`config.yml`](config-files). +To enable the Economy Hook on Sponge server, install both [Vault](https://www.spigotmc.org/resources/vault.34315/) and a compatible economy plugin. Then, set `enabled` to `true` under the `economy` section of [`config.yml`](config-files).
diff --git a/paper/build.gradle b/paper/build.gradle index 3a074a23..66ccefe3 100644 --- a/paper/build.gradle +++ b/paper/build.gradle @@ -15,7 +15,6 @@ dependencies { compileOnly 'net.william278:DesertWell:2.0.4' compileOnly 'me.lucko:commodore:2.2' compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1' - compileOnly 'com.github.Emibergo02:RedisEconomy:3.4-SNAPSHOT' compileOnly 'me.clip:placeholderapi:2.11.3' } diff --git a/paper/src/main/resources/paper-plugin.yml b/paper/src/main/resources/paper-plugin.yml index fa8f4a3b..92e03012 100644 --- a/paper/src/main/resources/paper-plugin.yml +++ b/paper/src/main/resources/paper-plugin.yml @@ -13,10 +13,6 @@ dependencies: load: BEFORE required: false join-classpath: true - RedisEconomy: - load: BEFORE - required: false - join-classpath: true PlaceholderAPI: load: BEFORE required: false