diff --git a/src/main/java/com/nexia/core/commands/player/DiscordCommand.java b/src/main/java/com/nexia/core/commands/player/DiscordCommand.java index 51c029c4..0421c9a8 100644 --- a/src/main/java/com/nexia/core/commands/player/DiscordCommand.java +++ b/src/main/java/com/nexia/core/commands/player/DiscordCommand.java @@ -21,11 +21,13 @@ public static void register(CommandDispatcher dispatcher) { public static int run(CommandContext context) throws CommandSyntaxException { context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Link to discord: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(NexiaDiscord.config.discordLink).color(ChatFormat.brandColor2) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.greenColor))) - .clickEvent(ClickEvent.openUrl(NexiaDiscord.config.discordLink))) - )); + .append(Component.text("Link to discord: ", ChatFormat.normalColor)) + .append(Component.text(NexiaDiscord.config.discordLink, ChatFormat.brandColor2) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.greenColor))) + .clickEvent(ClickEvent.openUrl(NexiaDiscord.config.discordLink)) + ) + + ); return 1; } diff --git a/src/main/java/com/nexia/core/commands/player/HelpCommand.java b/src/main/java/com/nexia/core/commands/player/HelpCommand.java index e38819fe..2516332e 100644 --- a/src/main/java/com/nexia/core/commands/player/HelpCommand.java +++ b/src/main/java/com/nexia/core/commands/player/HelpCommand.java @@ -47,10 +47,10 @@ public static int run(CommandContext context) throws CommandS message = message.append(Component.text("\n/" + commandInfo[0]) .color(ChatFormat.brandColor1) - .decoration(ChatFormat.bold, false) + .decoration(ChatFormat.strikeThrough, false) - .append(Component.text(" | ").color(ChatFormat.lineColor).decoration(ChatFormat.bold, false).decoration(ChatFormat.strikeThrough, false)) - .append(Component.text(commandInfo[1]).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false).decoration(ChatFormat.strikeThrough, false))); + .append(Component.text(" | ").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, false)) + .append(Component.text(commandInfo[1], ChatFormat.brandColor2).decoration(ChatFormat.strikeThrough, false))); //message += "\n" + ChatFormat.brandColor1 + "/" + commandInfo[0] + ChatFormat.lineColor + " | " + ChatFormat.brandColor2 + commandInfo[1]; } diff --git a/src/main/java/com/nexia/core/commands/player/MessageCommand.java b/src/main/java/com/nexia/core/commands/player/MessageCommand.java index cbc0e64c..b9597ac5 100644 --- a/src/main/java/com/nexia/core/commands/player/MessageCommand.java +++ b/src/main/java/com/nexia/core/commands/player/MessageCommand.java @@ -81,16 +81,16 @@ private static void sendMessage(NexiaPlayer sender, NexiaPlayer receiver, String if (PlayerMutes.muted(sender) || sender.equals(receiver)) return; sender.sendMessage( - Component.text(String.format("To %s", receiver.getRawName())).color(ChatFormat.brandColor2) + Component.text(String.format("To %s", receiver.getRawName()), ChatFormat.brandColor2) .append(Component.text(" » ").color(ChatFormat.arrowColor) - .append(Component.text(message).color(ChatFormat.brandColor2)) + .append(Component.text(message, ChatFormat.brandColor2)) )); receiver.sendMessage( - Component.text(String.format("From %s", sender.getRawName())).color(ChatFormat.brandColor2) + Component.text(String.format("From %s", sender.getRawName()), ChatFormat.brandColor2) .append(Component.text(" » ").color(ChatFormat.arrowColor) - .append(Component.text(message).color(ChatFormat.brandColor2)) + .append(Component.text(message, ChatFormat.brandColor2)) )); diff --git a/src/main/java/com/nexia/core/commands/player/PingCommand.java b/src/main/java/com/nexia/core/commands/player/PingCommand.java index f43e3d86..643869d8 100644 --- a/src/main/java/com/nexia/core/commands/player/PingCommand.java +++ b/src/main/java/com/nexia/core/commands/player/PingCommand.java @@ -1,15 +1,14 @@ package com.nexia.core.commands.player; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.nexia.base.player.NexiaPlayer; -import com.nexia.nexus.api.command.CommandSourceInfo; -import com.nexia.nexus.api.command.CommandUtils; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.nexia.base.player.NexiaPlayer; import com.nexia.core.utilities.chat.ChatFormat; import com.nexia.core.utilities.commands.CommandUtil; +import com.nexia.nexus.api.command.CommandSourceInfo; +import com.nexia.nexus.api.command.CommandUtils; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.selector.EntitySelector; import net.minecraft.server.level.ServerPlayer; @@ -33,10 +32,10 @@ public static int run(CommandContext context) throws CommandS context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Your ping is ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(ping + "ms").color(ChatFormat.brandColor2)) - .append(Component.text(".").color(ChatFormat.normalColor)) - .append(Component.text(" (ping may not be accurate)").color(NamedTextColor.GRAY).decorate(ChatFormat.italic)) + .append(Component.text("Your ping is ", ChatFormat.normalColor) + .append(Component.text(ping + "ms", ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + .append(Component.text(" (ping may not be accurate)", ChatFormat.Minecraft.dark_gray).decorate(ChatFormat.italic)) )); return ping; @@ -47,12 +46,12 @@ public static int ping(CommandContext context, ServerPlayer p context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("The ping of ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(player.getScoreboardName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" is ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(ping + "ms").color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(" (ping may not be accurate)").color(NamedTextColor.GRAY).decorate(ChatFormat.italic).decoration(ChatFormat.bold, false)) + .append(Component.text("The ping of ", ChatFormat.normalColor)) + .append(Component.text(player.getScoreboardName(), ChatFormat.brandColor2)) + .append(Component.text(" is ", ChatFormat.normalColor)) + .append(Component.text(ping + "ms", ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + .append(Component.text(" (ping may not be accurate)", ChatFormat.Minecraft.dark_gray).decorate(ChatFormat.italic)) ); return ping; diff --git a/src/main/java/com/nexia/core/commands/player/ReportCommand.java b/src/main/java/com/nexia/core/commands/player/ReportCommand.java index 2897fa98..cd5a7a6b 100644 --- a/src/main/java/com/nexia/core/commands/player/ReportCommand.java +++ b/src/main/java/com/nexia/core/commands/player/ReportCommand.java @@ -15,6 +15,8 @@ import com.nexia.base.player.NexiaPlayer; import com.nexia.core.utilities.time.ServerTime; import com.nexia.discord.NexiaDiscord; +import com.nexia.nexus.api.world.entity.player.Player; +import com.nexia.nexus.builder.implementation.world.entity.player.WrappedPlayer; import me.lucko.fabric.api.permissions.v0.Permissions; import net.kyori.adventure.text.Component; import net.minecraft.commands.arguments.EntityArgument; @@ -59,48 +61,35 @@ public static int report(CommandContext context, ServerPlayer NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException()); if(((CoreSavedPlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(executor).savedData).isReportBanned()) { - executor.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You are report banned!").color(ChatFormat.failColor).decoration(ChatFormat.bold, false) - ) - - ); + executor.sendNexiaMessage("You are report banned!"); return 1; } if(executor.getUUID().equals(player.getUUID())){ - executor.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You cannot report yourself!").color(ChatFormat.failColor).decoration(ChatFormat.bold, false)) - - ); + executor.sendNexiaMessage("You cannot report yourself!"); return 1; } - executor.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have reported ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(player.getScoreboardName()).color(ChatFormat.brandColor2)) - .append(Component.text(" for ").color(ChatFormat.normalColor)) - .append(Component.text(reason).color(ChatFormat.brandColor2)) + executor.sendNexiaMessage( + Component.text("You have reported ", ChatFormat.normalColor) + .append(Component.text(player.getScoreboardName(), ChatFormat.brandColor2)) + .append(Component.text(" for ", ChatFormat.normalColor)) + .append(Component.text(reason, ChatFormat.brandColor2)) ); if(!sendWebhook(executor.getRawName(), player.getScoreboardName(), reason)) { - executor.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("Failed to send webhook! Don't worry, staff who are currently online will see your report!").decoration(ChatFormat.bold, false).color(ChatFormat.normalColor)) - ); + executor.sendNexiaMessage("Failed to send webhook! Don't worry, staff who are currently online will see your report!"); } Component staffReportMessage = ChatFormat.nexiaMessage - .append(Component.text(executor.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" has reported ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(player.getScoreboardName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" for ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(reason).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)); - - for (ServerPlayer staffPlayer : ServerTime.minecraftServer.getPlayerList().getPlayers()){ - if(Permissions.check(staffPlayer, "nexia.staff.report", 1)) ServerTime.nexusServer.getPlayer(staffPlayer.getUUID()).sendMessage(staffReportMessage); + .append(Component.text(executor.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(" has reported ", ChatFormat.normalColor)) + .append(Component.text(player.getScoreboardName(), ChatFormat.brandColor2)) + .append(Component.text(" for ", ChatFormat.normalColor)) + .append(Component.text(reason, ChatFormat.brandColor2)); + + for (Player staffPlayer : ServerTime.nexusServer.getPlayers()){ + if(Permissions.check(((WrappedPlayer) staffPlayer).unwrap(), "nexia.staff.report", 1)) staffPlayer.sendMessage(staffReportMessage); } return 1; diff --git a/src/main/java/com/nexia/core/commands/player/RulesCommand.java b/src/main/java/com/nexia/core/commands/player/RulesCommand.java index 65faab05..0b65ad9a 100644 --- a/src/main/java/com/nexia/core/commands/player/RulesCommand.java +++ b/src/main/java/com/nexia/core/commands/player/RulesCommand.java @@ -26,7 +26,7 @@ public static int run(CommandContext context) { Component message = Component.text("") .append(Component.text(" ").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, true)) .append(Component.text("[ ").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, false) - .append(Component.text("Rules").color(ChatFormat.brandColor1).decoration(ChatFormat.strikeThrough, false)) + .append(Component.text("Rules", ChatFormat.brandColor1).decoration(ChatFormat.strikeThrough, false)) .append(Component.text(" ]").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, false)) .append(Component.text(" ").color(ChatFormat.lineColor).decoration(ChatFormat.strikeThrough, true))); @@ -38,10 +38,10 @@ public static int run(CommandContext context) { .decoration(ChatFormat.strikeThrough, false) .append(Component.text("» ") .color(ChatFormat.arrowColor) - .decoration(ChatFormat.bold, false) + .decoration(ChatFormat.strikeThrough, false) .append(Component.text(NexiaCore.config.rules[i]) - .decoration(ChatFormat.bold, false) + .decoration(ChatFormat.strikeThrough, false) .color(ChatFormat.normalColor) ) diff --git a/src/main/java/com/nexia/core/commands/player/ShoutCommand.java b/src/main/java/com/nexia/core/commands/player/ShoutCommand.java index acbd9339..f450dd1a 100644 --- a/src/main/java/com/nexia/core/commands/player/ShoutCommand.java +++ b/src/main/java/com/nexia/core/commands/player/ShoutCommand.java @@ -50,17 +50,16 @@ public static int shout(CommandContext context, String messag if(longTime - System.currentTimeMillis() > 0) { String time = ShoutCommand.timeToText(longTime - System.currentTimeMillis()); - executor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("You are still on cooldown, you have ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(time).color(ChatFormat.brandColor1).decoration(ChatFormat.bold, true)) - .append(Component.text(" left!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - )); + executor.sendNexiaMessage( + Component.text("You are still on cooldown, you have ", ChatFormat.normalColor) + .append(Component.text(time, ChatFormat.brandColor1).decoration(ChatFormat.bold, true)) + .append(Component.text(" left!", ChatFormat.normalColor)) + ); return 0; } - Component cmessage = Component.text(executor.getRawName()).color(ChatFormat.brandColor1).decoration(ChatFormat.bold, true) - .append(Component.text( " shouts: " + message).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - ); + Component cmessage = Component.text(executor.getRawName(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true) + .append(Component.text( " shouts: " + message, ChatFormat.normalColor)); for(Player player : ServerTime.nexusServer.getPlayers()) { player.sendMessage(cmessage); diff --git a/src/main/java/com/nexia/core/commands/player/SpectateCommand.java b/src/main/java/com/nexia/core/commands/player/SpectateCommand.java index 708bd917..140c9a00 100644 --- a/src/main/java/com/nexia/core/commands/player/SpectateCommand.java +++ b/src/main/java/com/nexia/core/commands/player/SpectateCommand.java @@ -49,29 +49,22 @@ public static void register(CommandDispatcher dispatcher) { public static int gameModeSpectate(CommandContext context) throws CommandSyntaxException { NexiaPlayer executor = new NexiaPlayer(context.getSource().getPlayerOrException()); - if(((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(executor)).gameMode != PlayerGameMode.FFA) { - executor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("This can only be used in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - )); - executor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("If you are in duels then you do /spectate .").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - )); + if(!executor.isInGameMode(PlayerGameMode.FFA)) { + executor.sendNexiaMessage("This can only be used in FFA!"); + executor.sendNexiaMessage("If you are in duels then you do /spectate ."); return 0; } if(!executor.hasPermission("nexia.prefix.supporter")) { - executor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("This feature is only available for").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) + executor.sendNexiaMessage( + Component.text("This feature is only available for", ChatFormat.normalColor) .append(Component.text("Supporters") .color(ChatFormat.brandColor1) .decoration(ChatFormat.bold, true) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor1))) - .clickEvent(ClickEvent.suggestCommand("/ranks") - ) - .append(Component.text("!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor1))) + .clickEvent(ClickEvent.suggestCommand("/ranks")) + .append(Component.text("!", ChatFormat.normalColor)) ) - ) - ); } @@ -80,9 +73,7 @@ public static int gameModeSpectate(CommandContext context) th } if(Math.round(executor.getHealth()) < 20) { - executor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("You must be fully healed to go into spectator!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - ); + executor.sendNexiaMessage("You must be fully healed to go into spectator!"); return 0; } @@ -95,24 +86,22 @@ public static int spectate(CommandContext context, ServerPlay NexiaPlayer nexiaExecutor = new NexiaPlayer(context.getSource().getPlayerOrException()); NexiaPlayer nexiaPlayer = new NexiaPlayer(player); - if(((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(nexiaPlayer)).gameMode == PlayerGameMode.LOBBY) { + if(nexiaPlayer.isInGameMode(PlayerGameMode.LOBBY)) { GamemodeHandler.spectatePlayer(nexiaExecutor, nexiaPlayer); return 1; } if(!nexiaExecutor.hasPermission("nexia.prefix.supporter")) { - nexiaExecutor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("This feature is only available for").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) + nexiaExecutor.sendNexiaMessage( + Component.text("This feature is only available for", ChatFormat.normalColor) .append(Component.text("Supporters") .color(ChatFormat.brandColor1) .decoration(ChatFormat.bold, true) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor1))) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor1))) .clickEvent(ClickEvent.suggestCommand("/ranks") ) - .append(Component.text("!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(Component.text("!", ChatFormat.normalColor)) ) - ) - ); } @@ -121,27 +110,19 @@ public static int spectate(CommandContext context, ServerPlay } if(((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(nexiaExecutor)).gameMode != PlayerGameMode.FFA) { - nexiaExecutor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("This can only be used in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - )); - nexiaExecutor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("If you are in duels then you do /spectate .").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - )); + nexiaExecutor.sendNexiaMessage("This can only be used in FFA!"); + nexiaExecutor.sendNexiaMessage("If you are in duels then you do /spectate ."); } if(!FfaUtil.isFfaPlayer(nexiaPlayer)) { - nexiaExecutor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("That player is not in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - )); + nexiaExecutor.sendNexiaMessage("That player is not in FFA!"); return 0; } // Check if player is in combat (or full health), then put them in spectator. if(Math.round(nexiaExecutor.getHealth()) < 20) { - nexiaExecutor.sendMessage(ChatFormat.nexiaMessage.append( - Component.text("You must be fully healed to go into spectator!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - ); + nexiaExecutor.sendNexiaMessage("You must be fully healed to go into spectator!"); return 0; } diff --git a/src/main/java/com/nexia/core/commands/player/SprintFixCommand.java b/src/main/java/com/nexia/core/commands/player/SprintFixCommand.java index ce5f8c75..41febdb2 100644 --- a/src/main/java/com/nexia/core/commands/player/SprintFixCommand.java +++ b/src/main/java/com/nexia/core/commands/player/SprintFixCommand.java @@ -21,7 +21,7 @@ public static int run(CommandContext context) throws CommandS NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException()); CoreSavedPlayerData data = (CoreSavedPlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player).savedData; - player.sendMessage(ChatFormat.nexiaMessage.append(Component.text((data.setSprintFix(!data.isSprintFix()) ? "Enabled" : "Disabled") + " Sprint Fix!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + player.sendNexiaMessage(Component.text((data.setSprintFix(!data.isSprintFix()) ? "Enabled" : "Disabled") + " Sprint Fix!", ChatFormat.normalColor)); return 1; } diff --git a/src/main/java/com/nexia/core/commands/player/StatsCommand.java b/src/main/java/com/nexia/core/commands/player/StatsCommand.java index 55db5c21..afbc6321 100644 --- a/src/main/java/com/nexia/core/commands/player/StatsCommand.java +++ b/src/main/java/com/nexia/core/commands/player/StatsCommand.java @@ -17,7 +17,6 @@ import com.nexia.nexus.api.command.CommandSourceInfo; import com.nexia.nexus.api.command.CommandUtils; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.selector.EntitySelector; @@ -40,11 +39,11 @@ public static int run(CommandContext context) throws CommandS CorePlayerData playerData = (CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player); - Component start = Component.text(" »").color(NamedTextColor.GRAY); + Component start = Component.text(" »").color(ChatFormat.arrowColor); Component user = start - .append(Component.text(" User: ").color(ChatFormat.brandColor2)) - .append(Component.text(player.getRawName()).color(ChatFormat.normalColor)); + .append(Component.text(" User: ", ChatFormat.brandColor2)) + .append(Component.text(player.getRawName(), ChatFormat.normalColor)); @@ -77,21 +76,21 @@ public static int run(CommandContext context) throws CommandS player.sendMessage(message); player.sendMessage(user); player.sendMessage(start - .append(Component.text(" Kills: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Kills: ", ChatFormat.brandColor2)) .append(Component.text(kills).color(ChatFormat.greenColor)) ); player.sendMessage(start - .append(Component.text(" Deaths: ").color(ChatFormat.brandColor2)) - .append(Component.text(deaths).color(ChatFormat.failColor)) + .append(Component.text(" Deaths: ", ChatFormat.brandColor2)) + .append(Component.text(deaths, ChatFormat.failColor)) ); player.sendMessage(start - .append(Component.text(" KDR: ").color(ChatFormat.brandColor2)) + .append(Component.text(" KDR: ", ChatFormat.brandColor2)) .append(Component.text(calculateKDR(kills, deaths)).color(ChatFormat.greenColor)) ); player.sendMessage(start - .append(Component.text(" Killstreak: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Killstreak: ", ChatFormat.brandColor2)) .append(Component.text(killstreak).color(ChatFormat.goldColor)) .append(Component.text("/").color(ChatFormat.arrowColor)) .append(Component.text(bestKillstreak).color(ChatFormat.goldColor)) @@ -104,12 +103,12 @@ public static int run(CommandContext context) throws CommandS player.sendMessage(message); player.sendMessage(user); player.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); player.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); } @@ -120,16 +119,16 @@ public static int run(CommandContext context) throws CommandS player.sendMessage(message); player.sendMessage(user); player.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); player.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); player.sendMessage(start - .append(Component.text(" Beds broken: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "bedsBroken")).color(ChatFormat.failColor)) + .append(Component.text(" Beds broken: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "bedsBroken"), ChatFormat.failColor)) ); } @@ -140,16 +139,16 @@ public static int run(CommandContext context) throws CommandS player.sendMessage(message); player.sendMessage(user); player.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); player.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); player.sendMessage(start - .append(Component.text(" Kills: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "kills")).color(ChatFormat.failColor)) + .append(Component.text(" Kills: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "kills"), ChatFormat.failColor)) ); } @@ -160,16 +159,16 @@ public static int run(CommandContext context) throws CommandS player.sendMessage(message); player.sendMessage(user); player.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); player.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); player.sendMessage(start - .append(Component.text(" Goals: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "goals")).color(ChatFormat.failColor)) + .append(Component.text(" Goals: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "goals"), ChatFormat.failColor)) ); } @@ -180,16 +179,16 @@ public static int run(CommandContext context) throws CommandS player.sendMessage(message); player.sendMessage(user); player.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); player.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); player.sendMessage(start - .append(Component.text(" Kills: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "kills")).color(ChatFormat.failColor)) + .append(Component.text(" Kills: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "kills"), ChatFormat.failColor)) ); } player.sendMessage(ChatFormat.separatorLine(null)); @@ -208,8 +207,8 @@ public static int other(CommandContext context, ServerPlayer Component start = Component.text(" »").color(ChatFormat.arrowColor); Component user = start - .append(Component.text(" User: ").color(ChatFormat.brandColor2)) - .append(Component.text(otherPlayer.getScoreboardName()).color(ChatFormat.normalColor)) + .append(Component.text(" User: ", ChatFormat.brandColor2)) + .append(Component.text(otherPlayer.getScoreboardName(), ChatFormat.normalColor)) ; @@ -243,21 +242,21 @@ public static int other(CommandContext context, ServerPlayer source.sendMessage(message); source.sendMessage(user); source.sendMessage(start - .append(Component.text(" Kills: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Kills: ", ChatFormat.brandColor2)) .append(Component.text(kills).color(ChatFormat.greenColor)) ); source.sendMessage(start - .append(Component.text(" Deaths: ").color(ChatFormat.brandColor2)) - .append(Component.text(deaths).color(ChatFormat.failColor)) + .append(Component.text(" Deaths: ", ChatFormat.brandColor2)) + .append(Component.text(deaths, ChatFormat.failColor)) ); source.sendMessage(start - .append(Component.text(" KDR: ").color(ChatFormat.brandColor2)) + .append(Component.text(" KDR: ", ChatFormat.brandColor2)) .append(Component.text(calculateKDR(kills, deaths)).color(ChatFormat.greenColor)) ); source.sendMessage(start - .append(Component.text(" Killstreak: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Killstreak: ", ChatFormat.brandColor2)) .append(Component.text(killstreak).color(ChatFormat.goldColor)) .append(Component.text("/").color(ChatFormat.arrowColor)) .append(Component.text(bestKillstreak).color(ChatFormat.goldColor)) @@ -270,12 +269,12 @@ public static int other(CommandContext context, ServerPlayer source.sendMessage(message); source.sendMessage(user); source.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); source.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); } @@ -286,16 +285,16 @@ public static int other(CommandContext context, ServerPlayer source.sendMessage(message); source.sendMessage(user); source.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); source.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); source.sendMessage(start - .append(Component.text(" Beds broken: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "bedsBroken")).color(ChatFormat.failColor)) + .append(Component.text(" Beds broken: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "bedsBroken"), ChatFormat.failColor)) ); } @@ -306,16 +305,16 @@ public static int other(CommandContext context, ServerPlayer source.sendMessage(message); source.sendMessage(user); source.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); source.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); source.sendMessage(start - .append(Component.text(" Kills: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "kills")).color(ChatFormat.failColor)) + .append(Component.text(" Kills: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "kills"), ChatFormat.failColor)) ); } @@ -326,16 +325,16 @@ public static int other(CommandContext context, ServerPlayer source.sendMessage(message); source.sendMessage(user); source.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); source.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); source.sendMessage(start - .append(Component.text(" Goals: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "goals")).color(ChatFormat.failColor)) + .append(Component.text(" Goals: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "goals"), ChatFormat.failColor)) ); } @@ -346,16 +345,16 @@ public static int other(CommandContext context, ServerPlayer source.sendMessage(message); source.sendMessage(user); source.sendMessage(start - .append(Component.text(" Wins: ").color(ChatFormat.brandColor2)) + .append(Component.text(" Wins: ", ChatFormat.brandColor2)) .append(Component.text(data.get(Integer.class, "wins")).color(ChatFormat.greenColor)) ); source.sendMessage(start - .append(Component.text(" Losses: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "losses")).color(ChatFormat.failColor)) + .append(Component.text(" Losses: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "losses"), ChatFormat.failColor)) ); source.sendMessage(start - .append(Component.text(" Kills: ").color(ChatFormat.brandColor2)) - .append(Component.text(data.get(Integer.class, "kills")).color(ChatFormat.failColor)) + .append(Component.text(" Kills: ", ChatFormat.brandColor2)) + .append(Component.text(data.get(Integer.class, "kills"), ChatFormat.failColor)) ); } source.sendMessage(ChatFormat.separatorLine(null)); diff --git a/src/main/java/com/nexia/core/commands/player/duels/PartyCommand.java b/src/main/java/com/nexia/core/commands/player/duels/PartyCommand.java index f88a5247..946f5fc9 100644 --- a/src/main/java/com/nexia/core/commands/player/duels/PartyCommand.java +++ b/src/main/java/com/nexia/core/commands/player/duels/PartyCommand.java @@ -86,7 +86,7 @@ public static int listTeam(CommandContext context) throws Com DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(executor); if(data.duelOptions.duelsTeam == null) { - executor.sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor)); return 1; } @@ -114,7 +114,7 @@ public static int promotePlayer(CommandContext context, Serve DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(executor); if(data.duelOptions.duelsTeam == null) { - executor.sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor)); return 1; } @@ -128,7 +128,7 @@ public static int kickPlayer(CommandContext context, ServerPl DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(executor); if(data.duelOptions.duelsTeam == null) { - executor.sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor)); return 1; } @@ -142,7 +142,7 @@ public static int disbandTeam(CommandContext context) throws DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if(data.duelOptions.duelsTeam == null) { - player.sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor)); return 1; } @@ -155,7 +155,7 @@ public static int leaveTeam(CommandContext context) throws Co DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if(data.duelOptions.duelsTeam == null) { - player.sendMessage(Component.text("You aren't in a team!").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You aren't in a team!", ChatFormat.failColor)); return 1; } diff --git a/src/main/java/com/nexia/core/commands/player/ffa/KitCommand.java b/src/main/java/com/nexia/core/commands/player/ffa/KitCommand.java index 7034c898..72aaaa6f 100644 --- a/src/main/java/com/nexia/core/commands/player/ffa/KitCommand.java +++ b/src/main/java/com/nexia/core/commands/player/ffa/KitCommand.java @@ -33,7 +33,7 @@ public static void register(CommandDispatcher dispatcher) { .executes(context -> { NexiaPlayer player = new NexiaPlayer(context.getSource().getPlayerOrException()); if(!FfaKitsUtil.INSTANCE.canGoToSpawn(player)) { - player.sendMessage(Component.text("You must be fully healed to change kits!").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You must be fully healed to change kits!", ChatFormat.failColor)); return 1; } diff --git a/src/main/java/com/nexia/core/commands/staff/BanCommand.java b/src/main/java/com/nexia/core/commands/staff/BanCommand.java index bd7a2126..5522fd71 100644 --- a/src/main/java/com/nexia/core/commands/staff/BanCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/BanCommand.java @@ -46,10 +46,10 @@ public static int ban(CommandSourceInfo context, Collection collect ++i; context.sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have banned ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(ComponentUtils.getDisplayName(gameProfile).getString()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" for ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(reason).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) + .append(Component.text("You have banned ", ChatFormat.normalColor)) + .append(Component.text(ComponentUtils.getDisplayName(gameProfile).getString(), ChatFormat.brandColor2)) + .append(Component.text(" for ", ChatFormat.normalColor)) + .append(Component.text(reason, ChatFormat.brandColor2)) ); @@ -66,7 +66,7 @@ public static int ban(CommandSourceInfo context, Collection collect if (i == 0) { context.sendMessage( - ChatFormat.nexiaMessage.append(Component.text("That player is already banned.").color(ChatFormat.failColor)) + ChatFormat.nexiaMessage.append(Component.text("That player is already banned.", ChatFormat.failColor)) ); } else { return i; diff --git a/src/main/java/com/nexia/core/commands/staff/GamemodeBanCommand.java b/src/main/java/com/nexia/core/commands/staff/GamemodeBanCommand.java index 0692b568..cf9f9c54 100644 --- a/src/main/java/com/nexia/core/commands/staff/GamemodeBanCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/GamemodeBanCommand.java @@ -39,7 +39,7 @@ public static int ban(CommandSourceInfo sender, ServerPlayer player, String stri sender.sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Invalid gamemode!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(Component.text("Invalid gamemode!", ChatFormat.normalColor)) ); return 1; @@ -51,8 +51,8 @@ public static int ban(CommandSourceInfo sender, ServerPlayer player, String stri } catch (Exception e) { sender.sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Invalid duration. Examples: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text("1s / 2m / 3h / 4d / 5w").color(ChatFormat.failColor).decoration(ChatFormat.bold, false)) + .append(Component.text("Invalid duration. Examples: ", ChatFormat.normalColor)) + .append(Component.text("1s / 2m / 3h / 4d / 5w", ChatFormat.failColor)) ); return 1; } diff --git a/src/main/java/com/nexia/core/commands/staff/HealCommand.java b/src/main/java/com/nexia/core/commands/staff/HealCommand.java index 71cacd4a..d0cfbd7b 100644 --- a/src/main/java/com/nexia/core/commands/staff/HealCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/HealCommand.java @@ -29,7 +29,7 @@ public static int run(CommandContext context) throws CommandS executor.sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have been healed.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(Component.text("You have been healed.", ChatFormat.normalColor)) ); return 1; @@ -41,17 +41,13 @@ public static int heal(CommandContext context, ServerPlayer o context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have healed ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(otherPlayer.getScoreboardName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(Component.text("You have healed ", ChatFormat.normalColor)) + .append(Component.text(otherPlayer.getScoreboardName(), ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) ); - new NexiaPlayer(otherPlayer).sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have been healed.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - ); - + new NexiaPlayer(otherPlayer).sendNexiaMessage("You have been healed."); return 1; } } diff --git a/src/main/java/com/nexia/core/commands/staff/MapCommand.java b/src/main/java/com/nexia/core/commands/staff/MapCommand.java index 8e70c7ba..6498ecfa 100644 --- a/src/main/java/com/nexia/core/commands/staff/MapCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/MapCommand.java @@ -47,7 +47,7 @@ private static int run(CommandContext context) { if(map.trim().isEmpty() || type.trim().isEmpty()) { context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Invalid name!").color(ChatFormat.failColor).decoration(ChatFormat.bold, false)) + .append(Component.text("Invalid name!", ChatFormat.failColor)) ); return 1; } @@ -61,10 +61,9 @@ private static int run(CommandContext context) { if (player != null) { player.teleport(new Location(0, 80, 0, 0, 0, WorldUtil.getWorld(level))); - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("Created map called: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(map).color(ChatFormat.brandColor2)) + player.sendNexiaMessage( + Component.text("Created map called: ", ChatFormat.normalColor) + .append(Component.text(map, ChatFormat.brandColor2)) ); } @@ -75,10 +74,9 @@ private static int run(CommandContext context) { if (type.equalsIgnoreCase("delete")) { ServerTime.fantasy.getOrOpenPersistentWorld(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(mapname[0], mapname[1])).location(), null).delete(); if(player != null) { - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("Deleted map called: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(map).color(ChatFormat.brandColor2)) + player.sendNexiaMessage( + Component.text("Deleted map called: ", ChatFormat.normalColor) + .append(Component.text(map, ChatFormat.brandColor2)) ); } @@ -94,10 +92,9 @@ private static int run(CommandContext context) { if(player != null) { player.teleport(new Location(0, 80, 0, 0, 0, WorldUtil.getWorld(level))); - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("Teleported to map called: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(map).color(ChatFormat.brandColor2)) + player.sendNexiaMessage( + Component.text("Teleported to map called: ", ChatFormat.normalColor) + .append(Component.text(map, ChatFormat.brandColor2)) ); } diff --git a/src/main/java/com/nexia/core/commands/staff/MuteCommand.java b/src/main/java/com/nexia/core/commands/staff/MuteCommand.java index e441dcdb..36a0af27 100644 --- a/src/main/java/com/nexia/core/commands/staff/MuteCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/MuteCommand.java @@ -47,8 +47,8 @@ public static int mute(CommandContext context, String duratio } catch (Exception e) { context.getSource().sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Invalid duration. Examples: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text("1s / 2m / 3h / 4d / 5w").color(ChatFormat.failColor).decoration(ChatFormat.bold, false)) + .append(Component.text("Invalid duration. Examples: ", ChatFormat.normalColor)) + .append(Component.text("1s / 2m / 3h / 4d / 5w", ChatFormat.failColor)) ); return 1; diff --git a/src/main/java/com/nexia/core/commands/staff/RankCommand.java b/src/main/java/com/nexia/core/commands/staff/RankCommand.java index d286d1e0..eb4c3e75 100644 --- a/src/main/java/com/nexia/core/commands/staff/RankCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/RankCommand.java @@ -40,16 +40,15 @@ public static int give(CommandContext context, ServerPlayer p if (nexiaRank == null) { context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Invalid rank!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(Component.text("Invalid rank!", ChatFormat.normalColor)) ); return 0; } - nexiaPlayer.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("Your rank has been set to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(nexiaRank.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + nexiaPlayer.sendNexiaMessage( + Component.text("Your rank has been set to: ", ChatFormat.normalColor) + .append(Component.text(nexiaRank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(".", ChatFormat.normalColor)) ); NexiaRank.setRank(nexiaRank, nexiaPlayer); diff --git a/src/main/java/com/nexia/core/commands/staff/StaffPrefixCommand.java b/src/main/java/com/nexia/core/commands/staff/StaffPrefixCommand.java index a897a0c1..13da348a 100644 --- a/src/main/java/com/nexia/core/commands/staff/StaffPrefixCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/StaffPrefixCommand.java @@ -40,7 +40,7 @@ public static void register(CommandDispatcher dispatcher) { if(rank == null) { context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Invalid rank!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(Component.text("Invalid rank!", ChatFormat.normalColor)) ); return 0; } @@ -48,18 +48,17 @@ public static void register(CommandDispatcher dispatcher) { if(type.equalsIgnoreCase("set")){ context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have set the prefix of ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor2)) - .append(Component.text(" to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(rank.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold,false).decoration(ChatFormat.bold, false)) + .append(Component.text("You have set the prefix of ", ChatFormat.normalColor)) + .append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(" to: ", ChatFormat.normalColor)) + .append(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(".", ChatFormat.normalColor).decoration(ChatFormat.bold,false)) ); - otherPlayer.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("Your prefix has been set to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(rank.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + otherPlayer.sendNexiaMessage( + Component.text("Your prefix has been set to: ", ChatFormat.normalColor) + .append(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(".", ChatFormat.normalColor)) ); NexiaRank.setPrefix(rank, otherPlayer); @@ -68,11 +67,11 @@ public static void register(CommandDispatcher dispatcher) { if(type.equalsIgnoreCase("remove")){ context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have removed the prefix ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(rank.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true).decoration(ChatFormat.bold, false)) - .append(Component.text(" from: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold,false)) + .append(Component.text("You have removed the prefix ", ChatFormat.normalColor)) + .append(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(" from: ", ChatFormat.normalColor)) + .append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor).decoration(ChatFormat.bold,false)) ); NexiaRank.removePrefix(rank, otherPlayer); @@ -81,11 +80,11 @@ public static void register(CommandDispatcher dispatcher) { if(type.equalsIgnoreCase("add")){ context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have added the prefix ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(rank.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) - .append(Component.text(" to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold,false)) + .append(Component.text("You have added the prefix ", ChatFormat.normalColor)) + .append(Component.text(rank.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(" to: ", ChatFormat.normalColor)) + .append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor).decoration(ChatFormat.bold,false)) ); NexiaRank.addPrefix(rank, otherPlayer, false); } diff --git a/src/main/java/com/nexia/core/commands/staff/StaffReportCommand.java b/src/main/java/com/nexia/core/commands/staff/StaffReportCommand.java index 99f3aeff..af460beb 100644 --- a/src/main/java/com/nexia/core/commands/staff/StaffReportCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/StaffReportCommand.java @@ -35,15 +35,15 @@ public static void register(CommandDispatcher dispatcher) { if(type.equalsIgnoreCase("ban")) { if(((CoreSavedPlayerData)data.savedData).isReportBanned()) { - context.getSource().sendMessage(Component.text("That player is already report banned!").color(ChatFormat.failColor)); + context.getSource().sendMessage(Component.text("That player is already report banned!", ChatFormat.failColor)); return 0; } ((CoreSavedPlayerData)data.savedData).setReportBanned(true); context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have report banned ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor1).decoration(ChatFormat.bold, true)) - .append(Component.text(".")).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) + .append(Component.text("You have report banned ", ChatFormat.normalColor) + .append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true)) + .append(Component.text(".", ChatFormat.normalColor)) ) ); return Command.SINGLE_SUCCESS; @@ -51,21 +51,20 @@ public static void register(CommandDispatcher dispatcher) { if(type.equalsIgnoreCase("unban") || type.equalsIgnoreCase("pardon")) { if(!((CoreSavedPlayerData)data.savedData).isReportBanned()) { - context.getSource().sendMessage(Component.text("That player is not report banned!").color(ChatFormat.failColor)); + context.getSource().sendMessage(Component.text("That player is not report banned!", ChatFormat.failColor)); return 0; } ((CoreSavedPlayerData)data.savedData).setReportBanned(false); context.getSource().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have report unbanned ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(otherPlayer.getRawName()).color(ChatFormat.brandColor1).decoration(ChatFormat.bold, true)) - .append(Component.text(".")).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - ) + .append(Component.text("You have report unbanned ", ChatFormat.normalColor)) + .append(Component.text(otherPlayer.getRawName(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true)) + .append(Component.text(".", ChatFormat.normalColor)) ); return Command.SINGLE_SUCCESS; } - context.getSource().sendMessage(Component.text("Invalid argument").color(ChatFormat.failColor)); + context.getSource().sendMessage(Component.text("Invalid argument", ChatFormat.failColor)); return 0; })) diff --git a/src/main/java/com/nexia/core/commands/staff/TempBanCommand.java b/src/main/java/com/nexia/core/commands/staff/TempBanCommand.java index 06cdd0a9..1b74d1fe 100644 --- a/src/main/java/com/nexia/core/commands/staff/TempBanCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/TempBanCommand.java @@ -32,8 +32,8 @@ public static int ban(CommandSourceInfo sender, Collection collecti durationInSeconds = BanHandler.parseTimeArg(durationArg); } catch (Exception e) { sender.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Invalid duration. Examples: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text("1s / 2m / 3h / 4d / 5w").color(ChatFormat.failColor).decoration(ChatFormat.bold, false)) + .append(Component.text("Invalid duration. Examples: ", ChatFormat.normalColor)) + .append(Component.text("1s / 2m / 3h / 4d / 5w", ChatFormat.failColor)) ); return 1; } diff --git a/src/main/java/com/nexia/core/commands/staff/UnBanCommand.java b/src/main/java/com/nexia/core/commands/staff/UnBanCommand.java index 4374e6db..fd4b29ee 100644 --- a/src/main/java/com/nexia/core/commands/staff/UnBanCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/UnBanCommand.java @@ -43,9 +43,9 @@ public static int unban(CommandSourceInfo context, Collection colle context.getSender().sendMessage( ChatFormat.nexiaMessage - .append(Component.text("You have unbanned ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(gameProfile.getName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(Component.text("You have unbanned ", ChatFormat.normalColor)) + .append(Component.text(gameProfile.getName(), ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) ); } @@ -54,7 +54,7 @@ public static int unban(CommandSourceInfo context, Collection colle if (i == 0) { context.sendMessage( ChatFormat.nexiaMessage - .append(Component.text("That player is not banned.").color(ChatFormat.failColor)) + .append(Component.text("That player is not banned.", ChatFormat.failColor)) ); } else { diff --git a/src/main/java/com/nexia/core/commands/staff/UnGamemodeBanCommand.java b/src/main/java/com/nexia/core/commands/staff/UnGamemodeBanCommand.java index 14a4188d..2cafbfb4 100644 --- a/src/main/java/com/nexia/core/commands/staff/UnGamemodeBanCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/UnGamemodeBanCommand.java @@ -37,7 +37,7 @@ public static int unBan(CommandContext context) throws Comman if(gameMode == null) { sender.sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Invalid gamemode!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(Component.text("Invalid gamemode!", ChatFormat.normalColor)) ); return 1; diff --git a/src/main/java/com/nexia/core/games/util/LobbyUtil.java b/src/main/java/com/nexia/core/games/util/LobbyUtil.java index 3fde3655..81c452d5 100644 --- a/src/main/java/com/nexia/core/games/util/LobbyUtil.java +++ b/src/main/java/com/nexia/core/games/util/LobbyUtil.java @@ -208,20 +208,16 @@ public static boolean checkGameModeBan(NexiaPlayer player, String game) { GamemodeBanHandler.removeBanFromList(player.getUUID(), gameMode); return false; } else { - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You are gamemode (" + gameMode.name + ") banned for ").decoration(ChatFormat.bold, false)) - .append(Component.text(BanHandler.banTimeToText(banTime)).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".\nReason: ").decoration(ChatFormat.bold, false)) - .append(Component.text((String) banJSON.get("reason")).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) + player.sendNexiaMessage( + Component.text("You are gamemode (" + gameMode.name + ") banned for ", ChatFormat.Minecraft.white) + .append(Component.text(BanHandler.banTimeToText(banTime), ChatFormat.brandColor2)) + .append(Component.text(".\nReason: ", ChatFormat.Minecraft.white)) + .append(Component.text((String) banJSON.get("reason"), ChatFormat.brandColor2)) ); return true; } } else { - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You are gamemode (" + gameMode.name + ") banned!")) - ); + player.sendNexiaMessage("You are gamemode (%s) banned!", gameMode.name); } LobbyUtil.returnToLobby(player, true); @@ -246,7 +242,7 @@ public static void sendGame(NexiaPlayer player, String game, boolean message, bo for (BaseFfaUtil util : BaseFfaUtil.ffaUtils) { if (game.equalsIgnoreCase(util.getNameLowercase() + " ffa") && !util.canGoToSpawn(player)) { - player.sendMessage(Component.text("You must be fully healed to go to spawn!").color(ChatFormat.failColor)); + player.sendNexiaMessage("You must be fully healed to go to spawn!"); return; } } @@ -297,11 +293,8 @@ public static void sendGame(NexiaPlayer player, String game, boolean message, bo if(message){ player.sendActionBarMessage(Component.text("You have joined §f☯ §c§lDuels §7\uD83E\uDE93")); - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("Duels has now moved here. (main hub)").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - ); - player.sendMessage(Component.text("Meaning you can now use /duel, /queue and /spectate inside of the normal hub WITHOUT going to duels!").decoration(ChatFormat.bold, false)); + player.sendNexiaMessage("Duels has now moved here. (main hub)"); + player.sendMessage(Component.text("Meaning you can now use /duel, /queue and /spectate inside of the normal hub WITHOUT going to duels!")); } } diff --git a/src/main/java/com/nexia/core/gui/PrefixGUI.java b/src/main/java/com/nexia/core/gui/PrefixGUI.java index 4428aac8..fb992f5b 100644 --- a/src/main/java/com/nexia/core/gui/PrefixGUI.java +++ b/src/main/java/com/nexia/core/gui/PrefixGUI.java @@ -87,11 +87,10 @@ public boolean click(int index, ClickType clickType, net.minecraft.world.invento NexiaPlayer player = new NexiaPlayer(this.player); - player.sendMessage( - ChatFormat.nexiaMessage - .append(net.kyori.adventure.text.Component.text("Your prefix has been set to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(net.kyori.adventure.text.Component.text(name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(net.kyori.adventure.text.Component.text(".").decoration(ChatFormat.bold, false)) + player.sendNexiaMessage( + net.kyori.adventure.text.Component.text("Your prefix has been set to: ", ChatFormat.normalColor) + .append(net.kyori.adventure.text.Component.text(name, ChatFormat.brandColor2)) + .append(net.kyori.adventure.text.Component.text(".", ChatFormat.normalColor)) ); for(NexiaRank rank : NexiaRank.ranks){ diff --git a/src/main/java/com/nexia/core/gui/RanksGUI.java b/src/main/java/com/nexia/core/gui/RanksGUI.java index c3a8d567..104dd5d4 100644 --- a/src/main/java/com/nexia/core/gui/RanksGUI.java +++ b/src/main/java/com/nexia/core/gui/RanksGUI.java @@ -88,23 +88,22 @@ public boolean click(int index, ClickType clickType, net.minecraft.world.invento NexiaPlayer nexiaPlayer = new NexiaPlayer(this.player); if(name.getString().contains("Supporter")){ - nexiaPlayer.sendMessage(ChatFormat.nexiaMessage.append( - net.kyori.adventure.text.Component.text("In order to get the ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(net.kyori.adventure.text.Component.text("Supporter").color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) - .append(net.kyori.adventure.text.Component.text(" rank, you need to either ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + nexiaPlayer.sendNexiaMessage( + net.kyori.adventure.text.Component.text("In order to get the ", ChatFormat.normalColor) + .append(net.kyori.adventure.text.Component.text("Supporter", ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(net.kyori.adventure.text.Component.text(" rank, you need to either ", ChatFormat.normalColor)) .append(net.kyori.adventure.text.Component.text("buy from our patreon") .color(TextColor.fromHexString("#f96b59")) .decoration(ChatFormat.bold, true) .hoverEvent(HoverEvent.showText(net.kyori.adventure.text.Component.text("Click me").color(TextColor.fromHexString("#f96b59")))) .clickEvent(ClickEvent.openUrl("https://www.patreon.com/Nexia"))) - .append(net.kyori.adventure.text.Component.text(" or ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + .append(net.kyori.adventure.text.Component.text(" or ", ChatFormat.normalColor)) .append(net.kyori.adventure.text.Component.text("boost our discord server") .color(TextColor.fromHexString("#8c00ff")) .decoration(ChatFormat.bold, true) .hoverEvent(HoverEvent.showText(net.kyori.adventure.text.Component.text("Click me").color(TextColor.fromHexString("#8c00ff")))) .clickEvent(ClickEvent.openUrl(NexiaDiscord.config.discordLink))) - .append(net.kyori.adventure.text.Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - ) + .append(net.kyori.adventure.text.Component.text(".", ChatFormat.normalColor)) ); } diff --git a/src/main/java/com/nexia/core/gui/duels/CustomDuelGUI.java b/src/main/java/com/nexia/core/gui/duels/CustomDuelGUI.java index dd033abb..416bd760 100644 --- a/src/main/java/com/nexia/core/gui/duels/CustomDuelGUI.java +++ b/src/main/java/com/nexia/core/gui/duels/CustomDuelGUI.java @@ -127,9 +127,9 @@ private void setMainLayout(ServerPlayer otherp){ ItemDisplayUtil.removeLore(item, 1); net.kyori.adventure.text.Component infoMsg = net.kyori.adventure.text.Component.text("INFO: ", ChatFormat.Minecraft.yellow).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true) - .append(net.kyori.adventure.text.Component.text("This kit is a ", ChatFormat.Minecraft.yellow)).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, false) + .append(net.kyori.adventure.text.Component.text("This kit is a ", ChatFormat.Minecraft.yellow)).decoration(ChatFormat.italic, false) .append(net.kyori.adventure.text.Component.text("per-custom ", ChatFormat.Minecraft.yellow)).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, true) - .append(net.kyori.adventure.text.Component.text("kit.", ChatFormat.Minecraft.yellow)).decoration(ChatFormat.italic, false).decoration(ChatFormat.bold, false); + .append(net.kyori.adventure.text.Component.text("kit.", ChatFormat.Minecraft.yellow)).decoration(ChatFormat.italic, false); if(inventory.equalsIgnoreCase("vanilla")) { item = new ItemStack(Items.RESPAWN_ANCHOR); diff --git a/src/main/java/com/nexia/core/gui/ffa/KitGUI.java b/src/main/java/com/nexia/core/gui/ffa/KitGUI.java index e14f0176..ac73acd3 100644 --- a/src/main/java/com/nexia/core/gui/ffa/KitGUI.java +++ b/src/main/java/com/nexia/core/gui/ffa/KitGUI.java @@ -61,7 +61,7 @@ public static void giveKit(ServerPlayer minecraftPlayer, String name) { NexiaPlayer player = new NexiaPlayer(minecraftPlayer); FfaKit kit = FfaKit.identifyKit(name); if(kit != null) kit.giveKit(new NexiaPlayer(minecraftPlayer), false); - else player.sendMessage(Component.text("Invalid kit!").color(ChatFormat.failColor)); + else player.sendMessage(Component.text("Invalid kit!", ChatFormat.failColor)); } public boolean click(int index, ClickType clickType, net.minecraft.world.inventory.ClickType action){ diff --git a/src/main/java/com/nexia/core/gui/ffa/SpawnGUI.java b/src/main/java/com/nexia/core/gui/ffa/SpawnGUI.java index 9fb1277d..4f10229d 100644 --- a/src/main/java/com/nexia/core/gui/ffa/SpawnGUI.java +++ b/src/main/java/com/nexia/core/gui/ffa/SpawnGUI.java @@ -4,6 +4,7 @@ import com.nexia.core.utilities.chat.ChatFormat; import com.nexia.core.utilities.item.ItemDisplayUtil; import com.nexia.ffa.kits.utilities.KitFfaAreas; +import com.nexia.nexus.api.world.util.Location; import eu.pb4.sgui.api.ClickType; import eu.pb4.sgui.api.elements.GuiElementInterface; import eu.pb4.sgui.api.gui.SimpleGui; @@ -22,7 +23,7 @@ public SpawnGUI(MenuType type, ServerPlayer player, boolean includePlayer) { super(type, player, includePlayer); } - public static HashMap mapLocations = new HashMap<>(); + public static HashMap mapLocations = new HashMap<>(); private void fillEmptySlots(ItemStack itemStack){ for(int i = 0; i < 45; i++){ @@ -108,18 +109,17 @@ private void setMainLayout(){ } public static void teleportPlayer(ServerPlayer minecraftPlayer, String name) { - int[] pos = mapLocations.get(name); + Location pos = mapLocations.get(name); NexiaPlayer player = new NexiaPlayer(minecraftPlayer); if(pos != null){ - minecraftPlayer.teleportTo(KitFfaAreas.ffaWorld, pos[0], pos[1], pos[2], pos[3], pos[4]); - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have been teleported to: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) + player.teleport(pos); + player.sendNexiaMessage( + Component.text("You have been teleported to: ", ChatFormat.normalColor) + .append(Component.text(name, ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) ); } else { - player.sendMessage(Component.text("Invalid biome!").color(ChatFormat.failColor)); + player.sendMessage(Component.text("Invalid biome!", ChatFormat.failColor)); } } @@ -157,15 +157,15 @@ public static void openSpawnGUI(ServerPlayer player) { // 115 40 -151 | Mushrooms // 0 40 0 | Plains (Center) - mapLocations.put("nether forest", new int[]{186, 49, -71, -133, -5}); - mapLocations.put("blackstone", new int[]{161, 57, 82, -130, -11}); - mapLocations.put("mesa", new int[]{74, 48, 169, 130, -1}); - mapLocations.put("savanna", new int[]{-166, 43, 50, 156, -3}); - mapLocations.put("snow", new int[]{-35, 47, -206, 51, 1}); - mapLocations.put("forest", new int[]{-174, 42, -38, 132, -2}); - mapLocations.put("desert", new int[]{-73, 41, 181, 121, -2}); - mapLocations.put("mushrooms", new int[]{115, 41, -151, -136, -1}); - mapLocations.put("plains", new int[]{0, 41, 0, 0, 0}); + mapLocations.put("nether forest", new Location(186, 49, -71, -133, -5, KitFfaAreas.nexusFfaWorld)); + mapLocations.put("blackstone", new Location(161, 57, 82, -130, -11, KitFfaAreas.nexusFfaWorld)); + mapLocations.put("mesa", new Location(74, 48, 169, 130, -1, KitFfaAreas.nexusFfaWorld)); + mapLocations.put("savanna", new Location(-166, 43, 50, 156, -3, KitFfaAreas.nexusFfaWorld)); + mapLocations.put("snow", new Location(-35, 47, -206, 51, 1, KitFfaAreas.nexusFfaWorld)); + mapLocations.put("forest", new Location(-174, 42, -38, 132, -2, KitFfaAreas.nexusFfaWorld)); + mapLocations.put("desert", new Location(-73, 41, 181, 121, -2, KitFfaAreas.nexusFfaWorld)); + mapLocations.put("mushrooms", new Location(115, 41, -151, -136, -1, KitFfaAreas.nexusFfaWorld)); + mapLocations.put("plains", new Location(0, 41, 0, 0, 0, KitFfaAreas.nexusFfaWorld)); } } \ No newline at end of file diff --git a/src/main/java/com/nexia/core/listeners/nexus/PlayerJoinListener.java b/src/main/java/com/nexia/core/listeners/nexus/PlayerJoinListener.java index 556fbf9b..4f526b0f 100644 --- a/src/main/java/com/nexia/core/listeners/nexus/PlayerJoinListener.java +++ b/src/main/java/com/nexia/core/listeners/nexus/PlayerJoinListener.java @@ -1,23 +1,22 @@ package com.nexia.core.listeners.nexus; +import com.nexia.base.player.NexiaPlayer; import com.nexia.base.player.PlayerData; import com.nexia.base.player.PlayerDataManager; import com.nexia.core.NexiaCore; -import com.nexia.core.utilities.player.CorePlayerData; -import com.nexia.nexus.api.event.player.PlayerJoinEvent; -import com.nexia.nexus.api.world.entity.player.Player; import com.nexia.core.games.util.LobbyUtil; import com.nexia.core.utilities.chat.ChatFormat; -import com.nexia.base.player.NexiaPlayer; +import com.nexia.core.utilities.player.CorePlayerData; import com.nexia.core.utilities.ranks.NexiaRank; import com.nexia.core.utilities.time.ServerTime; import com.nexia.discord.NexiaDiscord; +import com.nexia.nexus.api.event.player.PlayerJoinEvent; +import com.nexia.nexus.api.world.entity.player.Player; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; -import net.kyori.adventure.text.format.TextColor; import java.util.Objects; @@ -54,32 +53,33 @@ public void registerListener() { private static void sendJoinMessage(Player player){ player.sendMessage(ChatFormat.separatorLine("Welcome")); player.sendMessage( - Component.text(" » ").color(ChatFormat.brandColor2) - .append(Component.text("Welcome ").color(ChatFormat.normalColor)) - .append(Component.text(player.getRawName()).color(ChatFormat.brandColor2)) - .append(Component.text(" to ").color(ChatFormat.normalColor)) - .append(Component.text("Nexia").color(ChatFormat.brandColor2)) - .append(Component.text("!").color(ChatFormat.normalColor)) + Component.text(" » ", ChatFormat.brandColor2) + .append(Component.text("Welcome ", ChatFormat.normalColor)) + .append(Component.text(player.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(" to ", ChatFormat.normalColor)) + .append(Component.text("Nexia", ChatFormat.brandColor2)) + .append(Component.text("!", ChatFormat.normalColor)) ); player.sendMessage( - Component.text(" » ").color(ChatFormat.brandColor2) - .append(Component.text("Players online: ").color(ChatFormat.normalColor)) - .append(Component.text(ServerTime.minecraftServer.getPlayerCount()).color(ChatFormat.brandColor2)) + Component.text(" » ", ChatFormat.brandColor2) + .append(Component.text("Players online: ", ChatFormat.normalColor)) + .append(Component.text(ServerTime.minecraftServer.getPlayerCount(), ChatFormat.brandColor2)) .append(Component.text("/").color(ChatFormat.lineColor)) - .append(Component.text(ServerTime.nexusServer.getMaxPlayerCount()).color(ChatFormat.brandColor2)) + .append(Component.text(ServerTime.nexusServer.getMaxPlayerCount(), ChatFormat.brandColor2)) ); player.sendMessage( - Component.text(" » ").color(ChatFormat.brandColor2) - .append(Component.text("Read the rules: ").color(ChatFormat.normalColor)) - .append(Component.text("/rules")).color(ChatFormat.brandColor2).hoverEvent(HoverEvent.showText(Component.text("Click me").color(TextColor.fromHexString("#73ff54")))) - .clickEvent(ClickEvent.suggestCommand("/rules")) + Component.text(" » ", ChatFormat.brandColor2) + .append(Component.text("Read the rules: ", ChatFormat.normalColor)) + .append(Component.text("/rules", ChatFormat.brandColor2) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.Minecraft.green)))) + .clickEvent(ClickEvent.suggestCommand("/rules")) ); player.sendMessage( - Component.text(" » ").color(ChatFormat.brandColor2) - .append(Component.text("Join our discord: ").color(ChatFormat.normalColor)) + Component.text(" » ", ChatFormat.brandColor2) + .append(Component.text("Join our discord: ", ChatFormat.normalColor)) .append(Component.text(NexiaDiscord.config.discordLink) .color(ChatFormat.brandColor2) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(TextColor.fromHexString("#73ff54")))) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.Minecraft.green))) .clickEvent(ClickEvent.openUrl(NexiaDiscord.config.discordLink)) ) ); diff --git a/src/main/java/com/nexia/core/listeners/nexus/PlayerLeaveListener.java b/src/main/java/com/nexia/core/listeners/nexus/PlayerLeaveListener.java index 80b2f308..797f3c1d 100644 --- a/src/main/java/com/nexia/core/listeners/nexus/PlayerLeaveListener.java +++ b/src/main/java/com/nexia/core/listeners/nexus/PlayerLeaveListener.java @@ -15,9 +15,9 @@ public void registerListener() { if(NexiaCore.config.events.statusMessages){ playerDisconnectEvent.setLeaveMessage( Component.text("[").color(ChatFormat.lineColor) - .append(Component.text("-").color(ChatFormat.failColor) + .append(Component.text("-", ChatFormat.failColor) .append(Component.text("] ").color(ChatFormat.lineColor)) - .append(Component.text(player.getRawName()).color(ChatFormat.failColor))) + .append(Component.text(player.getRawName(), ChatFormat.failColor))) ); } diff --git a/src/main/java/com/nexia/core/mixin/player/PlayerListMixin.java b/src/main/java/com/nexia/core/mixin/player/PlayerListMixin.java index b361b591..50d8749c 100644 --- a/src/main/java/com/nexia/core/mixin/player/PlayerListMixin.java +++ b/src/main/java/com/nexia/core/mixin/player/PlayerListMixin.java @@ -146,9 +146,9 @@ private static Component leaveFormat(Component original, ServerPlayer leavePlaye return ObjectMappings.convertComponent( net.kyori.adventure.text.Component.text("[").color(ChatFormat.lineColor) - .append(net.kyori.adventure.text.Component.text("-").color(ChatFormat.failColor) + .append(net.kyori.adventure.text.Component.text("-", ChatFormat.failColor) .append(net.kyori.adventure.text.Component.text("] ").color(ChatFormat.lineColor)) - .append(net.kyori.adventure.text.Component.text(name).color(ChatFormat.failColor))) + .append(net.kyori.adventure.text.Component.text(name, ChatFormat.failColor))) ); } diff --git a/src/main/java/com/nexia/core/mixin/player/ServerGamePacketListenerMixin.java b/src/main/java/com/nexia/core/mixin/player/ServerGamePacketListenerMixin.java index 39e6b606..598a85b9 100644 --- a/src/main/java/com/nexia/core/mixin/player/ServerGamePacketListenerMixin.java +++ b/src/main/java/com/nexia/core/mixin/player/ServerGamePacketListenerMixin.java @@ -174,7 +174,7 @@ private void handlePlayerAction(ServerboundPlayerActionPacket actionPacket, Call private void handleSpectatorTeleport(ServerboundTeleportToEntityPacket packet, CallbackInfo ci) { NexiaPlayer nexiaPlayer = new NexiaPlayer(player); - net.kyori.adventure.text.Component noSpectateMSG = net.kyori.adventure.text.Component.text("You can't spectate players in other games.").color(ChatFormat.failColor); + net.kyori.adventure.text.Component noSpectateMSG = net.kyori.adventure.text.Component.text("You can't spectate players in other games.", ChatFormat.failColor); if (BwUtil.isInBedWars(nexiaPlayer)) { if (!BwPlayerEvents.spectatorTeleport(nexiaPlayer, packet)) { diff --git a/src/main/java/com/nexia/core/utilities/chat/PlayerMutes.java b/src/main/java/com/nexia/core/utilities/chat/PlayerMutes.java index e322cd47..5bb58f40 100644 --- a/src/main/java/com/nexia/core/utilities/chat/PlayerMutes.java +++ b/src/main/java/com/nexia/core/utilities/chat/PlayerMutes.java @@ -50,12 +50,11 @@ public static void mute(CommandSourceInfo sender, ServerPlayer muted, long durat .append(Component.text(mutedData.getMuteReason(), ChatFormat.brandColor2)) ); - new NexiaPlayer(muted).sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have been muted for ").decoration(ChatFormat.bold, false)) - .append(Component.text(muteTimeToText(mutedData.getMuteEnd())).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".\nReason: ").decoration(ChatFormat.bold, false)) - .append(Component.text(reason).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) + new NexiaPlayer(muted).sendNexiaMessage( + Component.text("You have been muted for ", ChatFormat.normalColor) + .append(Component.text(muteTimeToText(mutedData.getMuteEnd()), ChatFormat.brandColor2)) + .append(Component.text(".\nReason: ", ChatFormat.normalColor)) + .append(Component.text(reason, ChatFormat.brandColor2)) ); } @@ -65,22 +64,22 @@ public static void unMute(CommandSourceInfo sender, ServerPlayer unMuted) { LocalDateTime currentMuteTime = unMutedData.getMuteEnd(); if (LocalDateTime.now().isAfter(currentMuteTime)) { - sender.sendMessage(Component.text("This player is not muted.", ChatFormat.systemColor)); + sender.sendMessage(ChatFormat.nexiaMessage.append(Component.text("This player is not muted.", ChatFormat.normalColor))); return; } unMutedData.setMuteEnd(LocalDateTime.MIN); unMutedData.setMuteReason(null); - sender.sendMessage(Component.text("Unmuted ", ChatFormat.systemColor) - .append(Component.text(unMuted.getScoreboardName(), ChatFormat.brandColor2)) - .append(Component.text(".", ChatFormat.systemColor)) + sender.sendMessage( + ChatFormat.nexiaMessage.append( + Component.text("Unmuted ", ChatFormat.normalColor) + .append(Component.text(unMuted.getScoreboardName(), ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + ) ); - new NexiaPlayer(unMuted).sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have been unmuted.").decoration(ChatFormat.bold, false)) - ); + new NexiaPlayer(unMuted).sendNexiaMessage("You have been unmuted."); } public static boolean muted(NexiaPlayer player) { @@ -90,12 +89,10 @@ public static boolean muted(NexiaPlayer player) { if (LocalDateTime.now().isBefore(muteTime)) { - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have been muted for ").decoration(ChatFormat.bold, false)) - .append(Component.text(muteTimeToText(muteTime)).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".\nReason: ").decoration(ChatFormat.bold, false)) - .append(Component.text(reason).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) + player.sendNexiaMessage(Component.text("You have been muted for ", ChatFormat.normalColor) + .append(Component.text(muteTimeToText(muteTime), ChatFormat.brandColor2)) + .append(Component.text(".\nReason: ")) + .append(Component.text(reason, ChatFormat.brandColor2)) ); return true; } diff --git a/src/main/java/com/nexia/core/utilities/player/GamemodeBanHandler.java b/src/main/java/com/nexia/core/utilities/player/GamemodeBanHandler.java index 10679215..52a1d78e 100644 --- a/src/main/java/com/nexia/core/utilities/player/GamemodeBanHandler.java +++ b/src/main/java/com/nexia/core/utilities/player/GamemodeBanHandler.java @@ -133,12 +133,11 @@ public static void tryGamemodeBan(CommandSourceInfo sender, NexiaPlayer player, LobbyUtil.returnToLobby(player, true); - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have been gamemode (" + gameMode.name + ") banned for ").decoration(ChatFormat.bold, false)) - .append(Component.text(BanHandler.banTimeToText(banTime)).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".\nReason: ").decoration(ChatFormat.bold, false)) - .append(Component.text(reason).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) + player.sendNexiaMessage( + Component.text("You have been gamemode (" + gameMode.name + ") banned for ", ChatFormat.normalColor) + .append(Component.text(BanHandler.banTimeToText(banTime), ChatFormat.brandColor2)) + .append(Component.text(".\nReason: ", ChatFormat.normalColor)) + .append(Component.text(reason, ChatFormat.brandColor2)) ); } @@ -148,11 +147,14 @@ public static void tryUnGamemodeBan(CommandSourceInfo sender, NexiaPlayer player return; } - sender.sendMessage(Component.text("Un-gamemode-banned ", ChatFormat.systemColor) - .append(Component.text(player.getRawName(), ChatFormat.brandColor2)) - .append(Component.text(" in ", ChatFormat.systemColor)) - .append(Component.text(gameMode.name, ChatFormat.brandColor2)) - .append(Component.text(".")) + sender.sendMessage( + ChatFormat.nexiaMessage.append( + Component.text("Un-gamemode-banned ", ChatFormat.normalColor) + .append(Component.text(player.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(" in ", ChatFormat.normalColor)) + .append(Component.text(gameMode.name, ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + ) ); } } diff --git a/src/main/java/com/nexia/core/utilities/pos/ProtectionMap.java b/src/main/java/com/nexia/core/utilities/pos/ProtectionMap.java index ebf99cd1..80f8a943 100644 --- a/src/main/java/com/nexia/core/utilities/pos/ProtectionMap.java +++ b/src/main/java/com/nexia/core/utilities/pos/ProtectionMap.java @@ -58,12 +58,11 @@ private void createMap(ServerPlayer player, BlockPos corner1) { } } - new NexiaPlayer(player).sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Map created successfully with ").color(ChatFormat.normalColor) - .append(Component.text(blockCount).color(ChatFormat.brandColor2) - .append(Component.text(" protected blocks.").color(ChatFormat.normalColor)) - ) - )); + new NexiaPlayer(player).sendNexiaMessage( + Component.text("Map created successfully with ", ChatFormat.normalColor) + .append(Component.text(blockCount, ChatFormat.brandColor2)) + .append(Component.text(" protected blocks.", ChatFormat.normalColor)) + ); } private void exportMap(ServerPlayer mcPlayer, String filePath) { @@ -76,11 +75,12 @@ private void exportMap(ServerPlayer mcPlayer, String filePath) { fileWriter.write(json); fileWriter.close(); - player.sendMessage(ChatFormat.nexiaMessage.append(Component.text("Successfully exported protection map.").color(ChatFormat.normalColor))); + player.sendNexiaMessage("Successfully exported protection map."); } catch (Exception e) { e.printStackTrace(); - player.sendMessage(ChatFormat.nexiaMessage.append(Component.text("Failed to export protection map.").color(ChatFormat.failColor))); + player.sendNexiaMessage("Failed to export protection map."); + player.sendMessage(Component.text(e.getClass().getSimpleName() + ": " + e.getMessage(), ChatFormat.normalColor)); } } @@ -92,7 +92,7 @@ public static ProtectionMap importMap(String filePath, ProtectionBlock[] listedB Gson gson = new Gson(); map = gson.fromJson(possibleJson, byte[][][].class); } catch (Exception e) { - System.out.println(NexiaCore.MOD_NAME + ": Failed to import protection map from " + filePath); + NexiaCore.logger.error(NexiaCore.MOD_NAME + ": Failed to import protection map from {}", filePath); return null; } return new ProtectionMap(map, listedBlocks, notListedBlock, outsideMessage); @@ -127,7 +127,7 @@ public boolean canBuiltAt(BlockPos mapCorner1, BlockPos buildPos, ServerPlayer m if (mapPos.getX() < 0 || mapPos.getX() >= map.length || mapPos.getY() < 0 || mapPos.getY() >= map[0].length || mapPos.getZ() < 0 || mapPos.getZ() >= map[0][0].length) { - if (sendMessage) player.sendMessage(Component.text(outsideMessage).color(ChatFormat.failColor)); + if (sendMessage) player.sendMessage(Component.text(outsideMessage, ChatFormat.failColor)); return false; } @@ -135,7 +135,7 @@ public boolean canBuiltAt(BlockPos mapCorner1, BlockPos buildPos, ServerPlayer m ProtectionBlock protectionBlock = this.getMappingBlock(id); if (!protectionBlock.canBuild) { - if (sendMessage) player.sendMessage(Component.text(protectionBlock.noBuildMessage).color(ChatFormat.failColor)); + if (sendMessage) player.sendMessage(Component.text(protectionBlock.noBuildMessage, ChatFormat.failColor)); return false; } return true; diff --git a/src/main/java/com/nexia/discord/commands/discord/LinkSlashCommand.java b/src/main/java/com/nexia/discord/commands/discord/LinkSlashCommand.java index a70013f6..361444a8 100644 --- a/src/main/java/com/nexia/discord/commands/discord/LinkSlashCommand.java +++ b/src/main/java/com/nexia/discord/commands/discord/LinkSlashCommand.java @@ -87,9 +87,7 @@ public void commandTriggered(SlashCommandInteractionEvent event) { player.sendMessage( ChatFormat.nexiaMessage - .append(Component.text("Your account has been linked with the discord user: ") - .decoration(ChatFormat.bold, false) - .color(ChatFormat.normalColor) + .append(Component.text("Your account has been linked with the discord user: ", ChatFormat.normalColor) .append(Component.text("@" + user.getName()) .color(ChatFormat.brandColor1) .decoration(ChatFormat.bold, true)) diff --git a/src/main/java/com/nexia/discord/commands/minecraft/LinkCommand.java b/src/main/java/com/nexia/discord/commands/minecraft/LinkCommand.java index 6821024f..2e0d94d8 100644 --- a/src/main/java/com/nexia/discord/commands/minecraft/LinkCommand.java +++ b/src/main/java/com/nexia/discord/commands/minecraft/LinkCommand.java @@ -38,8 +38,8 @@ public static int run(CommandContext context) throws CommandS LinkSlashCommand.idMinecraft.put(id, player.getUUID()); player.sendNexiaMessage( - Component.text("Your code is: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(id).color(ChatFormat.brandColor1) + Component.text("Your code is: ", ChatFormat.normalColor) + .append(Component.text(id, ChatFormat.brandColor1) .decoration(ChatFormat.bold, true) .hoverEvent(HoverEvent.showText(Component.text("Click me to copy").color(ChatFormat.greenColor))) .clickEvent(ClickEvent.copyToClipboard(String.valueOf(id))) diff --git a/src/main/java/com/nexia/ffa/FfaUtil.java b/src/main/java/com/nexia/ffa/FfaUtil.java index 8098812d..8c04bb13 100644 --- a/src/main/java/com/nexia/ffa/FfaUtil.java +++ b/src/main/java/com/nexia/ffa/FfaUtil.java @@ -100,35 +100,35 @@ public static Component returnDeathMessage(@NotNull NexiaPlayer player, @Nullabl String name = player.getRawName(); Component invalid = Component.text("Wow,").color(ChatFormat.chatColor2) - .append(Component.text(" ☠ " + name).color(ChatFormat.failColor)) + .append(Component.text(" ☠ " + name, ChatFormat.failColor)) .append(Component.text(" somehow killed themselves.").color(ChatFormat.chatColor2)); if(source == null) return invalid; if (source == DamageSource.OUT_OF_WORLD) { - return Component.text("⚐ " + name).color(ChatFormat.failColor) + return Component.text("⚐ " + name, ChatFormat.failColor) .append(Component.text(" took a ride to the void.").color(ChatFormat.chatColor2)); } else if (source == DamageSource.LAVA) { - return Component.text("\uD83D\uDD25 " + name).color(ChatFormat.failColor) + return Component.text("\uD83D\uDD25 " + name, ChatFormat.failColor) .append(Component.text(" was deepfried in lava.").color(ChatFormat.chatColor2)); } else if (source == DamageSource.HOT_FLOOR) { - return Component.text("\uD83D\uDD25 " + name).color(ChatFormat.failColor) + return Component.text("\uD83D\uDD25 " + name, ChatFormat.failColor) .append(Component.text(" stepped on hot legos.").color(ChatFormat.chatColor2)); } else if (source == DamageSource.IN_FIRE || source == DamageSource.ON_FIRE) { - return Component.text("\uD83D\uDD25 " + name).color(ChatFormat.failColor) + return Component.text("\uD83D\uDD25 " + name, ChatFormat.failColor) .append(Component.text(" comBusted.").color(ChatFormat.chatColor2)); } else if (source == DamageSource.FALL) { - return Component.text("⚓ " + name).color(ChatFormat.failColor) + return Component.text("⚓ " + name, ChatFormat.failColor) .append(Component.text(" turned into a human doormat.").color(ChatFormat.chatColor2)); } else if (source == DamageSource.CACTUS) { return Component.text("ʕっ·ᴥ·ʔっ ").color(ChatFormat.chatColor2) - .append(Component.text("☠ " + name).color(ChatFormat.failColor)) + .append(Component.text("☠ " + name, ChatFormat.failColor)) .append(Component.text(" hugged a cactus.").color(ChatFormat.chatColor2)); } else if (source == DamageSource.DROWN || source == DamageSource.DRY_OUT) { - return Component.text("\uD83C\uDF0A " + name).color(ChatFormat.failColor) + return Component.text("\uD83C\uDF0A " + name, ChatFormat.failColor) .append(Component.text(" had a bit too much to drink.").color(ChatFormat.chatColor2)); } else if (source == DamageSource.MAGIC) { - return Component.text("\uD83E\uDDEA " + name).color(ChatFormat.failColor) + return Component.text("\uD83E\uDDEA " + name, ChatFormat.failColor) .append(Component.text(" had a bit too much pot.").color(ChatFormat.chatColor2)); } @@ -155,11 +155,11 @@ public static Component returnClassicDeathMessage(@NotNull NexiaPlayer player, @ } - return Component.text("☠ " + player.getRawName()).color(ChatFormat.failColor) + return Component.text("☠ " + player.getRawName(), ChatFormat.failColor) .append(Component.text(" was killed by ").color(ChatFormat.chatColor2)) .append(Component.text(symbol + " " + attacker.getRawName()).color(ChatFormat.greenColor)) .append(Component.text(" with ").color(ChatFormat.chatColor2)) - .append(Component.text(FfaUtil.calculateHealth(attacker.getHealth()) + "❤").color(ChatFormat.failColor)) + .append(Component.text(FfaUtil.calculateHealth(attacker.getHealth()) + "❤", ChatFormat.failColor)) .append(Component.text(" left.").color(ChatFormat.chatColor2)); } diff --git a/src/main/java/com/nexia/ffa/base/BaseFfaUtil.java b/src/main/java/com/nexia/ffa/base/BaseFfaUtil.java index cff2a209..d3d3fb93 100644 --- a/src/main/java/com/nexia/ffa/base/BaseFfaUtil.java +++ b/src/main/java/com/nexia/ffa/base/BaseFfaUtil.java @@ -127,7 +127,7 @@ public void saveInventory(NexiaPlayer player){ fileWriter.close(); } catch (Exception var6) { LobbyUtil.returnToLobby(player, true); - player.sendMessage(Component.text("Failed to save " + getName() + " FFA inventory. Please try again or contact a developer.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("Failed to save " + getName() + " FFA inventory. Please try again or contact a developer.", ChatFormat.failColor)); } } @@ -152,11 +152,11 @@ public void calculateKill(NexiaPlayer attacker, NexiaPlayer player) { for (ServerPlayer serverPlayer : getFfaWorld().players()) { new NexiaPlayer(serverPlayer).sendMessage( Component.text("[").color(ChatFormat.lineColor) - .append(Component.text("☠").color(ChatFormat.failColor)) + .append(Component.text("☠", ChatFormat.failColor)) .append(Component.text("] ").color(ChatFormat.lineColor)) - .append(Component.text(attacker.getRawName()).color(ChatFormat.normalColor)) + .append(Component.text(attacker.getRawName(), ChatFormat.normalColor)) .append(Component.text(" now has a killstreak of ").color(ChatFormat.chatColor2)) - .append(Component.text(killstreak).color(ChatFormat.failColor).decoration(ChatFormat.bold, true)) + .append(Component.text(killstreak, ChatFormat.failColor).decoration(ChatFormat.bold, true)) .append(Component.text("!").color(ChatFormat.chatColor2)) ); } @@ -186,11 +186,11 @@ public void calculateDeath(NexiaPlayer player){ for (ServerPlayer serverPlayer : getFfaWorld().players()) { new NexiaPlayer(serverPlayer).sendMessage( Component.text("[").color(ChatFormat.lineColor) - .append(Component.text("☠").color(ChatFormat.failColor)) + .append(Component.text("☠", ChatFormat.failColor)) .append(Component.text("] ").color(ChatFormat.lineColor)) - .append(Component.text(player.getRawName()).color(ChatFormat.normalColor)) + .append(Component.text(player.getRawName(), ChatFormat.normalColor)) .append(Component.text(" has lost their killstreak of ").color(ChatFormat.chatColor2)) - .append(Component.text(killstreak).color(ChatFormat.failColor).decoration(ChatFormat.bold, true)) + .append(Component.text(killstreak, ChatFormat.failColor).decoration(ChatFormat.bold, true)) .append(Component.text(".").color(ChatFormat.chatColor2)) ); } @@ -256,7 +256,7 @@ public void setInventory(NexiaPlayer player){ if(defaultInventory == null) { LobbyUtil.returnToLobby(player, true); - player.sendMessage(Component.text("Failed to set " + getName() + " FFA inventory. Please try again or contact a developer.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("Failed to set " + getName() + " FFA inventory. Please try again or contact a developer.", ChatFormat.failColor)); return; } diff --git a/src/main/java/com/nexia/ffa/classic/utilities/FfaClassicUtil.java b/src/main/java/com/nexia/ffa/classic/utilities/FfaClassicUtil.java index f061c235..2929e7cd 100644 --- a/src/main/java/com/nexia/ffa/classic/utilities/FfaClassicUtil.java +++ b/src/main/java/com/nexia/ffa/classic/utilities/FfaClassicUtil.java @@ -63,7 +63,7 @@ public void completeFiveTick(NexiaPlayer player) { if(wasInSpawn.contains(player.getUUID()) && !isInFfaSpawn(player)){ wasInSpawn.remove(player.getUUID()); saveInventory(player); - player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your inventory layout was saved.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your inventory layout was saved.", ChatFormat.normalColor))); } } diff --git a/src/main/java/com/nexia/ffa/kits/utilities/FfaKitsUtil.java b/src/main/java/com/nexia/ffa/kits/utilities/FfaKitsUtil.java index ce30e6f5..4a210661 100644 --- a/src/main/java/com/nexia/ffa/kits/utilities/FfaKitsUtil.java +++ b/src/main/java/com/nexia/ffa/kits/utilities/FfaKitsUtil.java @@ -44,7 +44,7 @@ public void doPreKill(NexiaPlayer attacker, NexiaPlayer player) { @Override public void completeFiveTick(NexiaPlayer player) { if(!isInFfaSpawn(player) && ((KitFFAPlayerData) PlayerDataManager.getDataManager(NexiaCore.FFA_KITS_DATA_MANAGER).get(player)).kit == null) { - player.sendTitle(Title.title(Component.text("No kit selected!").color(ChatFormat.failColor), Component.text("You need to select a kit!").color(ChatFormat.failColor))); + player.sendTitle(Title.title(Component.text("No kit selected!", ChatFormat.failColor), Component.text("You need to select a kit!", ChatFormat.failColor))); player.playSound(Minecraft.Sound.NOTE_BLOCK_DIDGERIDOO, 10, 1); sendToSpawn(player); return; @@ -52,7 +52,7 @@ public void completeFiveTick(NexiaPlayer player) { if(wasInSpawn.contains(player.getUUID()) && !isInFfaSpawn(player)){ wasInSpawn.remove(player.getUUID()); - player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your kit was saved.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your kit was saved.", ChatFormat.normalColor))); } } diff --git a/src/main/java/com/nexia/ffa/pot/utilities/FfaPotUtil.java b/src/main/java/com/nexia/ffa/pot/utilities/FfaPotUtil.java index fac696c4..87663f83 100644 --- a/src/main/java/com/nexia/ffa/pot/utilities/FfaPotUtil.java +++ b/src/main/java/com/nexia/ffa/pot/utilities/FfaPotUtil.java @@ -35,7 +35,7 @@ public void completeFiveTick(NexiaPlayer player) { if(wasInSpawn.contains(player.getUUID()) && !isInFfaSpawn(player)){ wasInSpawn.remove(player.getUUID()); saveInventory(player); - player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your inventory layout was saved.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your inventory layout was saved.", ChatFormat.normalColor))); } } diff --git a/src/main/java/com/nexia/ffa/sky/utilities/FfaSkyUtil.java b/src/main/java/com/nexia/ffa/sky/utilities/FfaSkyUtil.java index 10d89da7..1732b8a1 100644 --- a/src/main/java/com/nexia/ffa/sky/utilities/FfaSkyUtil.java +++ b/src/main/java/com/nexia/ffa/sky/utilities/FfaSkyUtil.java @@ -72,7 +72,7 @@ public void completeFiveTick(NexiaPlayer player) { wasInSpawn.remove(player.getUUID()); player.unwrap().getCooldowns().addCooldown(Items.ENDER_PEARL, 10); saveInventory(player); - player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your inventory layout was saved.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your inventory layout was saved.", ChatFormat.normalColor))); } } @@ -151,18 +151,18 @@ public void giveKillLoot(NexiaPlayer attacker, NexiaPlayer player) { // Inform player about given rewards attacker.sendMessage(Component.text("[").color(ChatFormat.arrowColor) - .append(Component.text("☠").color(ChatFormat.brandColor1)) + .append(Component.text("☠", ChatFormat.brandColor1)) .append(Component.text("] ").color(ChatFormat.arrowColor)) - .append(Component.text(player.getRawName()).color(ChatFormat.brandColor2)) + .append(Component.text(player.getRawName(), ChatFormat.brandColor2)) ); for (ItemStack givenReward : givenRewards) { String itemName = LegacyChatFormat.removeColors(givenReward.getHoverName().getString()); if (givenReward.getCount() > 1) itemName += "s"; attacker.sendMessage(Component.text("[").color(ChatFormat.arrowColor) - .append(Component.text("+" + givenReward.getCount()).color(ChatFormat.brandColor1)) + .append(Component.text("+" + givenReward.getCount(), ChatFormat.brandColor1)) .append(Component.text("] ").color(ChatFormat.arrowColor)) - .append(Component.text(itemName).color(ChatFormat.brandColor2)) + .append(Component.text(itemName, ChatFormat.brandColor2)) ); } attacker.sendSound(SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.MASTER, 0.75f, 1f); diff --git a/src/main/java/com/nexia/ffa/sky/utilities/SkyFfaAreas.java b/src/main/java/com/nexia/ffa/sky/utilities/SkyFfaAreas.java index 2ce4dc9e..31029cef 100644 --- a/src/main/java/com/nexia/ffa/sky/utilities/SkyFfaAreas.java +++ b/src/main/java/com/nexia/ffa/sky/utilities/SkyFfaAreas.java @@ -106,7 +106,7 @@ public static float getVoidY() { public static boolean canBuild(NexiaPlayer player, BlockPos blockPos) { if (protectionMap == null) { - player.sendMessage(Component.text("Something went wrong, please inform the admins").color(ChatFormat.failColor)); + player.sendMessage(Component.text("Something went wrong, please inform the admins", ChatFormat.failColor)); return false; } diff --git a/src/main/java/com/nexia/ffa/uhc/utilities/FfaUhcUtil.java b/src/main/java/com/nexia/ffa/uhc/utilities/FfaUhcUtil.java index 8891a8d4..dae0f41e 100644 --- a/src/main/java/com/nexia/ffa/uhc/utilities/FfaUhcUtil.java +++ b/src/main/java/com/nexia/ffa/uhc/utilities/FfaUhcUtil.java @@ -46,7 +46,7 @@ public void completeFiveTick(NexiaPlayer player) { if (wasInSpawn.contains(player.getUUID()) && !isInFfaSpawn(player)) { wasInSpawn.remove(player.getUUID()); saveInventory(player); - player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your inventory layout was saved.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + player.sendActionBarMessage(ChatFormat.nexiaMessage.append(Component.text("Your inventory layout was saved.", ChatFormat.normalColor))); } } diff --git a/src/main/java/com/nexia/minigames/games/bedwars/BwGame.java b/src/main/java/com/nexia/minigames/games/bedwars/BwGame.java index 8e2ae6e5..c1bf52d2 100644 --- a/src/main/java/com/nexia/minigames/games/bedwars/BwGame.java +++ b/src/main/java/com/nexia/minigames/games/bedwars/BwGame.java @@ -104,7 +104,7 @@ private static void respawnTick() { if (timeLeft % 20 == 0) { player.sendTitle(Title.title(Component.text("You died!").color(ChatFormat.Minecraft.red), Component.text("Respawning in ").color(ChatFormat.Minecraft.gray) - .append(Component.text(timeLeft / 20).color(ChatFormat.brandColor2)) + .append(Component.text(timeLeft / 20, ChatFormat.brandColor2)) .append(Component.text("...").color(ChatFormat.Minecraft.gray)), Title.Times.of(Duration.ofMillis(0), Duration.ofSeconds(1), Duration.ofMillis(0)) )); @@ -151,7 +151,7 @@ private static void queueSecond() { } else if (announcedQueueSeconds.contains(queueCountdown)) { for(NexiaPlayer player : queueList) { player.sendMessage(Component.text("The game will start in ").color(ChatFormat.Minecraft.gray) - .append(Component.text(queueCountdown).color(ChatFormat.brandColor2) + .append(Component.text(queueCountdown, ChatFormat.brandColor2) .append(Component.text( " seconds.").color(ChatFormat.Minecraft.gray))) ); } diff --git a/src/main/java/com/nexia/minigames/games/bedwars/areas/BwAreas.java b/src/main/java/com/nexia/minigames/games/bedwars/areas/BwAreas.java index da4269da..42ed0f41 100644 --- a/src/main/java/com/nexia/minigames/games/bedwars/areas/BwAreas.java +++ b/src/main/java/com/nexia/minigames/games/bedwars/areas/BwAreas.java @@ -89,14 +89,14 @@ public static boolean canBuildAt(@Nullable NexiaPlayer player, BlockPos blockPos if (protectionMap == null) { if (sendMessage) { - player.sendMessage(Component.text("An error occurred, please inform the admins.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("An error occurred, please inform the admins.", ChatFormat.failColor)); } return false; } if ((player != null && !isBedWarsWorld(player.unwrap().getLevel())) || !isInsideBorder(mapPos, protectionMap.map)) { if (sendMessage) { - player.sendMessage(Component.text("You have reached the built limit.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You have reached the built limit.", ChatFormat.failColor)); } return false; } diff --git a/src/main/java/com/nexia/minigames/games/bedwars/players/BwPlayerEvents.java b/src/main/java/com/nexia/minigames/games/bedwars/players/BwPlayerEvents.java index 61a11454..d779c189 100644 --- a/src/main/java/com/nexia/minigames/games/bedwars/players/BwPlayerEvents.java +++ b/src/main/java/com/nexia/minigames/games/bedwars/players/BwPlayerEvents.java @@ -56,13 +56,13 @@ public class BwPlayerEvents { public static void tryToJoin(NexiaPlayer player, boolean throughEvent) { if (BwUtil.isInBedWars(player)) { - //player.sendMessage(Component.text("You are already in the game.").color(ChatFormat.failColor)); + //player.sendMessage(Component.text("You are already in the game.", ChatFormat.failColor)); LobbyUtil.returnToLobby(player, false); tryToJoin(player, throughEvent); return; } if (BwGame.queueList.size() >= BwGame.maxPlayerCount) { - player.sendMessage(Component.text("The game is full.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("The game is full.", ChatFormat.failColor)); LobbyUtil.returnToLobby(player, false); return; } @@ -76,7 +76,7 @@ public static void tryToJoin(NexiaPlayer player, boolean throughEvent) { public static boolean spectatorTeleport(NexiaPlayer player, ServerboundTeleportToEntityPacket packet) { if (BwUtil.isBedWarsPlayer(player)) { - player.sendMessage(Component.text("You can't spectate others while in the game.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You can't spectate others while in the game.", ChatFormat.failColor)); return false; } @@ -86,7 +86,7 @@ public static boolean spectatorTeleport(NexiaPlayer player, ServerboundTeleportT NexiaPlayer nexiaTarget = new NexiaPlayer(target); if (!BwUtil.isBedWarsPlayer(nexiaTarget)) { - player.sendMessage(Component.text("You can't spectate players in other games.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You can't spectate players in other games.", ChatFormat.failColor)); return false; } } diff --git a/src/main/java/com/nexia/minigames/games/bedwars/players/BwTeam.java b/src/main/java/com/nexia/minigames/games/bedwars/players/BwTeam.java index 9b905f0c..b4a142e9 100644 --- a/src/main/java/com/nexia/minigames/games/bedwars/players/BwTeam.java +++ b/src/main/java/com/nexia/minigames/games/bedwars/players/BwTeam.java @@ -275,7 +275,7 @@ public void announceBedBreak(NexiaPlayer breaker, BlockPos blockPos) { } for(NexiaPlayer player : players) { - player.sendTitle(Title.title(Component.text("Bed Destroyed").color(ChatFormat.failColor), Component.text(""), Title.Times.of(Duration.ofMillis(0), Duration.ofSeconds(1), Duration.ofMillis(0)))); + player.sendTitle(Title.title(Component.text("Bed Destroyed", ChatFormat.failColor), Component.text(""), Title.Times.of(Duration.ofMillis(0), Duration.ofSeconds(1), Duration.ofMillis(0)))); } BwScoreboard.updateScoreboard(); diff --git a/src/main/java/com/nexia/minigames/games/bedwars/shop/BwShop.java b/src/main/java/com/nexia/minigames/games/bedwars/shop/BwShop.java index 4dee7b4f..7a27d3f9 100644 --- a/src/main/java/com/nexia/minigames/games/bedwars/shop/BwShop.java +++ b/src/main/java/com/nexia/minigames/games/bedwars/shop/BwShop.java @@ -128,7 +128,7 @@ private void purchase(ServerPlayer player, ItemStack soldItem, ItemStack cost, i } public static void sendFail(ServerPlayer player, String text) { - new NexiaPlayer(player).sendMessage(Component.text(text).color(ChatFormat.failColor)); + new NexiaPlayer(player).sendMessage(Component.text(text, ChatFormat.failColor)); playPurchaseSound(player, true); } diff --git a/src/main/java/com/nexia/minigames/games/duels/DuelsGame.java b/src/main/java/com/nexia/minigames/games/duels/DuelsGame.java index c46de126..4a6b3b16 100644 --- a/src/main/java/com/nexia/minigames/games/duels/DuelsGame.java +++ b/src/main/java/com/nexia/minigames/games/duels/DuelsGame.java @@ -123,14 +123,13 @@ public static DuelsGame startGame(NexiaPlayer p1, NexiaPlayer p2, String stringG removeQueue(p1, null, true); removeQueue(p2, null, true); + p1.sendNexiaMessage( + Component.text("Your opponent: ", ChatFormat.normalColor) + .append(Component.text(p2.getRawName(), ChatFormat.brandColor2))); - p2.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Your opponent: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(p1.getRawName()).color(ChatFormat.brandColor2)))); - - p1.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Your opponent: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(p2.getRawName()).color(ChatFormat.brandColor2)))); + p2.sendNexiaMessage( + Component.text("Your opponent: ", ChatFormat.normalColor) + .append(Component.text(p1.getRawName(), ChatFormat.brandColor2))); DuelGameHandler.loadInventory(p1, stringGameMode); DuelGameHandler.loadInventory(p2, stringGameMode); @@ -255,8 +254,8 @@ public void endGame(@NotNull NexiaPlayer victim, @Nullable NexiaPlayer attacker, Component win = Component.text("The game was a ") .color(ChatFormat.normalColor) - .append(Component.text("draw").color(ChatFormat.brandColor2)) - .append(Component.text("!").color(ChatFormat.normalColor) + .append(Component.text("draw", ChatFormat.brandColor2)) + .append(Component.text("!", ChatFormat.normalColor) ); Component titleLose = Component.text("Draw") @@ -268,27 +267,27 @@ public void endGame(@NotNull NexiaPlayer victim, @Nullable NexiaPlayer attacker, if (!attackerNull) { - win = Component.text(attacker.getRawName()).color(ChatFormat.brandColor2) - .append(Component.text(" has won the duel!").color(ChatFormat.normalColor) + win = Component.text(attacker.getRawName(), ChatFormat.brandColor2) + .append(Component.text(" has won the duel!", ChatFormat.normalColor) .append(Component.text(" [") .color(ChatFormat.lineColor)) - .append(Component.text(FfaUtil.calculateHealth(attacker.getHealth()) + "❤").color(ChatFormat.failColor)) + .append(Component.text(FfaUtil.calculateHealth(attacker.getHealth()) + "❤", ChatFormat.failColor)) .append(Component.text("]").color(ChatFormat.lineColor)) ); - titleLose = Component.text("You lost!").color(ChatFormat.brandColor2); + titleLose = Component.text("You lost!", ChatFormat.brandColor2); subtitleLose = Component.text("You have lost against ") .color(ChatFormat.normalColor) .append(Component.text(attacker.getRawName()) .color(ChatFormat.brandColor2) .append(Component.text(" [") .color(ChatFormat.lineColor) - .append(Component.text(FfaUtil.calculateHealth(attacker.getHealth()) + "❤").color(ChatFormat.failColor)) + .append(Component.text(FfaUtil.calculateHealth(attacker.getHealth()) + "❤", ChatFormat.failColor)) .append(Component.text("]").color(ChatFormat.lineColor)) ) ); - titleWin = Component.text("You won!").color(ChatFormat.brandColor2); + titleWin = Component.text("You won!", ChatFormat.brandColor2); subtitleWin = Component.text("You have won against ") .color(ChatFormat.normalColor) .append(Component.text(victim.getRawName()) diff --git a/src/main/java/com/nexia/minigames/games/duels/custom/CustomDuelsGame.java b/src/main/java/com/nexia/minigames/games/duels/custom/CustomDuelsGame.java index 321b3c10..de6823f2 100644 --- a/src/main/java/com/nexia/minigames/games/duels/custom/CustomDuelsGame.java +++ b/src/main/java/com/nexia/minigames/games/duels/custom/CustomDuelsGame.java @@ -80,13 +80,14 @@ public static CustomDuelsGame startGame(NexiaPlayer p1, NexiaPlayer p2, String k removeQueue(p2, null, true); - p2.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Your opponent: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(p1.getRawName()).color(ChatFormat.brandColor2)))); + p1.sendNexiaMessage( + Component.text("Your opponent: ", ChatFormat.normalColor) + .append(Component.text(p2.getRawName(), ChatFormat.brandColor2))); + + p2.sendNexiaMessage( + Component.text("Your opponent: ", ChatFormat.normalColor) + .append(Component.text(p1.getRawName(), ChatFormat.brandColor2))); - p1.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Your opponent: ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(p2.getRawName())).color(ChatFormat.brandColor2))); File p1File = new File(InventoryUtil.dirpath + File.separator + "duels" + File.separator + "custom" + File.separator + p1.getUUID(), kitID.toLowerCase() + ".txt"); if (p1File.exists()) { diff --git a/src/main/java/com/nexia/minigames/games/duels/custom/team/CustomTeamDuelsGame.java b/src/main/java/com/nexia/minigames/games/duels/custom/team/CustomTeamDuelsGame.java index a425bbf2..cd356f92 100644 --- a/src/main/java/com/nexia/minigames/games/duels/custom/team/CustomTeamDuelsGame.java +++ b/src/main/java/com/nexia/minigames/games/duels/custom/team/CustomTeamDuelsGame.java @@ -84,11 +84,10 @@ public static CustomTeamDuelsGame startGame(@NotNull DuelsTeam team1, @NotNull D selectedMap.p1Pos.teleportPlayer(duelLevel, serverPlayer); - player.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Your opponent: ").color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false) - .append(Component.text(team2.getLeader().getRawName() + "'s Team") - .color(ChatFormat.brandColor2)))); + player.sendNexiaMessage( + Component.text("Your opponent: ", ChatFormat.normalColor) + .append(Component.text(team2.getLeader().getRawName() + "'s Team", ChatFormat.brandColor2)) + ); if(kitFile.exists()) InventoryUtil.loadInventory(player, "duels/custom/" + team1.getLeader().getUUID(), kitID.toLowerCase()); else InventoryUtil.loadInventory(player, "duels", "classic"); @@ -113,12 +112,10 @@ public static CustomTeamDuelsGame startGame(@NotNull DuelsTeam team1, @NotNull D selectedMap.p2Pos.teleportPlayer(duelLevel, serverPlayer); - player.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Your opponent: ").color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false) - .append(Component.text(team1.getLeader().getRawName() + "'s Team") - .color(ChatFormat.brandColor2)))); - + player.sendNexiaMessage( + Component.text("Your opponent: ", ChatFormat.normalColor) + .append(Component.text(team1.getLeader().getRawName() + "'s Team", ChatFormat.brandColor2)) + ); if(game.perCustomDuel) { if(p2File != null && p2File.exists()) InventoryUtil.loadInventory(player, "duels/custom/" + team2.getLeader().getUUID(), perCustomKitID.toLowerCase()); diff --git a/src/main/java/com/nexia/minigames/games/duels/gamemodes/GamemodeHandler.java b/src/main/java/com/nexia/minigames/games/duels/gamemodes/GamemodeHandler.java index f6ab928f..32b1a264 100644 --- a/src/main/java/com/nexia/minigames/games/duels/gamemodes/GamemodeHandler.java +++ b/src/main/java/com/nexia/minigames/games/duels/gamemodes/GamemodeHandler.java @@ -22,7 +22,6 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; -import net.kyori.adventure.text.format.NamedTextColor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,22 +48,22 @@ public static void joinQueue(NexiaPlayer player, String stringGameMode, boolean DuelGameMode gameMode = GamemodeHandler.identifyGamemode(stringGameMode); if (gameMode == null) { - if (!silent) player.sendMessage(Component.text("Invalid gamemode!").color(ChatFormat.failColor)); + if (!silent) player.sendMessage(Component.text("Invalid gamemode!", ChatFormat.failColor)); return; } DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if (data.duelOptions.duelsTeam != null) { - if (!silent) player.sendMessage(Component.text("You are in a team!").color(ChatFormat.failColor)); + if (!silent) player.sendMessage(Component.text("You are in a team!", ChatFormat.failColor)); return; } if (!silent) { player.sendMessage( - Component.text("You have queued up for ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(stringGameMode.toUpperCase()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".").decoration(ChatFormat.bold, false)) + Component.text("You have queued up for ", ChatFormat.normalColor) + .append(Component.text(stringGameMode.toUpperCase(), ChatFormat.brandColor2)) + .append(Component.text(".")) ); } @@ -87,19 +86,18 @@ public static void removeQueue(NexiaPlayer player, @Nullable String stringGameMo DuelGameMode gameMode = GamemodeHandler.identifyGamemode(stringGameMode); if (gameMode == null) { - if (!silent) player.sendMessage(Component.text("Invalid gamemode!").color(ChatFormat.failColor)); + if (!silent) player.sendMessage(Component.text("Invalid gamemode!", ChatFormat.failColor)); return; } gameMode.queue.remove(player); if (!silent) { - player.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have left the queue for ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(stringGameMode.toUpperCase()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - )); + player.sendNexiaMessage( + Component.text("You have left the queue for ", ChatFormat.normalColor) + .append(Component.text(stringGameMode.toUpperCase(), ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + ); } } @@ -107,14 +105,14 @@ public static void removeQueue(NexiaPlayer player, @Nullable String stringGameMo public static void spectatePlayer(@NotNull NexiaPlayer executor, @NotNull NexiaPlayer player) { if (executor.equals(player)) { - executor.sendMessage(Component.text("You may not spectate yourself!").color(ChatFormat.failColor)); + executor.sendNexiaMessage("You may not spectate yourself!"); return; } DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if (playerData.gameOptions == null || (!playerData.inDuel && playerData.gameOptions.teamDuelsGame == null && playerData.gameOptions.duelsGame == null)) { - executor.sendMessage(Component.text("That player is not in a duel!").color(ChatFormat.failColor)); + executor.sendNexiaMessage("That player is not in a duel!"); return; } @@ -127,7 +125,7 @@ public static void spectatePlayer(@NotNull NexiaPlayer executor, @NotNull NexiaP /* if(playerData.teamDuelsGame != null) { - nexusExecutor.sendMessage(Component.text("Spectating Team Duels is currently not available. We are sorry for the inconvenience.").color(ChatFormat.failColor)); + nexusExecutor.sendMessage(Component.text("Spectating Team Duels is currently not available. We are sorry for the inconvenience.", ChatFormat.failColor)); return; } */ @@ -155,16 +153,9 @@ public static void spectatePlayer(@NotNull NexiaPlayer executor, @NotNull NexiaP } - executor.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You are now spectating ") - .color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false) - .append(Component.text(player.getRawName()) - .color(ChatFormat.brandColor1) - .decoration(ChatFormat.bold, true) - ) - ) + executor.sendNexiaMessage( + Component.text("You are now spectating ", ChatFormat.normalColor) + .append(Component.text(player.getRawName(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true)) ); executorData.duelOptions.spectatingPlayer = player; @@ -191,16 +182,9 @@ public static void unspectatePlayer(@NotNull NexiaPlayer executor, @Nullable Nex Component spectateMSG = Component.text(String.format("(%s started spectating)", executor.getRawName()), ChatFormat.systemColor).decorate(ChatFormat.italic); if (duelsGame != null || teamDuelsGame != null) { - executor.sendMessage( - ChatFormat.nexiaMessage - .append(Component.text("You have stopped spectating ") - .color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false) - .append(Component.text(player.getRawName()) - .color(ChatFormat.brandColor1) - .decoration(ChatFormat.bold, true) - ) - ) + executor.sendNexiaMessage( + Component.text("You have stopped spectating ", ChatFormat.normalColor) + .append(Component.text(player.getRawName(), ChatFormat.brandColor1)) ); } @@ -231,7 +215,7 @@ public static void joinGamemode(NexiaPlayer invitor, NexiaPlayer player, String DuelGameMode gameMode = GamemodeHandler.identifyGamemode(stringGameMode); if (gameMode == null) { if (!silent) { - invitor.sendMessage(Component.text("Invalid gamemode!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("Invalid gamemode!", ChatFormat.failColor)); } return; } @@ -240,14 +224,14 @@ public static void joinGamemode(NexiaPlayer invitor, NexiaPlayer player, String if (data.duelOptions.duelsTeam != null && data.duelOptions.duelsTeam.getPeople().contains(player)) { if (!silent) { - invitor.sendMessage(Component.text("You cannot duel people on your team!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("You cannot duel people on your team!", ChatFormat.failColor)); } return; } if (data.duelOptions.duelsTeam != null && !data.duelOptions.duelsTeam.isLeader(invitor)) { if (!silent) { - invitor.sendMessage(Component.text("You are not the team leader!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("You are not the team leader!", ChatFormat.failColor)); } return; } @@ -270,7 +254,7 @@ public static void joinGamemode(NexiaPlayer invitor, NexiaPlayer player, String public static void joinCustomGamemode(NexiaPlayer invitor, NexiaPlayer player, String kitID, @Nullable DuelsMap selectedmap, boolean silent) { if (!DuelGameHandler.validCustomKit(invitor, kitID)) { if (!silent) { - invitor.sendMessage(Component.text("Invalid custom kit!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("Invalid custom kit!", ChatFormat.failColor)); } return; } @@ -280,7 +264,7 @@ public static void joinCustomGamemode(NexiaPlayer invitor, NexiaPlayer player, S if(data.inviteOptions.inviteKit2 != null && !DuelGameHandler.validCustomKit(player, data.inviteOptions.inviteKit2)) { if (!silent) { - invitor.sendMessage(Component.text("Invalid per-custom kit (2)!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("Invalid per-custom kit (2)!", ChatFormat.failColor)); } data.inviteOptions.inviteKit2 = null; return; @@ -290,14 +274,14 @@ public static void joinCustomGamemode(NexiaPlayer invitor, NexiaPlayer player, S if (data.duelOptions.duelsTeam != null && data.duelOptions.duelsTeam.getPeople().contains(player)) { if (!silent) { - invitor.sendMessage(Component.text("You cannot duel people on your team!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("You cannot duel people on your team!", ChatFormat.failColor)); } return; } if (data.duelOptions.duelsTeam != null && !data.duelOptions.duelsTeam.isLeader(invitor)) { if (!silent) { - invitor.sendMessage(Component.text("You are not the team leader!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("You are not the team leader!", ChatFormat.failColor)); } return; } @@ -321,24 +305,24 @@ public static void acceptDuel(@NotNull NexiaPlayer executor, @NotNull NexiaPlaye DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if (executor.equals(player)) { - executor.sendMessage(Component.text("You cannot duel yourself!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You cannot duel yourself!", ChatFormat.failColor)); return; } if (executorData.inDuel || playerData.inDuel) { - executor.sendMessage(Component.text("That player is currently dueling someone.").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player is currently dueling someone.", ChatFormat.failColor)); return; } if (((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(executor)).gameMode != PlayerGameMode.LOBBY || ((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode != PlayerGameMode.LOBBY) { - executor.sendMessage(Component.text("That player is not in duels!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player is not in duels!", ChatFormat.failColor)); return; } DuelOptions.InviteOptions inviteOptions = playerData.inviteOptions; if (!inviteOptions.inviting || !inviteOptions.invitingPlayer.equals(executor)) { - executor.sendMessage(Component.text("That player has not challenged you to a duel!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player has not challenged you to a duel!", ChatFormat.failColor)); return; } @@ -351,49 +335,42 @@ public static void declineDuel(@NotNull NexiaPlayer executor, @NotNull NexiaPlay DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if (executor.equals(player)) { - executor.sendMessage(Component.text("You cannot duel yourself!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You cannot duel yourself!", ChatFormat.failColor)); return; } if (((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(executor)).gameMode != PlayerGameMode.LOBBY || ((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode != PlayerGameMode.LOBBY) { - executor.sendMessage(Component.text("That player is not in duels!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player is not in duels!", ChatFormat.failColor)); return; } DuelOptions.InviteOptions inviteOptions = playerData.inviteOptions; if (!inviteOptions.inviting || !inviteOptions.invitingPlayer.equals(executor)) { - executor.sendMessage(Component.text("That player has not challenged you to a duel!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player has not challenged you to a duel!", ChatFormat.failColor)); return; } inviteOptions.reset(); - player.sendMessage(ChatFormat.nexiaMessage.append(Component.text(executor.getRawName() + " has declined your duel.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + player.sendNexiaMessage(Component.text(executor.getRawName() + " has declined your duel.", ChatFormat.normalColor)); - executor.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("You have declined ") - .color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false)) - .append(Component.text(player.getRawName()) - .color(ChatFormat.brandColor1) - .decoration(ChatFormat.bold, true)) - .append(Component.text("'s duel.") - .color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false) - ) + executor.sendNexiaMessage( + Component.text("You have declined ", ChatFormat.normalColor) + .append(Component.text(player.getRawName(), ChatFormat.brandColor1).decoration(ChatFormat.bold, true)) + .append(Component.text("'s duel.", ChatFormat.normalColor)) ); } public static void challengePlayer(NexiaPlayer executor, NexiaPlayer player, String stringGameMode, @Nullable DuelsMap selectedmap) { DuelGameMode gameMode = GamemodeHandler.identifyGamemode(stringGameMode); if (gameMode == null) { - executor.sendMessage(Component.text("Invalid gamemode!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("Invalid gamemode!", ChatFormat.failColor)); return; } if (executor.equals(player)) { - executor.sendMessage(Component.text("You cannot duel yourself!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You cannot duel yourself!", ChatFormat.failColor)); return; } @@ -401,17 +378,17 @@ public static void challengePlayer(NexiaPlayer executor, NexiaPlayer player, Str DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if (executorData.inDuel || playerData.inDuel) { - executor.sendMessage(Component.text("That player is currently dueling someone.").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player is currently dueling someone.", ChatFormat.failColor)); return; } if (((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode != PlayerGameMode.LOBBY) { - executor.sendMessage(Component.text("That player is not in duels!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player is not in duels!", ChatFormat.failColor)); return; } if (executorData.duelOptions.duelsTeam != null && !executorData.duelOptions.duelsTeam.isLeader(executor)) { - executor.sendMessage(Component.text("You are not the team leader!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You are not the team leader!", ChatFormat.failColor)); return; } @@ -423,12 +400,12 @@ public static void challengePlayer(NexiaPlayer executor, NexiaPlayer player, Str } } else { if (!DuelsMap.duelsMaps.contains(map)) { - executor.sendMessage(Component.text("Invalid map!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("Invalid map!", ChatFormat.failColor)); return; } } if(gameMode.gameMode == Minecraft.GameMode.ADVENTURE && !map.isAdventureSupported) { - executor.sendMessage(Component.text("This map is not supported for this gamemode!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("This map is not supported for this gamemode!", ChatFormat.failColor)); return; } @@ -442,59 +419,62 @@ public static void challengePlayer(NexiaPlayer executor, NexiaPlayer player, Str // } else if((!executorData.inviteMap.equalsIgnoreCase(playerData.inviteMap) || !executorData.inviteKit.equalsIgnoreCase(playerData.inviteKit)) && (playerData.invitingPlayer == null || !playerData.invitingPlayer.getStringUUID().equalsIgnoreCase(executor.getStringUUID())) && playerData.gameMode == DuelGameMode.LOBBY){ - Component message = Component.text(executor.getRawName()).color(ChatFormat.brandColor1) - .append(Component.text(" has challenged you to a duel!").color(ChatFormat.normalColor) + Component message = Component.text(executor.getRawName(), ChatFormat.brandColor1) + .append(Component.text(" has challenged you to a duel!", ChatFormat.normalColor) ); if (executorData.duelOptions.duelsTeam == null) { - executor.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Sending a duel request to ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(player.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" on map ")).append(Component.text(map.id.toUpperCase()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" with kit ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(stringGameMode).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".")).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + executor.sendNexiaMessage( + Component.text("Sending a duel request to ", ChatFormat.normalColor) + .append(Component.text(player.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(" on map ")).append(Component.text(map.id.toUpperCase(), ChatFormat.brandColor2)) + .append(Component.text(" with kit ", ChatFormat.normalColor)) + .append(Component.text(stringGameMode, ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + ); } else { - executor.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Sending a ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text("team duel").color(ChatFormat.normalColor).decoration(ChatFormat.bold, true)) - .append(Component.text(" request to ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(player.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" on map ")).append(Component.text(map.id.toUpperCase()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" with kit ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(stringGameMode).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".")).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); - message = Component.text(executor.getRawName()).color(ChatFormat.brandColor1) - .append(Component.text(" has challenged you to a ").color(ChatFormat.normalColor)) - .append(Component.text("team duel").color(ChatFormat.normalColor).decoration(ChatFormat.bold, true)) - .append(Component.text("!").color(ChatFormat.normalColor)); - } - - - Component kit = Component.text("Kit: ").color(ChatFormat.brandColor1) - .append(Component.text(stringGameMode.toUpperCase()).color(ChatFormat.normalColor) + executor.sendNexiaMessage( + Component.text("Sending a ", ChatFormat.normalColor) + .append(Component.text("team duel", ChatFormat.normalColor).decoration(ChatFormat.bold, true)) + .append(Component.text(" request to ", ChatFormat.normalColor)) + .append(Component.text(player.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(" on map ")).append(Component.text(map.id.toUpperCase(), ChatFormat.brandColor2)) + .append(Component.text(" with kit ", ChatFormat.normalColor)) + .append(Component.text(stringGameMode, ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + ); + + message = Component.text(executor.getRawName(), ChatFormat.brandColor1) + .append(Component.text(" has challenged you to a ", ChatFormat.normalColor)) + .append(Component.text("team duel", ChatFormat.normalColor).decoration(ChatFormat.bold, true)) + .append(Component.text("!", ChatFormat.normalColor)); + } + + + Component kit = Component.text("Kit: ", ChatFormat.brandColor1) + .append(Component.text(stringGameMode.toUpperCase(), ChatFormat.normalColor) ); - Component mapName = Component.text("Map: ").color(ChatFormat.brandColor1) - .append(Component.text(map.id.toUpperCase()).color(ChatFormat.normalColor) + Component mapName = Component.text("Map: ", ChatFormat.brandColor1) + .append(Component.text(map.id.toUpperCase(), ChatFormat.normalColor) ); - Component yes = Component.text("[").color(NamedTextColor.DARK_GRAY) + Component yes = Component.text("[").color(ChatFormat.Minecraft.dark_gray) .append(Component.text("ACCEPT") .color(ChatFormat.greenColor) .decorate(ChatFormat.bold) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor2))) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor2))) .clickEvent(ClickEvent.runCommand("/acceptduel " + executor.getRawName()))) - .append(Component.text("] ").color(NamedTextColor.DARK_GRAY) + .append(Component.text("] ", ChatFormat.Minecraft.dark_gray) ); - Component no = Component.text("[").color(NamedTextColor.DARK_GRAY) + Component no = Component.text("[").color(ChatFormat.Minecraft.dark_gray) .append(Component.text("DECLINE") .color(ChatFormat.failColor) .decorate(ChatFormat.bold) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor2))) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor2))) .clickEvent(ClickEvent.runCommand("/declineduel " + executor.getRawName()))) - .append(Component.text("] ").color(NamedTextColor.DARK_GRAY) + .append(Component.text("] ", ChatFormat.Minecraft.dark_gray) ); @@ -511,35 +491,35 @@ public static void customChallengePlayer(NexiaPlayer executor, NexiaPlayer playe if(customKit.equalsIgnoreCase("vanilla") || customKit.equalsIgnoreCase("smp")) ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(executor)).inviteOptions.inviteKit2 = customKit; if (!DuelGameHandler.validCustomKit(executor, customKit)) { - executor.sendMessage(Component.text("Invalid kit!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("Invalid kit!", ChatFormat.failColor)); return; } if(inviteOptions.inviteKit2 != null && !DuelGameHandler.validCustomKit(player, inviteOptions.inviteKit2)) { - executor.sendMessage(Component.text("The other player does not have a valid custom kit for " + customKit + ".").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("The other player does not have a valid custom kit for " + customKit + ".", ChatFormat.failColor)); inviteOptions.inviteKit2 = null; return; } if (executor == player) { - executor.sendMessage(Component.text("You cannot duel yourself!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You cannot duel yourself!", ChatFormat.failColor)); return; } DuelsPlayerData playerData = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if (executorData.inDuel || playerData.inDuel) { - executor.sendMessage(Component.text("That player is currently dueling someone.").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player is currently dueling someone.", ChatFormat.failColor)); return; } if (((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode != PlayerGameMode.LOBBY) { - executor.sendMessage(Component.text("That player is not in duels!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player is not in duels!", ChatFormat.failColor)); return; } if (executorData.duelOptions.duelsTeam != null && !executorData.duelOptions.duelsTeam.isLeader(executor)) { - executor.sendMessage(Component.text("You are not the team leader!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You are not the team leader!", ChatFormat.failColor)); return; } @@ -548,7 +528,7 @@ public static void customChallengePlayer(NexiaPlayer executor, NexiaPlayer playe map = DuelsMap.duelsMaps.get(RandomUtil.randomInt(DuelsMap.duelsMaps.size())); } else { if (!DuelsMap.duelsMaps.contains(map)) { - executor.sendMessage(Component.text("Invalid map!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("Invalid map!", ChatFormat.failColor)); return; } } @@ -563,59 +543,62 @@ public static void customChallengePlayer(NexiaPlayer executor, NexiaPlayer playe // } else if((!executorData.inviteMap.equalsIgnoreCase(playerData.inviteMap) || !executorData.inviteKit.equalsIgnoreCase(playerData.inviteKit)) && (playerData.invitingPlayer == null || !playerData.invitingPlayer.getStringUUID().equalsIgnoreCase(executor.getStringUUID())) && playerData.gameMode == DuelGameMode.LOBBY){ - Component message = Component.text(executor.getRawName()).color(ChatFormat.brandColor1) - .append(Component.text(" has challenged you to a duel!").color(ChatFormat.normalColor) + Component message = Component.text(executor.getRawName(), ChatFormat.brandColor1) + .append(Component.text(" has challenged you to a duel!", ChatFormat.normalColor) ); if (executorData.duelOptions.duelsTeam == null) { - executor.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Sending a " + (inviteOptions.perCustomDuel ? "per-" : "") + "custom duel request to ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text(player.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" on map ")).append(Component.text(map.id.toUpperCase()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" with " + "custom kit ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(customKit).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".")).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); + executor.sendNexiaMessage( + Component.text("Sending a " + (inviteOptions.perCustomDuel ? "per-" : "") + "custom duel request to ", ChatFormat.normalColor) + .append(Component.text(player.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(" on map ")).append(Component.text(map.id.toUpperCase(), ChatFormat.brandColor2)) + .append(Component.text(" with " + "custom kit ", ChatFormat.normalColor)) + .append(Component.text(customKit, ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + ); } else { - executor.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Sending a ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false) - .append(Component.text((inviteOptions.perCustomDuel ? "per-" : "") + "custom team duel").color(ChatFormat.normalColor).decoration(ChatFormat.bold, true)) - .append(Component.text(" request to ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(player.getRawName()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" on map ")).append(Component.text(map.id.toUpperCase()).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(" with custom kit ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)) - .append(Component.text(customKit).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, false)) - .append(Component.text(".")).color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))); - message = Component.text(executor.getRawName()).color(ChatFormat.brandColor1) - .append(Component.text(" has challenged you to a ").color(ChatFormat.normalColor)) - .append(Component.text((inviteOptions.perCustomDuel ? "per-" : "") +"custom team duel").color(ChatFormat.normalColor).decoration(ChatFormat.bold, true)) - .append(Component.text("!").color(ChatFormat.normalColor)); - } - - - Component kit = Component.text("Custom Kit: ").color(ChatFormat.brandColor1) - .append(Component.text(customKit.toLowerCase()).color(ChatFormat.normalColor) + executor.sendNexiaMessage( + Component.text("Sending a ", ChatFormat.normalColor) + .append(Component.text((inviteOptions.perCustomDuel ? "per-" : "") + "custom team duel", ChatFormat.normalColor).decoration(ChatFormat.bold, true)) + .append(Component.text(" request to ", ChatFormat.normalColor)) + .append(Component.text(player.getRawName(), ChatFormat.brandColor2)) + .append(Component.text(" on map ")).append(Component.text(map.id.toUpperCase(), ChatFormat.brandColor2)) + .append(Component.text(" with custom kit ", ChatFormat.normalColor)) + .append(Component.text(customKit, ChatFormat.brandColor2)) + .append(Component.text(".", ChatFormat.normalColor)) + ); + + message = Component.text(executor.getRawName(), ChatFormat.brandColor1) + .append(Component.text(" has challenged you to a ", ChatFormat.normalColor)) + .append(Component.text((inviteOptions.perCustomDuel ? "per-" : "") + "custom team duel", ChatFormat.normalColor).decoration(ChatFormat.bold, true)) + .append(Component.text("!", ChatFormat.normalColor)); + } + + + Component kit = Component.text("Custom Kit: ", ChatFormat.brandColor1) + .append(Component.text(customKit.toLowerCase(), ChatFormat.normalColor) ); - Component mapName = Component.text("Map: ").color(ChatFormat.brandColor1) - .append(Component.text(map.id.toUpperCase()).color(ChatFormat.normalColor) + Component mapName = Component.text("Map: ", ChatFormat.brandColor1) + .append(Component.text(map.id.toUpperCase(), ChatFormat.normalColor) ); - Component yes = Component.text("[").color(NamedTextColor.DARK_GRAY) + Component yes = Component.text("[", ChatFormat.Minecraft.dark_gray) .append(Component.text("ACCEPT") .color(ChatFormat.greenColor) .decorate(ChatFormat.bold) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor2))) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor2))) .clickEvent(ClickEvent.runCommand("/acceptduel " + executor.getRawName()))) - .append(Component.text("] ").color(NamedTextColor.DARK_GRAY) + .append(Component.text("] ", ChatFormat.Minecraft.dark_gray) ); - Component no = Component.text("[").color(NamedTextColor.DARK_GRAY) + Component no = Component.text("[", ChatFormat.Minecraft.dark_aqua) .append(Component.text("DECLINE") .color(ChatFormat.failColor) .decorate(ChatFormat.bold) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor2))) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor2))) .clickEvent(ClickEvent.runCommand("/declineduel " + executor.getRawName()))) - .append(Component.text("] ").color(NamedTextColor.DARK_GRAY) + .append(Component.text("] ", ChatFormat.Minecraft.dark_gray) ); diff --git a/src/main/java/com/nexia/minigames/games/duels/team/DuelsTeam.java b/src/main/java/com/nexia/minigames/games/duels/team/DuelsTeam.java index a5b71dfa..8ce47cba 100644 --- a/src/main/java/com/nexia/minigames/games/duels/team/DuelsTeam.java +++ b/src/main/java/com/nexia/minigames/games/duels/team/DuelsTeam.java @@ -11,7 +11,6 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; -import net.kyori.adventure.text.format.NamedTextColor; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -65,12 +64,12 @@ public List getPeople() { public boolean replaceLeader(@NotNull NexiaPlayer executor, @NotNull NexiaPlayer player, boolean message) { if(!this.isLeader(executor)) { - if(message) executor.sendMessage(Component.text("You are not the leader!").color(ChatFormat.failColor)); + if(message) executor.sendMessage(Component.text("You are not the leader!", ChatFormat.failColor)); return false; } if(executor.equals(player) || this.isLeader(player)) { - if(message) executor.sendMessage(Component.text("You are the leader!").color(ChatFormat.failColor)); + if(message) executor.sendMessage(Component.text("You are the leader!", ChatFormat.failColor)); return false; } @@ -100,7 +99,7 @@ public void disbandTeam(NexiaPlayer executor, boolean message) { boolean isNull = executor == null || executor.unwrap() == null; if(!isNull && !this.isLeader(executor)) { - executor.sendMessage(Component.text("You are not the team leader!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You are not the team leader!", ChatFormat.failColor)); return; } @@ -112,7 +111,7 @@ public void disbandTeam(NexiaPlayer executor, boolean message) { return; } - Component msg = Component.text("The duels team has been disbanded.").color(ChatFormat.failColor); + Component msg = Component.text("The duels team has been disbanded.", ChatFormat.failColor); for(NexiaPlayer player : all) { ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).duelOptions.duelsTeam = null; @@ -141,10 +140,10 @@ public void leaveTeam(NexiaPlayer player, boolean message) { this.all.remove(player); this.alive.remove(player); - if(message) player.sendMessage(Component.text("You have left " + this.getLeader().getRawName() + "'s Team.").color(ChatFormat.normalColor)); + if(message) player.sendMessage(Component.text("You have left " + this.getLeader().getRawName() + "'s Team.", ChatFormat.normalColor)); for(NexiaPlayer ap : this.all) { - ap.sendMessage(Component.text(player.getRawName()).color(ChatFormat.brandColor1).append(Component.text(" has left the team.").color(ChatFormat.systemColor))); + ap.sendMessage(Component.text(player.getRawName(), ChatFormat.brandColor1).append(Component.text(" has left the team.").color(ChatFormat.systemColor))); } } @@ -152,69 +151,69 @@ public void invitePlayer(NexiaPlayer invitor, NexiaPlayer player) { boolean isLeader = this.isLeader(invitor); if(!isLeader){ - invitor.sendMessage(Component.text("You are not the team leader!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("You are not the team leader!", ChatFormat.failColor)); return; } if(player.equals(invitor)) { - invitor.sendMessage(Component.text("You cannot invite yourself!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("You cannot invite yourself!", ChatFormat.failColor)); return; } if(((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode != PlayerGameMode.LOBBY) { - invitor.sendMessage(Component.text("That player is not in duels!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("That player is not in duels!", ChatFormat.failColor)); return; } if(((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).duelOptions.duelsTeam != null) { - invitor.sendMessage(Component.text("That player is already in a team!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("That player is already in a team!", ChatFormat.failColor)); return; } if(this.getPeople().contains(player)) { - invitor.sendMessage(Component.text("That player is already in your team!").color(ChatFormat.failColor)); + invitor.sendMessage(Component.text("That player is already in your team!", ChatFormat.failColor)); return; } for(NexiaPlayer ap : this.all) { - ap.sendMessage(Component.text(player.getRawName()).color(ChatFormat.brandColor1).append(Component.text(" has been invited to the team.").color(ChatFormat.systemColor))); + ap.sendMessage(Component.text(player.getRawName(), ChatFormat.brandColor1).append(Component.text(" has been invited to the team.").color(ChatFormat.systemColor))); } this.invited.remove(player); this.invited.add(player); - Component yes = Component.text("[").color(NamedTextColor.DARK_GRAY) + Component yes = Component.text("[", ChatFormat.Minecraft.dark_gray) .append(Component.text("ACCEPT") .color(ChatFormat.greenColor) .decorate(ChatFormat.bold) - .hoverEvent(HoverEvent.showText(Component.text("Click me").color(ChatFormat.brandColor2))) + .hoverEvent(HoverEvent.showText(Component.text("Click me", ChatFormat.brandColor2))) .clickEvent(ClickEvent.runCommand("/party join " + invitor.getRawName()))) - .append(Component.text("] ").color(NamedTextColor.DARK_GRAY) + .append(Component.text("] ", ChatFormat.Minecraft.dark_gray) ); - Component no = Component.text("[").color(NamedTextColor.DARK_GRAY) + Component no = Component.text("[", ChatFormat.Minecraft.dark_gray) .append(Component.text("DECLINE") .color(ChatFormat.failColor) .decoration(ChatFormat.bold, true) .hoverEvent(HoverEvent.showText(Component.text("Click me") .color(ChatFormat.brandColor2))) .clickEvent(ClickEvent.runCommand("/party decline " + invitor.getRawName()))) - .append(Component.text("]").color(NamedTextColor.DARK_GRAY) + .append(Component.text("]", ChatFormat.Minecraft.dark_gray) ); player.sendMessage( - Component.text(invitor.getRawName()).color(ChatFormat.brandColor2) - .append(Component.text(" has invited you to their team!").color(ChatFormat.normalColor)) + Component.text(invitor.getRawName(), ChatFormat.brandColor2) + .append(Component.text(" has invited you to their team!", ChatFormat.normalColor)) ); player.sendMessage(yes.append(no)); } public void listTeam(NexiaPlayer executor) { - executor.sendMessage(Component.text("People on " + this.getLeader().getRawName() + "'s Team").color(ChatFormat.normalColor)); + executor.sendMessage(Component.text("People on " + this.getLeader().getRawName() + "'s Team", ChatFormat.normalColor)); for(NexiaPlayer player : this.all) { - executor.sendMessage(Component.text("» ").color(ChatFormat.brandColor1).append(Component.text(player.getRawName()).color(ChatFormat.normalColor))); + executor.sendMessage(Component.text("» ", ChatFormat.brandColor1).append(Component.text(player.getRawName(), ChatFormat.normalColor))); } } @@ -222,23 +221,23 @@ public void kickPlayer(NexiaPlayer executor, NexiaPlayer player) { DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if(!this.isLeader(executor)) { - executor.sendMessage(Component.text("You are not the leader!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You are not the leader!", ChatFormat.failColor)); return; } if(player.equals(executor)) { - executor.sendMessage(Component.text("You cannot kick yourself!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("You cannot kick yourself!", ChatFormat.failColor)); return; } if(!this.getPeople().contains(player)) { - executor.sendMessage(Component.text("That player is not in your team!").color(ChatFormat.failColor)); + executor.sendMessage(Component.text("That player is not in your team!", ChatFormat.failColor)); return; } for(NexiaPlayer ap : this.all) { - ap.sendMessage(Component.text(player.getRawName()).color(ChatFormat.brandColor1).append(Component.text(" has been removed from the team.").color(ChatFormat.systemColor))); + ap.sendMessage(Component.text(player.getRawName(), ChatFormat.brandColor1).append(Component.text(" has been removed from the team.").color(ChatFormat.systemColor))); } data.duelOptions.duelsTeam = null; @@ -246,19 +245,19 @@ public void kickPlayer(NexiaPlayer executor, NexiaPlayer player) { this.alive.remove(player); this.all.remove(player); - player.sendMessage(Component.text("You have been kicked from " + executor.getRawName() + "'s Team.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You have been kicked from " + executor.getRawName() + "'s Team.", ChatFormat.failColor)); } public void joinTeam(NexiaPlayer player) { DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if(data.duelOptions.duelsTeam != null) { - player.sendMessage(Component.text("You are currently in a team!").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You are currently in a team!", ChatFormat.failColor)); return; } if(!this.invited.contains(player)) { - this.getLeader().sendMessage(Component.text("That player did not invite you!").color(ChatFormat.failColor)); + this.getLeader().sendMessage(Component.text("That player did not invite you!", ChatFormat.failColor)); return; } @@ -267,9 +266,9 @@ public void joinTeam(NexiaPlayer player) { this.getPeople().add(player); data.duelOptions.duelsTeam = this; - player.sendMessage(Component.text("You have joined " + this.getLeader().getRawName() + "'s team").color(ChatFormat.normalColor)); + player.sendMessage(Component.text("You have joined " + this.getLeader().getRawName() + "'s team", ChatFormat.normalColor)); for(NexiaPlayer ap : this.all) { - ap.sendMessage(Component.text(player.getRawName()).color(ChatFormat.brandColor1).append(Component.text(" has joined the team."))); + ap.sendMessage(Component.text(player.getRawName(), ChatFormat.brandColor1).append(Component.text(" has joined the team."))); } } @@ -277,18 +276,18 @@ public void declineTeam(NexiaPlayer player) { DuelsPlayerData data = (DuelsPlayerData) PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player); if(data.duelOptions.duelsTeam != null) { - player.sendMessage(Component.text("You are currently in a team!").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You are currently in a team!", ChatFormat.failColor)); return; } if(!this.invited.contains(player)) { - this.getLeader().sendMessage(Component.text("That player did not invite you!").color(ChatFormat.failColor)); + this.getLeader().sendMessage(Component.text("That player did not invite you!", ChatFormat.failColor)); return; } this.invited.remove(player); - player.sendMessage(Component.text("You have declined " + this.getLeader().getRawName() + "'s invite.").color(ChatFormat.normalColor)); - this.getLeader().sendMessage(Component.text(player.getRawName() + " has declined your invite.").color(ChatFormat.failColor)); + player.sendMessage(Component.text("You have declined " + this.getLeader().getRawName() + "'s invite.", ChatFormat.normalColor)); + this.getLeader().sendMessage(Component.text(player.getRawName() + " has declined your invite.", ChatFormat.failColor)); } public static DuelsTeam createTeam(NexiaPlayer player, boolean message) { @@ -296,18 +295,13 @@ public static DuelsTeam createTeam(NexiaPlayer player, boolean message) { if(data.duelOptions.duelsTeam != null) { if(message) { - player.sendMessage(Component.text("You are currently in a team!").color(ChatFormat.failColor)); + player.sendNexiaMessage("You are currently in a team!"); } return null; } if(message) { - player.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("You have created a team.") - .color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false) - ) - ); + player.sendNexiaMessage("You have created a team."); } DuelsTeam team = new DuelsTeam(player, new ArrayList<>()); diff --git a/src/main/java/com/nexia/minigames/games/duels/team/TeamDuelsGame.java b/src/main/java/com/nexia/minigames/games/duels/team/TeamDuelsGame.java index aa4d9f43..265bb834 100644 --- a/src/main/java/com/nexia/minigames/games/duels/team/TeamDuelsGame.java +++ b/src/main/java/com/nexia/minigames/games/duels/team/TeamDuelsGame.java @@ -112,11 +112,9 @@ public static TeamDuelsGame startGame(@NotNull DuelsTeam team1, @NotNull DuelsTe player.setGameMode(Minecraft.GameMode.ADVENTURE); - player.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Your opponent: ").color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false) - .append(Component.text(team2.getLeader().getRawName() + "'s Team") - .color(ChatFormat.brandColor2)))); + player.sendNexiaMessage(Component.text("Your opponent: ", ChatFormat.normalColor) + .append(Component.text(team2.getLeader().getRawName() + "'s Team", ChatFormat.brandColor2)) + ); DuelGameHandler.loadInventory(player, stringGameMode); @@ -143,11 +141,10 @@ public static TeamDuelsGame startGame(@NotNull DuelsTeam team1, @NotNull DuelsTe selectedMap.p2Pos.teleportPlayer(duelLevel, player.unwrap()); - player.sendMessage(ChatFormat.nexiaMessage - .append(Component.text("Your opponent: ").color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false) - .append(Component.text(team1.getLeader().getRawName() + "'s Team") - .color(ChatFormat.brandColor2)))); + player.sendNexiaMessage( + Component.text("Your opponent: ", ChatFormat.normalColor) + .append(Component.text(team1.getLeader().getRawName() + "'s Team", ChatFormat.brandColor2)) + ); DuelGameHandler.loadInventory(player, stringGameMode); @@ -170,10 +167,7 @@ public void duelSecond() { String isBroken = this.detectBrokenGame(); if (isBroken != null) { Component error = ChatFormat.nexiaMessage - .append(Component.text( - "The game you were in was identified as broken, please contact a developer with a video of the last 30 seconds.") - .color(ChatFormat.normalColor) - .decoration(ChatFormat.bold, false)); + .append(Component.text("The game you were in was identified as broken, please contact a developer with a video of the last 30 seconds.", ChatFormat.normalColor)); Component errormsg = Component.text("Cause: " + isBroken); @@ -291,8 +285,8 @@ public void endGame(@NotNull DuelsTeam loserTeam, @Nullable DuelsTeam winnerTeam Component win = Component.text("The game was a ") .color(ChatFormat.normalColor) - .append(Component.text("draw").color(ChatFormat.brandColor2)) - .append(Component.text("!").color(ChatFormat.normalColor)); + .append(Component.text("draw", ChatFormat.brandColor2)) + .append(Component.text("!", ChatFormat.normalColor)); Component titleLose = Component.text("Draw") .color(ChatFormat.brandColor2); @@ -309,16 +303,16 @@ public void endGame(@NotNull DuelsTeam loserTeam, @Nullable DuelsTeam winnerTeam return; } - win = Component.text(winnerTeam.getLeader().getRawName() + "'s Team").color(ChatFormat.brandColor2) - .append(Component.text(" has won the duel!").color(ChatFormat.normalColor)); + win = Component.text(winnerTeam.getLeader().getRawName() + "'s Team", ChatFormat.brandColor2) + .append(Component.text(" has won the duel!", ChatFormat.normalColor)); - titleLose = Component.text("You lost!").color(ChatFormat.brandColor2); + titleLose = Component.text("You lost!", ChatFormat.brandColor2); subtitleLose = Component.text("You have lost against ") .color(ChatFormat.normalColor) .append(Component.text(winnerTeam.getLeader().getRawName() + "'s Team") .color(ChatFormat.brandColor2)); - titleWin = Component.text("You won!").color(ChatFormat.brandColor2); + titleWin = Component.text("You won!", ChatFormat.brandColor2); subtitleWin = Component.text("You have won against ") .color(ChatFormat.normalColor) .append(Component.text(loserTeam.getLeader().getRawName() + "'s Team") diff --git a/src/main/java/com/nexia/minigames/games/football/FootballGame.java b/src/main/java/com/nexia/minigames/games/football/FootballGame.java index b5215d73..70437eeb 100644 --- a/src/main/java/com/nexia/minigames/games/football/FootballGame.java +++ b/src/main/java/com/nexia/minigames/games/football/FootballGame.java @@ -1,5 +1,6 @@ package com.nexia.minigames.games.football; +import com.nexia.base.player.NexiaPlayer; import com.nexia.base.player.PlayerDataManager; import com.nexia.core.NexiaCore; import com.nexia.core.games.util.LobbyUtil; @@ -7,7 +8,6 @@ import com.nexia.core.utilities.chat.ChatFormat; import com.nexia.core.utilities.misc.RandomUtil; import com.nexia.core.utilities.player.CorePlayerData; -import com.nexia.base.player.NexiaPlayer; import com.nexia.core.utilities.pos.EntityPos; import com.nexia.core.utilities.time.ServerTime; import com.nexia.core.utilities.time.TickUtil; @@ -16,7 +16,6 @@ import com.nexia.minigames.games.football.util.player.FootballPlayerData; import com.nexia.nexus.api.world.types.Minecraft; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.title.Title; import net.minecraft.core.BlockPos; @@ -150,16 +149,16 @@ public static void second() { player.sendActionBarMessage( Component.text("Map » ").color(TextColor.fromHexString("#b3b3b3")) - .append(Component.text(FootballGame.map.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(FootballGame.map.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) .append(Component.text(" (" + FootballGame.queue.size() + ")").color(TextColor.fromHexString("#b3b3b3"))) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Time » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(FootballGame.queueTime).color(ChatFormat.brandColor2)) + .append(Component.text(FootballGame.queueTime, ChatFormat.brandColor2)) ); if(FootballGame.queueTime <= 5 || FootballGame.queueTime == 10 || FootballGame.queueTime == 15) { player.sendMessage(Component.text("The game will start in ").color(TextColor.fromHexString("#b3b3b3")) - .append(Component.text(FootballGame.queueTime).color(ChatFormat.brandColor1)) + .append(Component.text(FootballGame.queueTime, ChatFormat.brandColor1)) .append(Component.text(" seconds.").color(TextColor.fromHexString("#b3b3b3"))) ); } @@ -196,7 +195,7 @@ public static void goal(ArmorStand entity, FootballTeam team) { entity.moveTo(0, 80, 0, 0, 0); for(NexiaPlayer player : FootballGame.getViewers()) { - player.sendTitle(Title.title(Component.text("Team " + teamID).color(ChatFormat.brandColor2), Component.text("has scored a goal!").color(ChatFormat.normalColor))); + player.sendTitle(Title.title(Component.text("Team " + teamID, ChatFormat.brandColor2), Component.text("has scored a goal!", ChatFormat.normalColor))); } for(NexiaPlayer player : FootballGame.team1.players) { @@ -214,12 +213,12 @@ public static void goal(ArmorStand entity, FootballTeam team) { @NotNull private static Title getTitle(int queueTime) { - TextColor color = NamedTextColor.GREEN; + TextColor color = ChatFormat.Minecraft.green; if (queueTime <= 3 && queueTime > 1) { - color = NamedTextColor.YELLOW; + color = ChatFormat.Minecraft.yellow; } else if (queueTime <= 1) { - color = NamedTextColor.RED; + color = ChatFormat.Minecraft.red; } return Title.title(Component.text(queueTime).color(color), Component.text(""), Title.Times.of(Duration.ofMillis(0), Duration.ofSeconds(1), Duration.ofMillis(0))); @@ -248,8 +247,8 @@ public static void endGame(FootballTeam winnerTeam) { if(winnerTeam == null) { Component msg = Component.text("The game was a ") .color(ChatFormat.normalColor) - .append(Component.text("draw").color(ChatFormat.brandColor2)) - .append(Component.text("!").color(ChatFormat.normalColor) + .append(Component.text("draw", ChatFormat.brandColor2)) + .append(Component.text("!", ChatFormat.normalColor) ); for(NexiaPlayer player : FootballGame.getViewers()){ if(player != null && player.unwrap() != null) player.sendTitle(Title.title(msg, Component.text(""))); @@ -269,7 +268,7 @@ public static void endGame(FootballTeam winnerTeam) { } for(NexiaPlayer player : FootballGame.getViewers()){ - player.sendTitle(Title.title(Component.text("Team " + teamID).color(ChatFormat.brandColor2), Component.text("has won the game! (" + winnerTeam.goals + " goals)").color(ChatFormat.normalColor))); + player.sendTitle(Title.title(Component.text("Team " + teamID, ChatFormat.brandColor2), Component.text("has won the game! (" + winnerTeam.goals + " goals)", ChatFormat.normalColor))); } } @@ -285,16 +284,16 @@ public static void updateInfo() { player.sendActionBarMessage( Component.text("Map » ").color(TextColor.fromHexString("#b3b3b3")) - .append(Component.text(FootballGame.map.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(FootballGame.map.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Time » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(timer[0] + ":" + timer[1]).color(ChatFormat.brandColor2)) + .append(Component.text(timer[0] + ":" + timer[1], ChatFormat.brandColor2)) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Goals » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(playerTeam.goals + "/" + FootballGame.map.maxGoals).color(ChatFormat.brandColor2)) + .append(Component.text(playerTeam.goals + "/" + FootballGame.map.maxGoals, ChatFormat.brandColor2)) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Enemy Team Goals » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(otherTeam.goals + "/" + FootballGame.map.maxGoals).color(ChatFormat.brandColor2)) + .append(Component.text(otherTeam.goals + "/" + FootballGame.map.maxGoals, ChatFormat.brandColor2)) ); } } diff --git a/src/main/java/com/nexia/minigames/games/oitc/OitcGame.java b/src/main/java/com/nexia/minigames/games/oitc/OitcGame.java index 84bdc4aa..fff6f659 100644 --- a/src/main/java/com/nexia/minigames/games/oitc/OitcGame.java +++ b/src/main/java/com/nexia/minigames/games/oitc/OitcGame.java @@ -186,18 +186,18 @@ public static void second() { player.sendActionBarMessage( Component.text("Map » ").color(TextColor.fromHexString("#b3b3b3")) - .append(Component.text(OitcGame.map.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(OitcGame.map.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) .append(Component.text(" (" + OitcGame.queue.size() + "/" + OitcGame.map.maxPlayers + ")").color(TextColor.fromHexString("#b3b3b3"))) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Time » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(OitcGame.queueTime).color(ChatFormat.brandColor2)) + .append(Component.text(OitcGame.queueTime, ChatFormat.brandColor2)) .append(Component.text(" | ").color(ChatFormat.lineColor)) - .append(Component.text("Teaming is not allowed!").color(ChatFormat.failColor)) + .append(Component.text("Teaming is not allowed!", ChatFormat.failColor)) ); if(OitcGame.queueTime <= 5 || OitcGame.queueTime == 10 || OitcGame.queueTime == 15) { player.sendMessage(Component.text("The game will start in ").color(TextColor.fromHexString("#b3b3b3")) - .append(Component.text(OitcGame.queueTime).color(ChatFormat.brandColor1)) + .append(Component.text(OitcGame.queueTime, ChatFormat.brandColor1)) .append(Component.text(" seconds.").color(TextColor.fromHexString("#b3b3b3"))) ); } @@ -252,7 +252,7 @@ public static void endGame(NexiaPlayer player) { data.savedData.incrementInteger("wins"); for(NexiaPlayer viewer : OitcGame.getViewers()){ - viewer.sendTitle(Title.title(Component.text(player.getRawName()).color(ChatFormat.brandColor2), Component.text("has won the game! (" + data.kills + " kills)").color(ChatFormat.normalColor))); + viewer.sendTitle(Title.title(Component.text(player.getRawName(), ChatFormat.brandColor2), Component.text("has won the game! (" + data.kills + " kills)", ChatFormat.normalColor))); } } @@ -261,13 +261,13 @@ public static void updateInfo() { for(NexiaPlayer player : OitcGame.getViewers()) { player.sendActionBarMessage( Component.text("Map » ").color(TextColor.fromHexString("#b3b3b3")) - .append(Component.text(OitcGame.map.name).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(OitcGame.map.name, ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Time » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(timer[0] + ":" + timer[1]).color(ChatFormat.brandColor2)) + .append(Component.text(timer[0] + ":" + timer[1], ChatFormat.brandColor2)) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Kills » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(((OITCPlayerData)PlayerDataManager.getDataManager(OITC_DATA_MANAGER).get(player)).kills).color(ChatFormat.brandColor2)) + .append(Component.text(((OITCPlayerData)PlayerDataManager.getDataManager(OITC_DATA_MANAGER).get(player)).kills, ChatFormat.brandColor2)) ); } } diff --git a/src/main/java/com/nexia/minigames/games/skywars/SkywarsGame.java b/src/main/java/com/nexia/minigames/games/skywars/SkywarsGame.java index dd362318..7175c997 100644 --- a/src/main/java/com/nexia/minigames/games/skywars/SkywarsGame.java +++ b/src/main/java/com/nexia/minigames/games/skywars/SkywarsGame.java @@ -1,5 +1,6 @@ package com.nexia.minigames.games.skywars; +import com.nexia.base.player.NexiaPlayer; import com.nexia.base.player.PlayerDataManager; import com.nexia.core.NexiaCore; import com.nexia.core.games.util.LobbyUtil; @@ -7,7 +8,6 @@ import com.nexia.core.utilities.chat.ChatFormat; import com.nexia.core.utilities.misc.RandomUtil; import com.nexia.core.utilities.player.CorePlayerData; -import com.nexia.base.player.NexiaPlayer; import com.nexia.core.utilities.player.PlayerUtil; import com.nexia.core.utilities.pos.EntityPos; import com.nexia.core.utilities.time.ServerTime; @@ -18,11 +18,9 @@ import com.nexia.nexus.api.world.types.Minecraft; import net.fabricmc.loader.impl.util.StringUtil; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.title.Title; import net.minecraft.core.BlockPos; -import net.minecraft.core.Vec3i; import net.minecraft.network.chat.TextComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.bossevents.CustomBossEvent; @@ -34,7 +32,6 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.biome.Biomes; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.storage.loot.LootContext; @@ -46,8 +43,10 @@ import xyz.nucleoid.fantasy.RuntimeWorldConfig; import java.time.Duration; -import java.util.*; -import java.util.function.BiConsumer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import static com.nexia.core.NexiaCore.SKYWARS_DATA_MANAGER; import static com.nexia.core.utilities.world.WorldUtil.getChunkGenerator; @@ -166,13 +165,13 @@ else if (SkywarsGame.chestsRefillTime > 0 && !SkywarsGame.chestsRefilled && !Sky player.sendActionBarMessage( Component.text("Map » ").color(TextColor.fromHexString("#b3b3b3")) - .append(Component.text(StringUtil.capitalize(SkywarsGame.map.id)).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(StringUtil.capitalize(SkywarsGame.map.id), ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) .append(Component.text(" (" + SkywarsGame.queue.size() + "/" + SkywarsMap.maxJoinablePlayers + ")").color(TextColor.fromHexString("#b3b3b3"))) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Time » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(SkywarsGame.queueTime).color(ChatFormat.brandColor2)) + .append(Component.text(SkywarsGame.queueTime, ChatFormat.brandColor2)) .append(Component.text(" | ").color(ChatFormat.lineColor)) - .append(Component.text("Teaming is not allowed!").color(ChatFormat.failColor)) + .append(Component.text("Teaming is not allowed!", ChatFormat.failColor)) ); } if (SkywarsGame.queueTime <= 5 || SkywarsGame.queueTime == 10 || SkywarsGame.queueTime == 15) { @@ -195,12 +194,12 @@ else if (SkywarsGame.chestsRefillTime > 0 && !SkywarsGame.chestsRefilled && !Sky @NotNull private static Title getTitle() { - TextColor color = NamedTextColor.GREEN; + TextColor color = ChatFormat.Minecraft.green; if(SkywarsGame.queueTime <= 3 && SkywarsGame.queueTime > 1) { - color = NamedTextColor.YELLOW; + color = ChatFormat.Minecraft.yellow; } else if(SkywarsGame.queueTime <= 1) { - color = NamedTextColor.RED; + color = ChatFormat.Minecraft.red; } return Title.title(Component.text(SkywarsGame.queueTime).color(color), Component.text(""), Title.Times.of(Duration.ofMillis(0), Duration.ofSeconds(1), Duration.ofMillis(0))); @@ -331,10 +330,10 @@ public static void endGame(@NotNull NexiaPlayer player) { PlayerDataManager.getDataManager(SKYWARS_DATA_MANAGER).get(player).savedData.incrementInteger("wins"); for(NexiaPlayer serverPlayer : SkywarsGame.getViewers()){ - serverPlayer.sendTitle(Title.title(Component.text(player.getRawName()).color(ChatFormat.brandColor2), Component.text("has won the game!").color(ChatFormat.normalColor) + serverPlayer.sendTitle(Title.title(Component.text(player.getRawName(), ChatFormat.brandColor2), Component.text("has won the game!", ChatFormat.normalColor) .append(Component.text(" [") .color(ChatFormat.lineColor)) - .append(Component.text(FfaUtil.calculateHealth(player.getHealth()) + "❤").color(ChatFormat.failColor)) + .append(Component.text(FfaUtil.calculateHealth(player.getHealth()) + "❤", ChatFormat.failColor)) .append(Component.text("]").color(ChatFormat.lineColor)) )); } @@ -346,12 +345,12 @@ public static void updateInfo() { for(NexiaPlayer player : SkywarsGame.getViewers()) { player.sendActionBarMessage( Component.text("Map » ").color(TextColor.fromHexString("#b3b3b3")) - .append(Component.text(StringUtil.capitalize(SkywarsGame.map.id)).color(ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) + .append(Component.text(StringUtil.capitalize(SkywarsGame.map.id), ChatFormat.brandColor2).decoration(ChatFormat.bold, true)) .append(Component.text(" | ").color(ChatFormat.lineColor)) .append(Component.text("Players » ").color(TextColor.fromHexString("#b3b3b3"))) - .append(Component.text(SkywarsGame.alive.size()).color(ChatFormat.brandColor2)) + .append(Component.text(SkywarsGame.alive.size(), ChatFormat.brandColor2)) .append(Component.text(" | ").color(ChatFormat.lineColor)) - .append(Component.text("Teaming is not allowed!").color(ChatFormat.failColor)) + .append(Component.text("Teaming is not allowed!", ChatFormat.failColor)) ); } @@ -387,13 +386,13 @@ public static void refillChests() { player.sendSound(new EntityPos(player.unwrap()), SoundEvents.CHEST_OPEN, SoundSource.AMBIENT, 1000, 1); player.sendMessage( Component.text("[").color(ChatFormat.lineColor) - .append(Component.text("⚠").color(ChatFormat.failColor)) + .append(Component.text("⚠", ChatFormat.failColor)) .append(Component.text("]").color(ChatFormat.lineColor)) .append(Component.text(" All chests have been refilled.").color(TextColor.fromHexString("#FFE588"))) ); player.sendTitle( - Title.title(Component.text("⚠").color(ChatFormat.failColor), + Title.title(Component.text("⚠", ChatFormat.failColor), Component.text(" All chests have been refilled.").color(TextColor.fromHexString("#FFE588"))) ); } @@ -404,13 +403,13 @@ public static void sendCenterWarning() { player.sendSound(new EntityPos(player.unwrap()), SoundEvents.RESPAWN_ANCHOR_CHARGE, SoundSource.AMBIENT, 1000, 1); player.sendMessage( Component.text("[").color(ChatFormat.lineColor) - .append(Component.text("⚠").color(ChatFormat.failColor)) + .append(Component.text("⚠", ChatFormat.failColor)) .append(Component.text("]").color(ChatFormat.lineColor)) .append(Component.text(" In 1 minute, the closest player to center will win.").color(TextColor.fromHexString("#FFE588"))) ); player.sendTitle( - Title.title(Component.text("⚠").color(ChatFormat.failColor), + Title.title(Component.text("⚠", ChatFormat.failColor), Component.text(" In 1 minute, the closest player to center will win.").color(TextColor.fromHexString("#FFE588"))) ); }