-
-
Notifications
You must be signed in to change notification settings - Fork 20
Show hologram after all OneBlock phases are finished #141
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
Open
GenOpenDiesel
wants to merge
8
commits into
BG-Software-LLC:master
Choose a base branch
from
GenOpenDiesel:fix/finished-phases-hologram
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8519cd4
Show a hologram when all OneBlock phases are finished.
GenOpenDiesel 821efc8
Make finished phases hologram text configurable in config.yml.
GenOpenDiesel e8c0817
Add GitHub Actions workflow to build the plugin.
GenOpenDiesel b696807
Fix gradlew execute permission in CI.
GenOpenDiesel 10bf44d
Use Java 17 in CI to run Gradle 9.
GenOpenDiesel 0072fd8
Remove GitHub Actions build workflow per review feedback.
GenOpenDiesel 83e97fd
Fix OneBlock startup with SuperiorSkyblock2 2026.1 NMSLoader.
GenOpenDiesel 87dbc13
Embed NMS reobf jars for NMSLoader b21 compatibility.
GenOpenDiesel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Build Plugin | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - fix/finished-phases-hologram | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '17' | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Build plugin | ||
| run: chmod +x gradlew && ./gradlew build --no-daemon | ||
| env: | ||
| STABLE_BUILD: true | ||
|
|
||
| - name: Upload JAR artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: SSBOneBlock | ||
| path: target/*.jar | ||
| if-no-files-found: error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/com/bgsoftware/ssboneblock/task/FinishedPhasesHologram.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| package com.bgsoftware.ssboneblock.task; | ||
|
|
||
| import com.bgsoftware.ssboneblock.OneBlockModule; | ||
| import com.bgsoftware.ssboneblock.factory.HologramFactory; | ||
| import com.bgsoftware.ssboneblock.utils.WorldUtils; | ||
| import com.bgsoftware.superiorskyblock.api.island.Island; | ||
| import com.bgsoftware.superiorskyblock.api.service.hologram.Hologram; | ||
| import org.bukkit.Location; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.LinkedList; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.UUID; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
|
|
||
| public final class FinishedPhasesHologram { | ||
|
|
||
| private static final Map<UUID, List<Hologram>> holograms = new ConcurrentHashMap<>(); | ||
| private static final OneBlockModule module = OneBlockModule.getModule(); | ||
|
|
||
| private FinishedPhasesHologram() { | ||
|
|
||
| } | ||
|
|
||
| public static void show(Island island) { | ||
| List<String> hologramLines = module.getSettings().finishedPhasesHologram; | ||
| if (hologramLines.isEmpty()) | ||
| return; | ||
|
|
||
| remove(island); | ||
|
|
||
| Location oneBlockLocation = WorldUtils.getOneBlock(island); | ||
| List<Hologram> islandHolograms = new LinkedList<>(); | ||
|
|
||
| for (int i = 0; i < hologramLines.size(); i++) { | ||
| Hologram hologram = createHologram(oneBlockLocation, i); | ||
| if (hologram == null) | ||
| continue; | ||
|
|
||
| hologram.setHologramName(hologramLines.get(i)); | ||
| islandHolograms.add(hologram); | ||
| } | ||
|
|
||
| if (!islandHolograms.isEmpty()) | ||
| holograms.put(island.getUniqueId(), islandHolograms); | ||
| } | ||
|
|
||
| public static void remove(Island island) { | ||
| List<Hologram> islandHolograms = holograms.remove(island.getUniqueId()); | ||
| if (islandHolograms == null) | ||
| return; | ||
|
|
||
| islandHolograms.forEach(Hologram::removeHologram); | ||
| } | ||
|
|
||
| public static void removeAll() { | ||
| new HashMap<>(holograms).values().forEach(islandHolograms -> | ||
| islandHolograms.forEach(Hologram::removeHologram)); | ||
| holograms.clear(); | ||
| } | ||
|
|
||
| private static Hologram createHologram(Location firstLocation, int index) { | ||
| Location hologramLocation = firstLocation.clone().add(0.5, 2 + (index * 0.3), 0.5); | ||
| return HologramFactory.createHologram(hologramLocation); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove this workflow