Slimefun4
Slimefun4 copied to clipboard
feat: allow addons to add wiki pages to items
Description
Nowadays there are more and more Slimefun addons, but only Slimefun items can have the wiki item in the recipe display. Some addons already have wiki, but players may not be able to know the wiki's existence, unless the developer add the wiki link via FlexItemGroup or using other ways. I think the wiki page item should be available to all the items that have wiki for them.
Tested with https://github.com/Sefiraat/Networks/pull/152.
Proposed changes
- Add
getWikiURL()inSlimefunAddonto provide a base URL for addon wiki. - Add
getWikiPage(String)inSlimefunItemto allow items to have wiki pages. - Deprecate
addOfficialWikipagein favor ofgetWikiPage. - Display a different wiki icon for all addons.
- Move the code that setups wiki from
wiki.jsontoWikiUtils.
Related Issues (if applicable)
N/A
Checklist
- [x] I have fully tested the proposed changes and promise that they will not break everything into chaos.
- [x] I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
- [x] I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
- [x] I followed the existing code standards and didn't mess up the formatting.
- [x] I did my best to add documentation to any public classes or methods I added.
- [x] I have added
NonnullandNullableannotations to my methods to indicate their behaviour for null values - [x] I added sufficient Unit Tests to cover my code.
Pro Tip! You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️
| Branch naming convention | Label |
|---|---|
feature/** |
🎈 Feature |
fix/** |
✨ Fix |
chore/** |
🧹 Chores |
api/** |
🔧 API |
performance/** |
💡 Performance Optimization |
compatibility/** |
🤝 Compatibility |
If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀
Slimefun preview build
A Slimefun preview build is available for testing! Commit: 663c9a1c
https://preview-builds.walshy.dev/download/Slimefun/3937/663c9a1c
Note: This is not a supported build and is only here for the purposes of testing. Do not run this on a live server and do not report bugs anywhere but this PR!
I like the idea but limiting the addon to be under one url + a placeholder imo isn't ideal. If there was a way to add a full link to an item on top of this I think it would be a good addition
Yea i agree with this, maybe we can have the wiki link be defaulted to the repo as how you have it now but allow it to be overridable with custom links. this will allow sites like gitbook to be used
For anyone would like to test this build using the preview jar, here is the modified Networks that utilized the methods added in this PR. Download link: https://cloud.ybw0014.net/s/PwTr (my own cloudreve instance) If you want to compile it by yourself, the PR link is here: https://github.com/Sefiraat/Networks/pull/152
I'm not fully opposed to giving a way to provide wiki links for addons.
However...
Arbitrary links doesn't feel good. Domains will be bought, not renewed and snatched by others. I think we need to figure out the right approach to this rather than just throw this out there. We do not want to be the ones responsible for someone getting malware on their system or seeing adult material due to a snatched domain.
Maybe add a warning message before sending the link in the chat?
Warnings don’t mean much and are almost always ignored
Warnings don’t mean much and are almost always ignored
It is the player's choice to ignore the warning.
i dont think this is the right approach we will still be kept accountable if someone gets a virus or something else. I do really like this feature, but i do agree with Walshy completely
Maintaining a list of trusted wiki domain names could be a compromise, since no official addon wiki provided.
Is creating a second repository for all addons an option?
On 8/7/23, NoRainCity @.***> wrote:
Maintaining a list of trusted wiki domain names could be a compromise, since no official addon wiki provided.
-- Reply to this email directly or view it on GitHub: https://github.com/Slimefun/Slimefun4/pull/3937#issuecomment-1667893532 You are receiving this because you are subscribed to this thread.
Message ID: @.***>
Whoops miss clicked
I'm not fully opposed to giving a way to provide wiki links for addons.
However...
Arbitrary links doesn't feel good. Domains will be bought, not renewed and snatched by others. I think we need to figure out the right approach to this rather than just throw this out there. We do not want to be the ones responsible for someone getting malware on their system or seeing adult material due to a snatched domain.
Sf could have a list of whitelisted links, GitHub, gitbook and other docs hosting platforms. In addition to a warn that the files hosted are not officially by slimefun and made by the addon developer if that makes sense.
I'm not fully opposed to giving a way to provide wiki links for addons.
However...
Arbitrary links doesn't feel good. Domains will be bought, not renewed and snatched by others. I think we need to figure out the right approach to this rather than just throw this out there. We do not want to be the ones responsible for someone getting malware on their system or seeing adult material due to a snatched domain.
Sf could have a list of whitelisted links, GitHub, gitbook and other docs hosting platforms. In addition to a warn that the files hosted are not officially by slimefun and made by the addon developer if that makes sense.
I'd like @TheBusyBiscuit's views too
GitHub only definitely helps limit the scope. It doesn't solve the issue but it does help + I like the additional messaging.
I remember this being hard denied in the past.
Yeah I submitted a PR before: https://github.com/Slimefun/Slimefun4/pull/3397
I will add a "wiki control panel" for server owners to control what wiki link the players can access.
I will add a "wiki control panel" for server owners to control what wiki link the players can access.
Thanks for being a good sport while this is all being discussed Yb. Appreciated <3
I will add a "wiki control panel" for server owners to control what wiki link the players can access.
I feel like if we opt for a control panel it should be a general control panel for various settings concerning addons, not just wiki-specific. Perhaps it may be a good idea to put this PR on hold for now and create such a panel first and then come back to this?
I will add a "wiki control panel" for server owners to control what wiki link the players can access.
I feel like if we opt for a control panel it should be a general control panel for various settings concerning addons, not just wiki-specific. Perhaps it may be a good idea to put this PR on hold for now and create such a panel first and then come back to this?
Anything u can come up with that should be in the panel besides addon wiki control?
Would still love this feature. its now getting stale and definitely since cookie is gone and isnt looking into this anymore.
Minecraft has its own warning system already inplace for external links, If that fires im fine with this being in place.
Minecraft has its own warning system already inplace for external links, If that fires im fine with this being in place.
Slimefun displays a message that contains the link when you click on the wiki button, so that will be fired.
As I didnt get any response for panel thing, I just merged commits and resolved merge conflicts. As Jeff mentioned, Minecraft has its warning system, as we just send the link to users and users will be warned when they click on a link in the chat.
Have you tested this with an addon that uses this? Would love to see the button working.
Have you tested this with an addon that uses this? Would love to see the button working.
I tested this earlier with Networks (https://github.com/Sefiraat/Networks/pull/152), now I'm gonna test this again.
Just tested and it still works. However, the item name seems to be a bit long, should we move some parts into item lore?
Yea let’s just call it wiki
Agreed with Jeff, the item name can be Wiki to make it smaller while the error message is shown in chat.
I changed the wiki button name to 'View this item on the %addon% wiki', where %addon% will be replaced by addon name.
And add a line to show if it is official Slimefun wiki, or third party wiki.