File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/main/java/ac/grim/grimac/utils/data/packetentity Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -99,14 +99,19 @@ public Optional<ValuedAttribute> getAttribute(Attribute attribute) {
9999 }
100100
101101 public void setAttribute (Attribute attribute , double value ) {
102- ValuedAttribute property = getAttribute (attribute ).orElse (null );
103- if (property == null ) throw new IllegalArgumentException ("Cannot set attribute " + attribute .getName () + " for entity " + getType ().getName ().toString () + "!" );
102+ ValuedAttribute property = attributeMap .get (attribute );
103+ if (property == null ) {
104+ throw new IllegalArgumentException ("Cannot set attribute " + attribute .getName () + " for entity " + getType ().getName ().toString () + "!" );
105+ }
104106 property .override (value );
105107 }
106108
107109 public double getAttributeValue (Attribute attribute ) {
108- return getAttribute (attribute ).map (ValuedAttribute ::get )
109- .orElseThrow (() -> new IllegalArgumentException ("Cannot get attribute " + attribute .getName () + " for entity " + getType ().getName ().toString () + "!" ));
110+ final ValuedAttribute property = attributeMap .get (attribute );
111+ if (property == null ) {
112+ throw new IllegalArgumentException ("Cannot get attribute " + attribute .getName () + " for entity " + getType ().getName ().toString () + "!" );
113+ }
114+ return property .get ();
110115 }
111116
112117 public void resetAttributes () {
You can’t perform that action at this time.
0 commit comments