Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@
import fr.openmc.core.utils.text.messages.TranslationManager;
import fr.openmc.core.utils.world.WorldUtils;
import lombok.Getter;
import net.kyori.adventure.key.Key;
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 org.bukkit.*;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.entity.Pose;
Expand Down Expand Up @@ -252,7 +256,7 @@ public static Component getCorpseDirection(Player player, CorpseNPC corpse) {
else
return Component.text(
DirectionUtils.getDirectionArrow(player, corpse.getLocation()),
TextColor.color(0xFF8F06)).decoration(TextDecoration.BOLD, false);
TextColor.color(0xFF8F06)).decoration(TextDecoration.BOLD, false).font(Key.key("minecraft", "default"));
}

public static Component getRemainingTime(UUID playerUUID) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public Component getTitle() {
* @return Un {@link Component} pour le footer
*/
public static Component getFooter() {
Component footerText = TranslationManager.translation("feature.displays.scoreboard.footer.text.to_small");
Component footerText = TranslationManager.translation("feature.displays.scoreboard.footer.text");
return MiniMessage.miniMessage().deserialize(" <gradient:#FF18DD:#FF80F6><name></gradient>", Placeholder.component("name", footerText));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
import java.util.ArrayList;
import java.util.List;

import static fr.openmc.core.utils.text.messages.MessagesManager.textToSmall;
import static fr.openmc.core.utils.text.messages.MessagesManager.textToSmallComponent;
import static fr.openmc.core.utils.text.fonts.SmallCapsUtils.toSmall;
import static net.kyori.adventure.text.Component.empty;
import static net.kyori.adventure.text.Component.text;

Expand All @@ -52,30 +51,30 @@ public void update(Player player, SternalBoard board) {
lines.add(MiniMessage.miniMessage()
.deserialize(
"<gradient:#FF0000:#FF7F7F><title></gradient>",
Placeholder.component("title", TranslationManager.translation("feature.displays.scoreboard.citywar.title.to_small"))
Placeholder.component("title", TranslationManager.translation("feature.displays.scoreboard.citywar.title", true))
)
.decoration(TextDecoration.BOLD, true));

lines.add(text(" • ", net.kyori.adventure.text.format.NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.enemy.label.to_small").color(TextColor.color(0xAAAAAA)))
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.enemy.label", true).color(TextColor.color(0xAAAAAA)))
.appendSpace()
.append(textToSmallComponent(enemyCity.getName()).color(TextColor.color(0xFF0634)))
.append(toSmall(enemyCity.getName()).color(TextColor.color(0xFF0634)))
);

Component phaseComponent;
switch (war.getPhase()) {
case PREPARATION -> phaseComponent = MiniMessage.miniMessage()
.deserialize("<gradient:#FF7518:#FFD580>%s</gradient>".formatted(textToSmall(WarManager.getFormattedPhase(war.getPhase()))));
case COMBAT -> phaseComponent = textToSmallComponent(WarManager.getFormattedPhase(war.getPhase()))
.deserialize("<gradient:#FF7518:#FFD580>%s</gradient>".formatted(toSmall(WarManager.getFormattedPhase(war.getPhase()))));
case COMBAT -> phaseComponent = toSmall(WarManager.getFormattedPhase(war.getPhase()))
.color(TextColor.color(0xFC1C1C));
case ENDED -> phaseComponent = textToSmallComponent(WarManager.getFormattedPhase(war.getPhase()))
case ENDED -> phaseComponent = toSmall(WarManager.getFormattedPhase(war.getPhase()))
.color(NamedTextColor.GRAY);
default -> phaseComponent = textToSmallComponent((WarManager.getFormattedPhase(war.getPhase())))
default -> phaseComponent = toSmall(WarManager.getFormattedPhase(war.getPhase()))
.color(NamedTextColor.WHITE);
}

lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.phase.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.phase.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(phaseComponent)
);
Expand All @@ -95,7 +94,7 @@ public void update(Player player, SternalBoard board) {
int rounded = (int) Math.round(distance);

lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.distance.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.distance.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(text(direction, TextColor.color(0xFFE206)))
.appendSpace()
Expand All @@ -105,37 +104,37 @@ public void update(Player player, SternalBoard board) {

switch (war.getPhase()) {
case PREPARATION -> lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.starts_in.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.starts_in.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(text(DateUtils.convertSecondToTime(war.getPreparationTimeRemaining()), TextColor.color(0xF52727)))
);

case COMBAT -> {
if (mascot != null)
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.mascot.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.mascot.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(getColoredHealth(mascot))
);

if (enemyMascot != null)
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.enemy.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.enemy.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(getColoredHealth(enemyMascot))
);

lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.ends_in.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.ends_in.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(text(DateUtils.convertSecondToTime(war.getCombatTimeRemaining()), TextColor.color(0xF52727)))
);
}

case ENDED -> lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.state.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.state.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.state.ended.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.citywar.state.ended", true).color(NamedTextColor.GRAY))
);
}

