From 904dc9e86e8d056b9f365604f359f9272c59de73 Mon Sep 17 00:00:00 2001 From: Chaosdave34 Date: Mon, 23 Dec 2024 18:08:27 +0100 Subject: [PATCH] Use primitive type for exhaustion and put nullable on same line in DamageTypeRegistryEntry --- .../registry/data/DamageTypeRegistryEntry.java | 10 ++++------ .../data/PaperDamageTypeRegistryEntry.java | 14 +++++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/paper-api/src/main/java/io/papermc/paper/registry/data/DamageTypeRegistryEntry.java b/paper-api/src/main/java/io/papermc/paper/registry/data/DamageTypeRegistryEntry.java index 51c27fa7fe..8564adf8b1 100644 --- a/paper-api/src/main/java/io/papermc/paper/registry/data/DamageTypeRegistryEntry.java +++ b/paper-api/src/main/java/io/papermc/paper/registry/data/DamageTypeRegistryEntry.java @@ -31,7 +31,7 @@ public interface DamageTypeRegistryEntry { * * @return the exhaustion */ - Float exhaustion(); + float exhaustion(); /** * Provides the {@link DamageScaling} for this damage type. @@ -45,16 +45,14 @@ public interface DamageTypeRegistryEntry { * * @return the damage effect */ - @Nullable - DamageEffect damageEffect(); + @Nullable DamageEffect damageEffect(); /** * Provides the {@link DeathMessageType} for this damage type. * * @return the death message type */ - @Nullable - DeathMessageType deathMessageType(); + @Nullable DeathMessageType deathMessageType(); @ApiStatus.Experimental @ApiStatus.NonExtendable @@ -77,7 +75,7 @@ public interface DamageTypeRegistryEntry { * @see DamageType#getExhaustion() */ @Contract(value = "_ -> this", mutates = "this") - Builder exhaustion(Float exhaustion); + Builder exhaustion(float exhaustion); /** * Sets the {@link DamageScaling} for this damage type. diff --git a/paper-server/src/main/java/io/papermc/paper/registry/data/PaperDamageTypeRegistryEntry.java b/paper-server/src/main/java/io/papermc/paper/registry/data/PaperDamageTypeRegistryEntry.java index e5271645ba..e35af60ff6 100644 --- a/paper-server/src/main/java/io/papermc/paper/registry/data/PaperDamageTypeRegistryEntry.java +++ b/paper-server/src/main/java/io/papermc/paper/registry/data/PaperDamageTypeRegistryEntry.java @@ -12,7 +12,7 @@ import static io.papermc.paper.registry.data.util.Checks.asConfigured; public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry { protected @Nullable String messageId; - protected @Nullable Float exhaustion; + protected float exhaustion; protected @Nullable DamageScaling damageScaling; protected @Nullable DamageEffects damageEffects; protected @Nullable DeathMessageType deathMessageType; @@ -39,8 +39,8 @@ public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry { } @Override - public Float exhaustion() { - return asConfigured(exhaustion, "exhaustion"); + public float exhaustion() { + return exhaustion; } @Override @@ -71,7 +71,7 @@ public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry { } @Override - public Builder exhaustion(Float exhaustion) { + public Builder exhaustion(float exhaustion) { this.exhaustion = exhaustion; return this; } @@ -100,20 +100,20 @@ public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry { return new DamageType( asConfigured(this.messageId, "messsageId"), asConfigured(this.damageScaling, "scaling"), - asConfigured(this.exhaustion, "exhaustion"), + this.exhaustion, this.damageEffects, this.deathMessageType); } else if (this.damageEffects != null) { return new DamageType( asConfigured(this.messageId, "messsageId"), asConfigured(this.damageScaling, "scaling"), - asConfigured(this.exhaustion, "exhaustion"), + this.exhaustion, this.damageEffects); } else { return new DamageType( asConfigured(this.messageId, "messsageId"), asConfigured(this.damageScaling, "scaling"), - asConfigured(this.exhaustion, "exhaustion") + this.exhaustion ); } }