update to Paper 1.21.8 (Attribute.MAX_HEALTH rename)
This commit is contained in:
@@ -53,7 +53,7 @@ public class SwoonHandler implements Listener {
|
||||
e.setCancelled(true);
|
||||
plugin.getTension().setTP(p, Math.max(0, plugin.getTension().getTP(p) - 125f));
|
||||
if (target instanceof Player tp) {
|
||||
var attr = tp.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH);
|
||||
var attr = tp.getAttribute(org.bukkit.attribute.Attribute.MAX_HEALTH);
|
||||
double maxHp = attr != null ? attr.getValue() : 20.0;
|
||||
double vhpTmp = tp.getHealth() - 999;
|
||||
double vhp = Math.max(-2147483648.0, Math.min(maxHp, vhpTmp));
|
||||
@@ -134,7 +134,7 @@ public class SwoonHandler implements Listener {
|
||||
Double vhp = p.getPersistentDataContainer().get(VHP, PersistentDataType.DOUBLE);
|
||||
if (vhp == null) vhp = -10.0;
|
||||
double newVhp = vhp + heal;
|
||||
var attr = p.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH);
|
||||
var attr = p.getAttribute(org.bukkit.attribute.Attribute.MAX_HEALTH);
|
||||
double maxHp = attr != null ? attr.getValue() : 20.0;
|
||||
newVhp = Math.min(maxHp, newVhp);
|
||||
p.getPersistentDataContainer().set(VHP, PersistentDataType.DOUBLE, newVhp);
|
||||
@@ -191,7 +191,7 @@ public class SwoonHandler implements Listener {
|
||||
Double stored = p.getPersistentDataContainer().get(VHP, PersistentDataType.DOUBLE);
|
||||
p.getPersistentDataContainer().remove(SWOONED);
|
||||
p.getPersistentDataContainer().remove(VHP);
|
||||
var attr = p.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH);
|
||||
var attr = p.getAttribute(org.bukkit.attribute.Attribute.MAX_HEALTH);
|
||||
double maxHp = attr != null ? attr.getValue() : 20.0;
|
||||
double hp = stored != null ? Math.min(Math.max(stored, 1.0), maxHp) : 1.0;
|
||||
try { p.setHealth(hp); } catch (Exception ignored) {}
|
||||
|
||||
Reference in New Issue
Block a user