From 2496f318fa08885de99d33cba55980eb0bf2ba9f Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 4 Nov 2022 13:57:16 +0000 Subject: [PATCH] Removed health-fixer --- .../eco/internal/spigot/EcoSpigotPlugin.kt | 2 - .../spigot/player/PlayerHealthFixer.kt | 42 ------------------- .../core-plugin/src/main/resources/config.yml | 3 -- 3 files changed, 47 deletions(-) delete mode 100644 eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/player/PlayerHealthFixer.kt diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt index a426896d..50b603b0 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt @@ -118,7 +118,6 @@ import com.willfp.eco.internal.spigot.integrations.shop.ShopDeluxeSellwands import com.willfp.eco.internal.spigot.integrations.shop.ShopEconomyShopGUI import com.willfp.eco.internal.spigot.integrations.shop.ShopShopGuiPlus import com.willfp.eco.internal.spigot.integrations.shop.ShopZShop -import com.willfp.eco.internal.spigot.player.PlayerHealthFixer import com.willfp.eco.internal.spigot.proxy.FastItemStackFactoryProxy import com.willfp.eco.internal.spigot.recipes.CraftingRecipeListener import com.willfp.eco.internal.spigot.recipes.StackedRecipeListener @@ -369,7 +368,6 @@ abstract class EcoSpigotPlugin : EcoPlugin() { ArmorChangeEventListeners(this), DataListener(this), PlayerBlockListener(this), - PlayerHealthFixer(this), ServerLocking ) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/player/PlayerHealthFixer.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/player/PlayerHealthFixer.kt deleted file mode 100644 index f78569e1..00000000 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/player/PlayerHealthFixer.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.willfp.eco.internal.spigot.player - -import com.willfp.eco.core.EcoPlugin -import com.willfp.eco.core.data.keys.PersistentDataKey -import com.willfp.eco.core.data.keys.PersistentDataKeyType -import com.willfp.eco.core.data.profile -import org.bukkit.event.EventHandler -import org.bukkit.event.Listener -import org.bukkit.event.player.PlayerJoinEvent -import org.bukkit.event.player.PlayerQuitEvent - -class PlayerHealthFixer( - private val plugin: EcoPlugin -): Listener { - private val lastHealthKey = PersistentDataKey( - plugin.createNamespacedKey("last_health"), - PersistentDataKeyType.DOUBLE, - 0.0 - ) - - @EventHandler - fun onLeave(event: PlayerQuitEvent) { - if (!plugin.configYml.getBool("health-fixer")) { - return - } - - val player = event.player - player.profile.write(lastHealthKey, player.health) - } - - @EventHandler - fun onJoin(event: PlayerJoinEvent) { - if (!plugin.configYml.getBool("health-fixer")) { - return - } - - val player = event.player - plugin.scheduler.runLater(2) { - player.health = player.profile.read(lastHealthKey) - } - } -} diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index 1c853e96..6097911e 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -73,9 +73,6 @@ log-full-extension-errors: false # a custom crafting table, though, this won't affect anything, and you should disable the option. displayed-recipes: true -# Save health on leave and set it back on join - works around attribute modifiers. -health-fixer: false - # If eco plugins should not check for updates; only enable this if you know what you're doing # as there can be urgent hotfixes that you are then not notified about. If you're confident # that you can manage updates on your own, turn this on.