1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Added PlayerProfile#hasUnlockedEverything()

and also updated all workflows to JDK 17
This commit is contained in:
TheBusyBiscuit 2022-01-16 14:17:50 +01:00
parent 6ec11e17ef
commit c1074faeb2
6 changed files with 26 additions and 7 deletions

View File

@ -20,11 +20,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2.4.0
- name: Set up Java JDK 16
- name: Set up Java JDK 17
uses: actions/setup-java@v2.5.0
with:
distribution: 'adopt'
java-version: '16'
java-version: '17'
java-package: jdk
architecture: x64

View File

@ -17,7 +17,7 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Validate JSON
- name: Validate wiki.json
uses: docker://orrosenblatt/validate-json-action:latest@sha256:02370758b8b199e0477da11ecfdd498c75c561685056b5c31b925a4ab95df7f4
env:
INPUT_SCHEMA: '.github/configs/wiki-schema.json'

View File

@ -23,11 +23,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK 16
- name: Set up JDK 17
uses: actions/setup-java@v2.5.0
with:
distribution: 'adopt'
java-version: '16'
java-version: '17'
java-package: jdk
architecture: x64

View File

@ -20,11 +20,11 @@ jobs:
with:
fetch-depth: 0
- name: Set up JDK 16
- name: Set up JDK 17
uses: actions/setup-java@v2.5.0
with:
distribution: 'adopt'
java-version: '16'
java-version: '17'
java-package: jdk
architecture: x64

View File

@ -42,6 +42,7 @@
* Added Glow Lichen as a fuel type for the Bio-Generator
* Added Spore Blossom as a fuel type for the Bio-Generator
* Added a new item setting for Freezers to allow them to use a 9:1 "vanilla" ratio instead of 1:1 (1:1 by default, like before)
* (API) Added `PlayerProfile#hasUnlockedEverything()` to check if a player has unlocked all researches
#### Changes
* (API) `BiomeMapParser` is now `public`

View File

@ -192,6 +192,7 @@ public class PlayerProfile {
*
* @param research
* The {@link Research} that is being queried
*
* @return Whether this {@link Research} has been unlocked
*/
public boolean hasUnlocked(@Nullable Research research) {
@ -203,6 +204,23 @@ public class PlayerProfile {
return !research.isEnabled() || researches.contains(research);
}
/**
* This method returns whether this {@link Player} has unlocked all {@link Research Researches}.
*
* @return Whether they unlocked every {@link Research}
*/
public boolean hasUnlockedEverything() {
for (Research research : Slimefun.getRegistry().getResearches()) {
// If there is a single Research not unlocked: They haven't unlocked everything.
if (!hasUnlocked(research)) {
return false;
}
}
// Player has everything unlocked - Hooray!
return true;
}
/**
* This Method will return all Researches that this {@link Player} has unlocked
*