Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: Add configurable maximum durability feature via config key "Item-Durability" #16
base: master
Are you sure you want to change the base?
feat: Add configurable maximum durability feature via config key "Item-Durability" #16
Changes from 11 commits
120efde
ac8e0c7
ac31ac6
7ea6234
c954e6a
49f39e0
b9039f7
04623ed
f93b331
e9167d3
3a3532d
773635b
99e585d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 see 3 or 4 data structures being created and I can't tell what this is supposed to be doing. I also side some side effects for non armor mechanics items...
e.g.
Why set the result to null? Why not just return? Seems like this might interfere with vanilla behavior or other plugins when we don't even know if there was an ArmorMechanics item involved.
e.g.
This line and the loop above it uses 2 data structures to accomplish what a simple kotlin optional could handle.
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.
Understood the side effect part, will fix that.
This listener basically does:
For example we have an ArmorMechanics item "X"
When player tries to repair their X using another X in anvil plugin should return item with correct durability.
The reason I check distinct title size is for being sure they are not trying to fix X using Y (another ArmorMechanics item).
To get rid of data types I can probably just use one loop that is like:
for item in event.inventory.items
Continue if item is Air or Null
Add title of the item to titles Set (will check set size after loop is done)
Total durability += Durability of the item
Do you think this is what should be done?