Skip to content

Commit

Permalink
chore(provider): implemented suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Nov 25, 2023
1 parent 9235128 commit 529138b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ public void setCost(int cost) {
this.cost = cost;
}

/**
* Set the custom {@link SlimefunGuideUnlockProvider} of this {@link Research}
*
* @param unlockProvider custom unlock provider {@link SlimefunGuideUnlockProvider}
*/
public void setUnlockProvider(Optional<SlimefunGuideUnlockProvider> unlockProvider) {
this.unlockProvider = unlockProvider;
}

/**
* Bind the specified {@link SlimefunItem SlimefunItems} to this {@link Research}.
*
Expand Down Expand Up @@ -274,7 +283,7 @@ public void unlockFromGuide(SlimefunGuideImplementation guide, Player player, Pl
if (this.canUnlock(player)) {
guide.unlockItem(player, sfItem, pl -> guide.openItemGroup(profile, itemGroup, page));
} else {
Slimefun.getLocalization().sendMessage(player, "messages.not-meet-requirement", true);
Slimefun.getLocalization().sendMessage(player, "messages.requirement-unfulfilled", true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @see SlimefunGuideUnlockProvider
*/
public final class CurrencyUnlockProvider implements SlimefunGuideUnlockProvider {
public class CurrencyUnlockProvider implements SlimefunGuideUnlockProvider {

@Override
public boolean canUnlock(@Nonnull Research research, @Nonnull Player p) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @see SlimefunGuideUnlockProvider
*/
public final class ExperienceUnlockProvider implements SlimefunGuideUnlockProvider {
public class ExperienceUnlockProvider implements SlimefunGuideUnlockProvider {

@Override
public boolean canUnlock(@Nonnull Research research, @Nonnull Player p) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ researches:
free-in-creative-mode: true
enable-fireworks: true
disable-learning-animation: false
# Currently we have those research mode: EXPERIENCE, CURRENCY
unlock-research-mode: EXPERIENCE

URID:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/languages/en/messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ actionbar:

messages:
not-researched: '&4You do not have enough knowledge to understand this. &cYou will need to unlock &f"%item%&f"'
not-meet-requirement: '&4You do not meet the requirement to unlock this'
requirement-unfulfilled: '&4You do not meet the requirement to unlock this'
unlocked: '&bYou have unlocked &7"%research%"'
only-players: '&4This command is only for Players'
unknown-player: '&4Unknown Player: &c%player%'
Expand Down

0 comments on commit 529138b

Please sign in to comment.