mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 20:21:41 +01:00
Add transient modifier API
This commit is contained in:
parent
e48a6a04cc
commit
6c30e5b15b
@ -23,6 +23,11 @@ public class UnmodifiableAttributeInstance extends CraftAttributeInstance {
|
|||||||
throw new UnsupportedOperationException("Cannot modify default attributes");
|
throw new UnsupportedOperationException("Cannot modify default attributes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTransientModifier(AttributeModifier modifier) {
|
||||||
|
throw new UnsupportedOperationException("Cannot modify default attributes");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeModifier(AttributeModifier modifier) {
|
public void removeModifier(AttributeModifier modifier) {
|
||||||
throw new UnsupportedOperationException("Cannot modify default attributes");
|
throw new UnsupportedOperationException("Cannot modify default attributes");
|
||||||
|
@ -51,6 +51,14 @@ public class CraftAttributeInstance implements AttributeInstance {
|
|||||||
this.handle.addPermanentModifier(CraftAttributeInstance.convert(modifier));
|
this.handle.addPermanentModifier(CraftAttributeInstance.convert(modifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paper start - Transient modifier API
|
||||||
|
@Override
|
||||||
|
public void addTransientModifier(AttributeModifier modifier) {
|
||||||
|
Preconditions.checkArgument(modifier != null, "modifier");
|
||||||
|
this.handle.addTransientModifier(CraftAttributeInstance.convert(modifier));
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeModifier(AttributeModifier modifier) {
|
public void removeModifier(AttributeModifier modifier) {
|
||||||
Preconditions.checkArgument(modifier != null, "modifier");
|
Preconditions.checkArgument(modifier != null, "modifier");
|
||||||
|
Loading…
Reference in New Issue
Block a user