Removed health-fixer
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user