Expand Down Expand Up @@ -165,7 +164,7 @@ protected int updateInterval() {
private Component getColoredHealth(LivingEntity entity) {
if (entity.isDead())
return TranslationManager.translation(
"feature.displays.scoreboard.citywar.mascot.dead.to_small",
"feature.displays.scoreboard.citywar.mascot.dead", true,
Component.text(FontImageWrapper.replaceFontImages(":dead1:"))
).color(TextColor.color(0xFF3246));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import fr.openmc.core.hooks.LuckPermsHook;
import fr.openmc.core.hooks.WorldGuardHook;
import fr.openmc.core.utils.text.DateUtils;
import fr.openmc.core.utils.text.fonts.SmallCapsUtils;
import fr.openmc.core.utils.text.messages.TranslationManager;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
Expand All @@ -35,8 +36,7 @@
import java.util.ArrayList;
import java.util.List;

import static fr.openmc.core.utils.text.messages.MessagesManager.textToSmall;
import static fr.openmc.core.utils.text.messages.MessagesManager.textToSmallComponent;
import static fr.openmc.core.utils.text.fonts.SmallCapsUtils.toSmall;
import static net.kyori.adventure.text.Component.empty;
import static net.kyori.adventure.text.Component.text;

Expand All @@ -55,7 +55,8 @@ public void update(Player player, SternalBoard board) {

lines.add(MiniMessage.miniMessage().deserialize(
"<gradient:#F82C5D:#F64545><title></gradient>",
Placeholder.component("title", TranslationManager.translation("feature.displays.scoreboard.corpse.title.to_small")))
Placeholder.component("title", TranslationManager.translation("feature.displays.scoreboard.corpse.title")))
.font(SmallCapsUtils.SMALL_CAPS_FONT)
.decoration(TextDecoration.BOLD, true)
.appendSpace()
.append(CorpseManager.getCorpseDirection(player, corpse))
Expand All @@ -71,16 +72,16 @@ public void update(Player player, SternalBoard board) {
if (WeeklyEventsManager.getCurrentPhase() != ContestPhase.VOTE_CAMP.getPhase()) {
lines.add(MiniMessage.miniMessage().deserialize(
"<gradient:#FFB800:#F0DF49><title></gradient>",
Placeholder.component("title", TranslationManager.translation("feature.displays.scoreboard.contest.title.to_small"))
Placeholder.component("title", TranslationManager.translation("feature.displays.scoreboard.contest.title", true))
).decoration(TextDecoration.BOLD, true));
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(data.getCamp1ToSmall())
.appendSpace()
.append(TranslationManager.translation("feature.displays.scoreboard.contest.vs.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.contest.vs", true).color(NamedTextColor.GRAY))
.append(data.getCamp2ToSmall())
);
lines.add(Component.text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.contest.ends.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.contest.ends", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(text(DateUtils.getTimeUntilNextDay(DayOfWeek.MONDAY), TextColor.color(0xFF8F06)))
);
Expand All @@ -96,54 +97,56 @@ public void update(Player player, SternalBoard board) {
public static List<Component> getDefaultLines(Player player) {
Component rank = LuckPermsHook.isEnable()
? Component.text(LuckPermsHook.getFormattedPAPIPrefix(player))
: TranslationManager.translation("feature.displays.scoreboard.rank.none.to_small").color(TextColor.color(0xFF1FCC));
: TranslationManager.translation("feature.displays.scoreboard.rank.none", true).color(TextColor.color(0xFF1FCC));


City city = CityManager.getPlayerCity(player.getUniqueId());
City chunkCity = CityManager.getCityFromChunk(player.getChunk().getX(), player.getChunk().getZ());
boolean isInRegion = WorldGuardHook.isRegionConflict(player.getLocation());
Component location = isInRegion
? TranslationManager.translation("feature.displays.scoreboard.location.protected.to_small")
: TranslationManager.translation("feature.displays.scoreboard.location.wilderness.to_small");
location = (chunkCity != null) ? textToSmallComponent(chunkCity.getName()) : location;
? TranslationManager.translation("feature.displays.scoreboard.location.protected", true)
: TranslationManager.translation("feature.displays.scoreboard.location.wilderness", true);
location = (chunkCity != null) ? toSmall(chunkCity.getName()) : location;

String balance = EconomyManager.getMiniBalance(player.getUniqueId());
double bits = BitsManager.getBits(player.getUniqueId());

List<Component> lines = new ArrayList<>();

lines.add(empty());
lines.add(MiniMessage.miniMessage().deserialize("<gradient:#FF45B9:#FF1FCC>%s</gradient>".formatted(textToSmall(player.getName()))).decoration(TextDecoration.BOLD, true));
lines.add(MiniMessage.miniMessage().deserialize(
"<gradient:#FF45B9:#FF1FCC><font:omc_fonts:small_caps>%s</font></gradient>".formatted(
player.getName())).decoration(TextDecoration.BOLD, true));
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.rank.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.rank.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(rank)
);
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.city.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.city.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(city != null
? textToSmallComponent(city.getName()).color(TextColor.color(0xFF06DC))
: TranslationManager.translation("feature.displays.scoreboard.city.none.to_small").color(TextColor.color(0xFF06DC)))
? toSmall(city.getName()).color(TextColor.color(0xFF06DC))
: TranslationManager.translation("feature.displays.scoreboard.city.none", true).color(TextColor.color(0xFF06DC)))
);
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.balance.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.balance.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(textToSmallComponent(balance).color(TextColor.color(0xFF06DC)))
.append(toSmall(balance).color(TextColor.color(0xFF06DC)))
.appendSpace()
.append(text(EconomyManager.getEconomyIcon()))
);
if (bits > 0) {
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.bits.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.bits.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(textToSmallComponent(EconomyManager.getFormattedSimplifiedNumber(bits)).color(TextColor.color(0x07A0F5)))
.append(toSmall(EconomyManager.getFormattedSimplifiedNumber(bits)).color(TextColor.color(0x07A0F5)))
.appendSpace()
.append(text(BitsManager.getBitsIcon()))
);
}
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.location.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.location.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(location.color(TextColor.color(0xFF06DC)))
);
Expand All @@ -156,9 +159,9 @@ public static List<Component> getDefaultLines(Player player) {
if (halloweenNPC != null) {
String pumpkinCount = EconomyManager.getFormattedSimplifiedNumber(HalloweenManager.getPumpkinCount(player.getUniqueId()));
lines.add(text(" • ", NamedTextColor.DARK_GRAY)
.append(TranslationManager.translation("feature.displays.scoreboard.pumpkins.label.to_small").color(NamedTextColor.GRAY))
.append(TranslationManager.translation("feature.displays.scoreboard.pumpkins.label", true).color(NamedTextColor.GRAY))
.appendSpace()
.append(textToSmallComponent(pumpkinCount).color(TextColor.color(0xFF7518)))
.append(toSmall(pumpkinCount).color(TextColor.color(0xFF7518)))
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void update(Player player, SternalBoard board) {
List<Component> lines = new ArrayList<>();

lines.add(empty());
lines.add(TranslationManager.translation("feature.displays.scoreboard.restart.in.to_small")
lines.add(TranslationManager.translation("feature.displays.scoreboard.restart.in", true)
.appendSpace()
.append(text(DateUtils.convertSecondToTime(Restart.remainingTime)))
.color(NamedTextColor.RED));
Expand Down
Loading
Loading