Skip to content
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

Custom research unlock #3942

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

StarWishsama
Copy link
Contributor

@StarWishsama StarWishsama commented Aug 9, 2023

Description

Experience isn't only way to retrieve knowledge, money also can.

Added SlimefunGuideUnlockMode and SlimefunGuideUnlockProvider to support more ways to unlock research.
Support use player's server currency to unlock research with Vault API.

Proposed changes

Added SlimefunGuideUnlockMode
Added SlimefunGuideUnlockProvider
Added VaultIntegration for integration of unlock research.

Related Issues (if applicable)

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

@StarWishsama StarWishsama requested review from a team as code owners August 9, 2023 08:10
@github-actions github-actions bot added the 🎈 Feature This Pull Request adds a new feature. label Aug 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

Your Pull Request was automatically labelled as: "🎈 Feature"
Thank you for contributing to this project! ❤️

@Sefiraat
Copy link
Member

Sefiraat commented Aug 9, 2023

Not sure on others' feelings on this, but I would rather var wasn't used over directly declaring the datatype...

@J3fftw1 J3fftw1 added the 🎯 Needs testing This Issue needs to be tested by our team to see if it can be reproduced. label Aug 9, 2023
Copy link
Contributor

@J3fftw1 J3fftw1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick review
and i agree with Sefi please dont use var

@Sefiraat
Copy link
Member

Sefiraat commented Aug 9, 2023

Side comment, freaking love this. :)

@StarWishsama
Copy link
Contributor Author

Not sure why everyone dislike var even we're already in Java 16... But i will change it anyway.

@Sefiraat
Copy link
Member

Sefiraat commented Aug 9, 2023

Not sure why everyone dislike var even we're already in Java 16... But i will change it anyway.

My personal dislike is that Slimefun attracts new developers often, and var means a developer reading the code has to know the context of the incoming object. This isn't the worst thing it's just a barrier that I don't think is needed. Specifically declaring the type means no context is required by those reading the code later. Its a small thing, but given var doesn't really provide alot of benefit (imo) I think it's worth the slightly uglier code :)

@J3fftw1
Copy link
Contributor

J3fftw1 commented Aug 9, 2023

I love readable code. Im also all for doing full variable names instead of P. since we are on java 16 we can but dont have to use var but i would opt out of using it because of readability

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

Slimefun preview build

A Slimefun preview build is available for testing!
Commit: b6c16892

https://preview-builds.walshy.dev/download/Slimefun/3942/b6c16892

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!

@StarWishsama StarWishsama changed the title Support unlock research by using currency Support custom method to unlock research Aug 9, 2023
Copy link
Contributor

@iTwins iTwins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looked at style

Copy link
Member

@TheBusyBiscuit TheBusyBiscuit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to say this PR has a rather large footprint...
image

while more configuration is good, it needs to be maintainable, the research system itself is too rusty and old in my opinion to be adding onto it such a large feature.
But idk if a research rewrite is gonna be coming anytime soon, so not sure about this really.

@StarWishsama
Copy link
Contributor Author

I have to say this PR has a rather large footprint...
image

while more configuration is good, it needs to be maintainable, the research system itself is too rusty and old in my opinion to be adding onto it such a large feature.
But idk if a research rewrite is gonna be coming anytime soon, so not sure about this really.

3/4 of those are line separator change, nice work github.

@TheBusyBot TheBusyBot added the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Aug 30, 2023
…research

# Conflicts:
#	src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunGuideOpenEvent.java
@StarWishsama StarWishsama changed the title Support custom method to unlock research Custom research unlock Sep 10, 2023
@J3fftw1 J3fftw1 removed the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Sep 10, 2023
@Boomer-1
Copy link

can confirm it works in survival mode. if player is in creative mode currency is not deducted. Additionally I would recommend a comment be added to the config file to display the options that the server owner can type in that line, if it's more than currency or experience. it wasn't intuitive. I had to go into the code to find that. I also only tested currency. didn't test tokens or other options

Comment on lines 153 to 157
not-enough-xp: '&4You do not have enough XP to unlock this'
not-meet-requirement: '&4You do not meet the requirement to unlock this'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably call it something like does-not-meet-requirement or something like that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe requirement-unfulfilled? or unfulfilled-requirement

@@ -72,6 +73,7 @@ public final class SlimefunRegistry {
private boolean disableLearningAnimation;
private boolean logDuplicateBlockEntries;
private boolean talismanActionBarMessages;
private SlimefunGuideUnlockMode guideUnlockMode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a setter method for this would be nice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any demand for setter method? The original goal is implement a research scoped custom unlock provider for addon dev and a global bulit-in unlock provider.

@TheBusyBot TheBusyBot added the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Dec 27, 2023
@J3fftw1
Copy link
Contributor

J3fftw1 commented Dec 31, 2023

I would still love this change in.
People have requested this a bunch in the past.
but it has merge conflicts
not gonna marking it as stale since the merge conflicts got added 4 days ago

@StarWishsama
Copy link
Contributor Author

I would still love this change in.
People have requested this a bunch in the past.
but it has merge conflicts
not gonna marking it as stale since the merge conflicts got added 4 days ago

Gonna resolve this at first day in 2024 😄

@TheBusyBot TheBusyBot removed the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Jan 6, 2024
@TheBusyBot TheBusyBot added the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎈 Feature This Pull Request adds a new feature. ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! 🎯 Needs testing This Issue needs to be tested by our team to see if it can be reproduced.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants