update to Paper 1.21.8 (Attribute.MAX_HEALTH rename)

This commit is contained in:
root
2026-09-30 05:26:00 +00:00
parent d2b26cccef
commit 536e0d4a4c
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ repositories {
}
dependencies {
compileOnly "io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT"
compileOnly "io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT"
}
tasks.withType(JavaCompile).configureEach {
@@ -172,7 +172,7 @@ public class MagicListener implements Listener {
private boolean castPrayer(Player p, TensionManager tm) {
double cur = p.getHealth();
double heal = cur * 0.25;
double max = p.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue();
double max = p.getAttribute(org.bukkit.attribute.Attribute.MAX_HEALTH).getValue();
p.setHealth(Math.min(max, cur + heal));
p.getWorld().spawnParticle(Particle.HEART, p.getLocation().add(0,1,0), 6, 0.4,0.5,0.4,0.1);
p.getWorld().spawnParticle(Particle.SCULK_SOUL, p.getLocation().add(0,1,0), 10, 0.4,0.4,0.4,0.05);
@@ -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) {}