Repository navigation
Ajout d'un roulement dans le ScoreBoard #1512
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
11 changes: 11 additions & 0 deletions
11
src/main/java/fr/openmc/core/features/displays/scoreboards/sb/InfoSwapper.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,11 @@ | ||
| package fr.openmc.core.features.displays.scoreboards.sb; | ||
|
|
||
| import net.kyori.adventure.text.Component; | ||
| import org.bukkit.entity.Player; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface InfoSwapper { | ||
| boolean isActive(); | ||
| void addInfosTo(Player player, List<Component> lines); | ||
| } |
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
55 changes: 55 additions & 0 deletions
55
src/main/java/fr/openmc/core/features/events/sbinfos/ContestInfos.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,55 @@ | ||
| package fr.openmc.core.features.events.sbinfos; | ||
|
|
||
| import fr.openmc.core.features.displays.scoreboards.sb.InfoSwapper; | ||
| import fr.openmc.core.features.events.contents.weeklyevents.WeeklyEventsManager; | ||
| import fr.openmc.core.features.events.contents.weeklyevents.contents.contest.Contest; | ||
| import fr.openmc.core.features.events.contents.weeklyevents.contents.contest.ContestPhase; | ||
| import fr.openmc.core.features.events.contents.weeklyevents.contents.contest.managers.ContestManager; | ||
| import fr.openmc.core.features.events.contents.weeklyevents.contents.contest.models.ContestData; | ||
| import fr.openmc.core.utils.bedrock.CharRemplacementUtils; | ||
| import fr.openmc.core.utils.text.DateUtils; | ||
| import fr.openmc.core.utils.text.messages.TranslationManager; | ||
| import net.kyori.adventure.text.Component; | ||
| import net.kyori.adventure.text.format.NamedTextColor; | ||
| import net.kyori.adventure.text.format.TextColor; | ||
| import net.kyori.adventure.text.format.TextDecoration; | ||
| import net.kyori.adventure.text.minimessage.MiniMessage; | ||
| import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; | ||
| import org.bukkit.entity.Player; | ||
|
|
||
| import java.time.DayOfWeek; | ||
| import java.util.List; | ||
|
|
||
| import static net.kyori.adventure.text.Component.text; | ||
|
|
||
| public class ContestInfos implements InfoSwapper { | ||
|
|
||
| @Override | ||
| public boolean isActive() { | ||
| if (WeeklyEventsManager.isEventActive() && WeeklyEventsManager.getCurrentEvent() instanceof Contest) { | ||
| return WeeklyEventsManager.getCurrentPhase() != ContestPhase.VOTE_CAMP.getPhase(); | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public void addInfosTo(Player player, List<Component> lines) { | ||
| ContestData data = ContestManager.data; | ||
|
|
||
| lines.add(MiniMessage.miniMessage().deserialize( | ||
| "<gradient:#FFB800:#F0DF49><title></gradient>", | ||
| Placeholder.component("title", TranslationManager.translation("feature.displays.scoreboard.contest.title", true)) | ||
| ).decoration(TextDecoration.BOLD, true)); | ||
| lines.add(text(" " + CharRemplacementUtils.getPointChar(player) + " ", NamedTextColor.DARK_GRAY) | ||
| .append(data.getCamp1ToSmall()) | ||
| .appendSpace() | ||
| .append(TranslationManager.translation(player, "feature.displays.scoreboard.contest.vs", true).color(NamedTextColor.GRAY)) | ||
| .append(data.getCamp2ToSmall()) | ||
| ); | ||
| lines.add(Component.text(" " + CharRemplacementUtils.getPointChar(player) + " ", NamedTextColor.DARK_GRAY) | ||
| .append(TranslationManager.translation(player, "feature.displays.scoreboard.contest.ends", true).color(NamedTextColor.GRAY)) | ||
| .appendSpace() | ||
| .append(text(DateUtils.getTimeUntilNextDay(DayOfWeek.MONDAY), TextColor.color(0xFF8F06))) | ||
| ); | ||
| } | ||
| } |
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
22 changes: 22 additions & 0 deletions
22
src/main/java/fr/openmc/core/features/settings/values/SwappingValues.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,22 @@ | ||
| package fr.openmc.core.features.settings.values; | ||
|
|
||
| import fr.openmc.core.features.settings.policy.Policy; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public enum SwappingValues implements Policy { | ||
| FULL("feature.settings.values.swapping.full.name", "feature.settings.values.swapping.full.description", -1), | ||
| SLOW("feature.settings.values.swapping.slow.name", "feature.settings.values.swapping.slow.description", 120), | ||
| NORMAL("feature.settings.values.swapping.normal.name", "feature.settings.values.swapping.normal.description", 60), | ||
| FAST("feature.settings.values.swapping.fast.name", "feature.settings.values.swapping.fast.description", 30); | ||
|
|
||
| private final String displayName; | ||
| private final String description; | ||
| private final int swappingTime; // En seconds | ||
|
|
||
| SwappingValues(String displayName, String description, int swappingTime) { | ||
| this.displayName = displayName; | ||
| this.description = description; | ||
| this.swappingTime = swappingTime; | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
prívate ? public ? Généralement vaut mieux préciser et au moins on se pose pas la question 👍
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.
a oui bien vu