Use primitive type for exhaustion and put nullable on same line in DamageTypeRegistryEntry

This commit is contained in:
Chaosdave34 2024-12-23 18:08:27 +01:00
parent 5570b7bac8
commit 904dc9e86e
2 changed files with 11 additions and 13 deletions

View file

@ -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.

View file

@ -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
);
}
}