-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix Items with a negative pickup delay being able to be picked up #13008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ public int getPickupDelay() { | |
|
||
@Override | ||
public void setPickupDelay(int delay) { | ||
this.getHandle().pickupDelay = Math.min(delay, Short.MAX_VALUE); | ||
this.getHandle().pickupDelay = Math.clamp(Short.MIN_VALUE, delay, Short.MAX_VALUE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not the right way to clamp, did you look at the parameters? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops, not sure what i was thinking here, i must have misread this locally. |
||
} | ||
|
||
@Override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this part is needed.
Not sure about explicitly show the magic value when setCanPlayerPickup exists, maybe instead just use a Range/IntRange annotation since it's an integer on 16 bits. The negative value doesn't make sense in that context too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm, i should annotate this param to 0 to Short.MAX_VALUE? or 1 to short.max_value -1 (just actually functional "delay")? or smth else?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, if we prevent players from passing a negative number here, should the get method translate negative numbers to NO_PICKUP_TIME, so api users dont get a value they cannot restore later?