-
Notifications
You must be signed in to change notification settings - Fork 550
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
[Api] Give & Pick Slimefun Item api #4252
base: master
Are you sure you want to change the base?
[Api] Give & Pick Slimefun Item api #4252
Conversation
- SlimefunItem#getGiveItemResult(Player) - SlimefunItem#getPickBlockResult(HumanEntity, Block)
Your Pull Request was automatically labelled as: "🔧 API" |
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/4252/8f66bf32
|
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 really like this, great job!
I'm not the biggest fan of giveItem since /sf give is a command not just a special mc thingy but, I think it's fine. Generally, I try to make APIs that work first-party the same as they do third-party. So, any addon could do something similar rather than it being a special Slimefun hardcoded thing
For this situation, I think it's fine. I haven't seen others asking for a similar functionality and if someone wants to make one, we can easily move over.
...in/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java
Outdated
Show resolved
Hide resolved
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 a fan of this, simple but a very useful addition to the API 👍🏻
Thanks!
…n/listeners/MiddleClickListener.java Co-authored-by: Daniel Walsh <walshydev@gmail.com>
6aa40f3
Description
Addons with complex SlimefunItem's that can have data different for the same slimefun item often have problems with the middle click & give item command, as they may lack some data that would be there when attained in survival, this PR adds 2 methods to help solve that problem.
Proposed changes
SlimefunItem#getGiveItemResult(Player)
getItem
and is called inGiveCommand
in place ofgetItem
SlimefunItem#getPickBlockResult(Player, Block)
getItem
and is called inMiddleClickListener
in place ofgetItem
MiddleClickListener
as the event returnsHumanEntity
notPlayer
and I didn't want it to be inconsistent, testing is needed to make sure it still worksRelated Issues (if applicable)
N/A
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values