diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java index 5aae271a..2fe7ea73 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java @@ -3,11 +3,6 @@ package me.totalfreedom.totalfreedommod.command; import java.util.List; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.util.FUtil; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; -import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -24,12 +19,13 @@ public class Command_admininfo extends FreedomCommand if (adminInfo.isEmpty()) { - msg(Component.text("The admin information section of the config.yml file has not been configured.", NamedTextColor.RED)); + msgNew("The admin information section of the config.yml file has not been configured."); } else { - msg(FUtil.colorizeAsComponent(StringUtils.join(adminInfo, "\n"))); + adminInfo.forEach(this::msgNew); } + return true; } } \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java index 1891b55d..f295ec00 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java @@ -4,6 +4,7 @@ import me.totalfreedom.totalfreedommod.banning.Ban; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; @@ -32,13 +33,13 @@ public class Command_banip extends FreedomCommand if (FUtil.isValidIPv4(ip)) { - msg(ip + " is not a valid IP address", ChatColor.RED); + msgNew(" is not a valid IP address.", Placeholder.unparsed("ip", ip)); return true; } if (plugin.bm.getByIp(ip) != null) { - msg("The IP " + ip + " is already banned", ChatColor.RED); + msgNew("The IP is already banned.", Placeholder.unparsed("ip", ip)); return true; } @@ -71,12 +72,12 @@ public class Command_banip extends FreedomCommand if (!silent) { // Broadcast - FLog.info(ChatColor.RED + sender.getName() + " - Banned the IP " + ip); String message = sender.getName() + " - Banned " + (plugin.al.isAdmin(player) ? "the IP " + ip : "an IP"); msg(player, message, ChatColor.RED); } } + FLog.info(ChatColor.RED + sender.getName() + " - Banned the IP " + ip); return true; } } \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java index e8d966e2..7a4036ef 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java @@ -2,15 +2,18 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import java.util.Collections; +import java.util.List; + @CommandPermissions(rank = Rank.OP, source = SourceType.BOTH) @CommandParameters(description = "Shows all banned player names. Admins may optionally use 'purge' to clear the list.", usage = "/ [purge]") public class Command_banlist extends FreedomCommand { - @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -19,18 +22,23 @@ public class Command_banlist extends FreedomCommand if (args[0].equalsIgnoreCase("purge")) { checkRank(Rank.SENIOR_ADMIN); - FUtil.adminAction(sender.getName(), "Purging the ban list", true); - int amount = plugin.bm.purge(); - msg("Purged " + amount + " player bans."); + msgNew("Purged player bans.", Placeholder.unparsed("amount", String.valueOf(plugin.bm.purge()))); return true; } return false; } - msg(plugin.bm.getAllBans().size() + " player bans (" - + plugin.bm.getUsernameBans().size() + " usernames, " - + plugin.bm.getIpBans().size() + " IPs)"); + msgNew(" player bans ( usernames, IPs)", + Placeholder.unparsed("total", String.valueOf(plugin.bm.getAllBans().size())), + Placeholder.unparsed("usernames", String.valueOf(plugin.bm.getUsernameBans())), + Placeholder.unparsed("ips", String.valueOf(plugin.bm.getIpBans().size()))); return true; } + + @Override + protected List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) + { + return args.length == 1 && plugin.al.isSeniorAdmin(sender) ? Collections.singletonList("purge") : Collections.emptyList(); + } } \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java index 12cd53be..7ef581cc 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java @@ -2,7 +2,6 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -14,35 +13,16 @@ import org.bukkit.inventory.meta.ItemMeta; @CommandParameters(description = "For the people that are still alive - gives a cake to everyone on the server.", usage = "/") public class Command_cake extends FreedomCommand { - - public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake."; - @Override public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) { - final StringBuilder output = new StringBuilder(); - - for (final String word : CAKE_LYRICS.split(" ")) - { - output.append(FUtil.randomChatColor()).append(word).append(" "); - } - final ItemStack heldItem = new ItemStack(Material.CAKE); final ItemMeta heldItemMeta = heldItem.getItemMeta(); assert heldItemMeta != null; - heldItemMeta.setDisplayName(ChatColor.WHITE + "The " + ChatColor.DARK_GRAY + "Lie"); + heldItemMeta.displayName(FUtil.miniMessage("The Lie")); heldItem.setItemMeta(heldItemMeta); - - for (Player player : server.getOnlinePlayers()) - { - final int firstEmpty = player.getInventory().firstEmpty(); - if (firstEmpty >= 0) - { - player.getInventory().setItem(firstEmpty, heldItem); - } - } - - FUtil.bcastMsg(output.toString()); + server.getOnlinePlayers().forEach(player -> player.getInventory().addItem(heldItem)); + server.broadcast(FUtil.miniMessage("But there's no sense crying over every mistake. You just keep on trying till you run out of cake.")); return true; } } \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java deleted file mode 100644 index 2663ecec..00000000 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java +++ /dev/null @@ -1,77 +0,0 @@ -package me.totalfreedom.totalfreedommod.command; - -import java.util.Objects; -import me.totalfreedom.totalfreedommod.rank.Rank; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Minecart; -import org.bukkit.entity.Player; - -@CommandPermissions(rank = Rank.NON_OP, source = SourceType.BOTH) -@CommandParameters(description = "Sit in nearest minecart. If target is in a minecart already, they will disembark.", usage = "/ [partialname]") -public class Command_cartsit extends FreedomCommand -{ - - @Override - public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) - { - Player targetPlayer = playerSender; - - if (args.length == 1 && plugin.al.isAdmin(sender)) - { - targetPlayer = getPlayer(args[0]); - - if (targetPlayer == null) - { - msg(PLAYER_NOT_FOUND); - return true; - } - } - - if (senderIsConsole) - { - if (targetPlayer == null) - { - msg("When used from the console, you must define a target player: /cartsit "); - return true; - } - } - - if (targetPlayer.isInsideVehicle()) - { - Objects.requireNonNull(targetPlayer.getVehicle()).eject(); - } - else - { - Minecart nearest_cart = null; - for (Minecart cart : targetPlayer.getWorld().getEntitiesByClass(Minecart.class)) - { - if (cart.isEmpty()) - { - if (nearest_cart == null) - { - nearest_cart = cart; - } - else - { - if (cart.getLocation().distanceSquared(targetPlayer.getLocation()) < nearest_cart.getLocation().distanceSquared(targetPlayer.getLocation())) - { - nearest_cart = cart; - } - } - } - } - - if (nearest_cart != null) - { - nearest_cart.addPassenger(targetPlayer); - } - else - { - msg("There are no empty minecarts in the target world."); - } - } - - return true; - } -} \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java index 113d3c39..06ce62d6 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java @@ -13,13 +13,14 @@ public class Command_cleardiscordqueue extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - if (plugin.dc == null) { - msg("Discord is not enabled."); + if (plugin.dc == null) + { + msgNew("Discord is not enabled."); return true; } plugin.dc.clearQueue(); - msg("Cleared the discord message queue."); + msg("Cleared the Discord message queue."); return true; } } \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java index 7ed3beb0..2f5646bc 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java @@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.rank.Rank; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -16,7 +17,7 @@ public class Command_cmdspy extends FreedomCommand { Admin admin = plugin.al.getAdmin(playerSender); admin.setCommandSpy(!admin.getCommandSpy()); - msg("CommandSpy " + (admin.getCommandSpy() ? "enabled." : "disabled.")); + msgNew("CommandSpy .", Placeholder.unparsed("status", admin.getCommandSpy() ? "enabled." : "disabled.")); plugin.al.save(admin); plugin.al.updateTables(); return true; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java index c1372ba4..e94368e9 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java @@ -6,6 +6,7 @@ import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -23,12 +24,10 @@ public class Command_coins extends FreedomCommand { if (plugin.sh == null || !ConfigEntry.SHOP_ENABLED.getBoolean()) { - msg(Component.text("The shop is currently disabled!", NamedTextColor.RED)); + msgNew("The shop is currently disabled!"); return true; } - final Component prefix = FUtil.colorizeAsComponent(ConfigEntry.SHOP_PREFIX.getString() + " "); - switch (args.length) { // Mode for seeing how many coins the sender has (doesn't work from console) @@ -36,14 +35,14 @@ public class Command_coins extends FreedomCommand { if (senderIsConsole) { - msg("When used from the console, you must define a target player."); + msgNew("When used from the console, you must define a target player."); } else { PlayerData playerData = getData(playerSender); - msg(prefix.append(Component.text("You have ", NamedTextColor.GREEN) - .append(Component.text(playerData.getCoins(), NamedTextColor.GOLD)) - .append(Component.text(" coins.", NamedTextColor.GREEN)))); + msgNew("You have coin.", + Placeholder.unparsed("coins", String.valueOf(playerData.getCoins())), + Placeholder.unparsed("plural", playerData.getCoins() > 1 ? "s" : "")); } return true; } @@ -61,10 +60,10 @@ public class Command_coins extends FreedomCommand else { PlayerData playerData = getData(target); - msg(prefix.append(Component.text(target.getName(), NamedTextColor.GOLD) - .append(Component.text(" has ", NamedTextColor.GREEN)) - .append(Component.text(playerData.getCoins(), NamedTextColor.GOLD)) - .append(Component.text(" coins.", NamedTextColor.GREEN)))); + msgNew(" has coin.", + Placeholder.unparsed("player", target.getName()), + Placeholder.unparsed("coins", String.valueOf(playerData.getCoins())), + Placeholder.unparsed("plural", playerData.getCoins() > 1 ? "s" : "")); } return true; } @@ -90,14 +89,14 @@ public class Command_coins extends FreedomCommand } catch (NumberFormatException ex) { - msg(Component.text("Invalid number: " + args[2], NamedTextColor.RED)); + msgNew("Invalid number: ", Placeholder.unparsed("num", args[2])); return true; } // Prevents players from performing transactions they can't afford to do. if (senderData.getCoins() < coinsToTransfer) { - msg(Component.text("You don't have enough coins to perform this transaction.", NamedTextColor.RED)); + msgNew("You don't have enough coins to perform this transaction."); return true; } @@ -113,17 +112,15 @@ public class Command_coins extends FreedomCommand boolean plural = coinsToTransfer > 1; - msg(target, Component.text(sender.getName(), NamedTextColor.GOLD) - .append(Component.text(" has given you ", NamedTextColor.GREEN)) - .append(Component.text(coinsToTransfer, NamedTextColor.GOLD)) - .append(Component.text(" coin" + (plural ? "s" : "") + "!", NamedTextColor.GREEN))); + msgNew(target, " has given you coin!", + Placeholder.unparsed("sender", sender.getName()), + Placeholder.unparsed("coins", String.valueOf(coinsToTransfer)), + Placeholder.unparsed("plural", plural ? "s" : "")); - msg(target, Component.text("You have given ", NamedTextColor.GREEN) - .append(Component.text(coinsToTransfer, NamedTextColor.GOLD)) - .append(Component.text(" coin" + (plural ? "s" : ""), NamedTextColor.GOLD)) - .append(Component.text(" to ", NamedTextColor.GREEN)) - .append(Component.text(target.getName(), NamedTextColor.GOLD)) - .append(Component.text(".", NamedTextColor.GREEN))); + msgNew("You have given coin to .", + Placeholder.unparsed("player", target.getName()), + Placeholder.unparsed("coins", String.valueOf(coinsToTransfer)), + Placeholder.unparsed("plural", plural ? "s" : "")); plugin.pl.save(playerData); plugin.pl.save(senderData); diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java deleted file mode 100644 index 31eae9c8..00000000 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java +++ /dev/null @@ -1,55 +0,0 @@ -package me.totalfreedom.totalfreedommod.command; - -import java.util.Map; -import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.util.FUtil; -import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -@CommandPermissions(rank = Rank.OP, source = SourceType.ONLY_IN_GAME) -@CommandParameters(description = "Essentials Interface Command - Set your nickname to a certain color.", usage = "/ ") -public class Command_colorme extends FreedomCommand -{ - - @Override - public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) - { - if (args.length != 1) - { - return false; - } - - if (args[0].equalsIgnoreCase("list")) - { - msg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", ")); - return true; - } - - final String needle = args[0].trim().toLowerCase(); - ChatColor color = null; - for (Map.Entry entry : FUtil.CHAT_COLOR_NAMES.entrySet()) - { - if (entry.getKey().contains(needle)) - { - color = entry.getValue(); - break; - } - } - - if (color == null) - { - msg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors."); - return true; - } - - final String newNick = color + ChatColor.stripColor(playerSender.getDisplayName()).trim() + ChatColor.WHITE; - - plugin.esb.setNickname(sender.getName(), newNick); - - msg("Your nickname is now: " + newNick); - return true; - } -} \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java deleted file mode 100644 index 0dcf720a..00000000 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java +++ /dev/null @@ -1,50 +0,0 @@ -package me.totalfreedom.totalfreedommod.command; - -import me.totalfreedom.totalfreedommod.rank.Rank; -import org.apache.commons.lang.StringUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginDescriptionFile; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -@CommandPermissions(rank = Rank.NON_OP, source = SourceType.BOTH) -@CommandParameters(description = "Show all commands for all server plugins.", usage = "/", aliases = "cmdlist") -public class Command_commandlist extends FreedomCommand -{ - - @Override - public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) - { - List commands = new ArrayList<>(); - - for (Plugin targetPlugin : server.getPluginManager().getPlugins()) - { - try - { - PluginDescriptionFile desc = targetPlugin.getDescription(); - Map> map = desc.getCommands(); - - for (Entry> entry : map.entrySet()) - { - String command_name = entry.getKey(); - commands.add(command_name); - } - } catch (Throwable ignored) - { - } - } - - Collections.sort(commands); - - msg(StringUtils.join(commands, ", ")); - - return true; - } -} diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java index de4664dc..abe5528d 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java @@ -1,8 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.Rank; +import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -22,10 +24,9 @@ public class Command_consolesay extends FreedomCommand return false; } - server.broadcast(Component.text("[CONSOLE] ", NamedTextColor.GRAY) - .append(Component.text(sender.getName(), NamedTextColor.RED)) - .append(Component.text("» ", NamedTextColor.DARK_GRAY)) - .append(Component.text(StringUtils.join(args, " "), NamedTextColor.WHITE))); + server.broadcast(FUtil.miniMessage("[CONSOLE] » ", + Placeholder.unparsed("sender", sender.getName()), + Placeholder.unparsed("message", StringUtils.join(args, " ")))); if (plugin.dc != null) { diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java index 99464a24..d1efeb40 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java @@ -2,7 +2,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.GameMode; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -19,12 +19,12 @@ public class Command_creative extends FreedomCommand { if (isConsole()) { - msg(Component.text("When used from the console, you must define a target player.")); + msgNew("When used from the console, you must define a target player."); return true; } playerSender.setGameMode(GameMode.CREATIVE); - msg(Component.text("Your gamemode has been set to creative.")); + msgNew("Your gamemode has been set to creative."); return true; } @@ -37,7 +37,7 @@ public class Command_creative extends FreedomCommand server.getOnlinePlayers().forEach(player -> { player.setGameMode(GameMode.CREATIVE); - msg(player, Component.text("Your gamemode has been set to creative.")); + msgNew(player, "Your gamemode has been set to creative."); }); return true; @@ -51,8 +51,8 @@ public class Command_creative extends FreedomCommand return true; } - msg(Component.text("Setting " + player.getName() + " to gamemode creative")); - msg(player, Component.text(sender.getName() + " set your gamemode to creative.")); + msgNew("Setting to gamemode creative.", Placeholder.unparsed("player", player.getName())); + msgNew(player, " set your gamemode to creative.", Placeholder.unparsed("sender", sender.getName())); player.setGameMode(GameMode.CREATIVE); return true; } diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java index ea9b252a..86088f71 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java @@ -5,6 +5,7 @@ import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.kyori.adventure.title.Title; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -17,7 +18,6 @@ import java.time.Duration; @CommandParameters(description = "Freeze/Unfreeze a specified player, or all non-admins on the server.", usage = "/ [target | purge]", aliases = "fr") public class Command_freeze extends FreedomCommand { - @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -29,38 +29,28 @@ public class Command_freeze extends FreedomCommand if (!gFreeze) { FUtil.adminAction(sender.getName(), "Unfreezing all players", false); - msg("Players are now free to move."); - return true; + msgNew("Players are now free to move."); + } + else + { + FUtil.adminAction(sender.getName(), "Freezing all players", false); + server.getOnlinePlayers().stream().filter(player -> !isAdmin(player)).forEach(player -> + { + FUtil.playerTitle(player, "You have been frozen.", "Please be patient and you will be unfrozen shortly."); + msgNew(player, "You have been globally frozen due to an OP breaking the rules, please wait and you will be unfrozen soon."); + }); + + msgNew("Players are now frozen."); } - FUtil.adminAction(sender.getName(), "Freezing all players", false); - for (Player player : server.getOnlinePlayers()) - { - if (!isAdmin(player)) - { - player.showTitle(Title.title(Component.text("You have been frozen.", NamedTextColor.RED), - Component.text("Please be patient and you will be unfrozen shortly.", NamedTextColor.YELLOW), - Title.Times.of(Duration.ofSeconds(1), Duration.ofSeconds(5), Duration.ofSeconds(3)))); - msg(player, "You have been globally frozen due to an OP breaking the rules, please wait and you will be unfrozen soon.", ChatColor.RED); - } - } - msg("Players are now frozen."); return true; } if (args[0].equalsIgnoreCase("purge")) { FUtil.adminAction(sender.getName(), "Unfreezing all players", false); - for (Player player : server.getOnlinePlayers()) - { - if (!isAdmin(player)) - { - player.showTitle(Title.title(Component.text("You have been unfrozen.", NamedTextColor.GREEN), - Component.text("You may now move again.", NamedTextColor.YELLOW), - Title.Times.of(Duration.ofSeconds(1), Duration.ofSeconds(5), Duration.ofSeconds(3)))); - } - } plugin.fm.purge(); + server.getOnlinePlayers().stream().filter(player -> !isAdmin(player)).forEach(player -> FUtil.playerTitle(player, "You have been unfrozen.", "You may now move again.")); return true; } @@ -75,8 +65,9 @@ public class Command_freeze extends FreedomCommand final FreezeData fd = plugin.pl.getPlayer(player).getFreezeData(); fd.setFrozen(!fd.isFrozen()); - msg(Component.text(player.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".")); - msg(player, Component.text("You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".")); + msgNew(" has been .", Placeholder.unparsed("player", player.getName()), + Placeholder.unparsed("status", fd.isFrozen() ? "frozen" : "unfrozen")); + msgNew(player, "You have been .", Placeholder.unparsed("status", fd.isFrozen() ? "frozen" : "unfrozen")); return true; } } \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectator.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectator.java index bb0790e2..77f2746b 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectator.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectator.java @@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.Rank; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.GameMode; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -11,7 +12,6 @@ import org.bukkit.entity.Player; @CommandParameters(description = "Quickly change your own gamemode to spectator, or define someone's username to change theirs.", usage = "/ <[partialname]>", aliases = "gmsp") public class Command_spectator extends FreedomCommand { - @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -19,12 +19,12 @@ public class Command_spectator extends FreedomCommand { if (isConsole()) { - msg(Component.text("When used from the console, you must define a target player.")); + msgNew("When used from the console, you must define a target player."); return true; } playerSender.setGameMode(GameMode.SPECTATOR); - msg(Component.text("Your gamemode has been set to spectator.")); + msgNew("Your gamemode has been set to spectator."); return true; } @@ -36,9 +36,9 @@ public class Command_spectator extends FreedomCommand return true; } - msg(Component.text("Setting " + player.getName() + " to gamemode spectator")); - msg(player, Component.text(sender.getName() + " set your gamemode to spectator.")); + msgNew("Setting to gamemode spectator", Placeholder.unparsed("player", player.getName())); player.setGameMode(GameMode.SPECTATOR); + msgNew(player, " set your gamemode to spectator.", Placeholder.unparsed("sender", sender.getName())); return true; } } \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java index 19d6ed48..68414aab 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -20,13 +21,7 @@ public class Command_stop extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - - String reason = "Server is going offline, come back in about 20 seconds."; - - if (args.length != 0) - { - reason = StringUtils.join(args, " "); - } + String reason = args.length != 0 ? "Server is going offline, come back in about 20 seconds." : StringUtils.join(args, " "); if (sender.getName().equals("CONSOLE")) { @@ -40,7 +35,7 @@ public class Command_stop extends FreedomCommand } - msg("Warning: You're about to stop the server. Type /stop again to confirm you want to do this."); + msgNew("Warning: You're about to stop the server. Type /stop again to confirm you want to do this."); STOP_CONFIRM.put(sender, reason); new BukkitRunnable() @@ -51,7 +46,7 @@ public class Command_stop extends FreedomCommand if (STOP_CONFIRM.containsKey(sender)) { STOP_CONFIRM.remove(sender); - msg("Stop request expired."); + msgNew("Stop request expired."); } } }.runTaskLater(plugin, 15 * 20); @@ -60,15 +55,10 @@ public class Command_stop extends FreedomCommand public void shutdown(String reason) { - FUtil.bcastMsg("Server is going offline!", ChatColor.LIGHT_PURPLE); - - for (Player player : server.getOnlinePlayers()) - { - player.kickPlayer(ChatColor.LIGHT_PURPLE + reason); - } - + server.broadcast(FUtil.miniMessage("Server is going offline!")); + server.getOnlinePlayers().forEach(player -> + player.kick(FUtil.miniMessage("", Placeholder.unparsed("reason", reason)))); STOP_CONFIRM.remove(sender); - server.shutdown(); } } diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stopsound.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stopsound.java index 3c38b845..56b38225 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stopsound.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stopsound.java @@ -1,9 +1,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import me.totalfreedom.totalfreedommod.rank.Rank; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.ChatColor; import org.bukkit.Sound; import org.bukkit.command.Command; @@ -14,38 +16,21 @@ import org.bukkit.entity.Player; @CommandParameters(description = "Stops all sounds or a specified sound.", usage = "/ [sound]") public class Command_stopsound extends FreedomCommand { - @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length > 0) { - Sound sound = null; - - for (Sound loop : Sound.values()) + Arrays.stream(Sound.values()).filter(snd -> snd != null && snd.name().equalsIgnoreCase(args[0])).findAny().ifPresentOrElse(sound -> { - if (loop != null && loop.name().equalsIgnoreCase(args[0])) - { - sound = Sound.valueOf(args[0].toUpperCase()); - break; - } - } + playerSender.stopSound(sound); + msgNew("Stopped all sounds.", Placeholder.unparsed("sound", sound.name())); + }, () -> msgNew(" is not a valid sound.", Placeholder.unparsed("sound", args[0]))); - if (sound == null) - { - msg(args[0] + " is not a valid sound.", ChatColor.RED); - return true; - } - - playerSender.stopSound(sound); - msg("Stopped all " + sound.name() + " sounds", ChatColor.GREEN); return true; } - for (Sound sound : Sound.values()) - { - playerSender.stopSound(sound); - } + playerSender.stopAllSounds(); msg("Stopped all sounds.", ChatColor.GREEN); return true; @@ -54,20 +39,11 @@ public class Command_stopsound extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (args.length == 1) + if (args.length <= 1) { - return soundList(); + return Arrays.stream(Sound.values()).map(Enum::name).toList(); } + return Collections.emptyList(); } - - public List soundList() - { - List sounds = new ArrayList<>(); - for (Sound sound : Sound.values()) - { - sounds.add(sound.name()); - } - return sounds; - } } \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_survival.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_survival.java index b8f963c1..f1ae258a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_survival.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_survival.java @@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.GameMode; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -19,12 +20,12 @@ public class Command_survival extends FreedomCommand { if (isConsole()) { - msg("When used from the console, you must define a target player."); + msgNew("When used from the console, you must define a target player."); return true; } playerSender.setGameMode(GameMode.SURVIVAL); - msg("Your gamemode has been set to survival."); + msgNew("Your gamemode has been set to survival."); return true; } @@ -32,13 +33,14 @@ public class Command_survival extends FreedomCommand if (args[0].equals("-a")) { - for (Player targetPlayer : server.getOnlinePlayers()) - { - targetPlayer.setGameMode(GameMode.SURVIVAL); - } - FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to survival", false); - msg("Your gamemode has been set to survival."); + + server.getOnlinePlayers().forEach(player -> + { + player.setGameMode(GameMode.SURVIVAL); + msgNew(player, "Your gamemode has been set to survival."); + }); + return true; } @@ -50,9 +52,9 @@ public class Command_survival extends FreedomCommand return true; } - msg("Setting " + player.getName() + " to game mode survival."); - msg(player, sender.getName() + " set your game mode to survival."); + msgNew("Setting to gamemode survival", Placeholder.unparsed("player", player.getName())); player.setGameMode(GameMode.SURVIVAL); + msgNew(player, " set your gamemode to survival.", Placeholder.unparsed("sender", sender.getName())); return true; } } diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java index bca2124a..90f7fa46 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java @@ -4,6 +4,10 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.kyori.adventure.title.Title; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; @@ -11,6 +15,8 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import java.time.Duration; + @CommandPermissions(rank = Rank.ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Warns the specified player.", usage = "/ [-q] ") public class Command_warn extends FreedomCommand @@ -44,25 +50,27 @@ public class Command_warn extends FreedomCommand if (playerSender == player) { - msg(ChatColor.RED + "Please, don't try to warn yourself."); + msgNew("Please, don't try to warn yourself."); return true; } if (plugin.al.isAdmin(player)) { - msg(ChatColor.RED + "You can not warn admins"); + msgNew("You can't warn other admins!"); return true; } String warnReason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); - player.sendTitle(ChatColor.RED + "You've been warned.", ChatColor.YELLOW + "Reason: " + warnReason, 20, 100, 60); - msg(player, ChatColor.RED + "[WARNING] You received a warning from " + sender.getName() + ": " + warnReason); + player.showTitle(Title.title(Component.text("You have been warned.", NamedTextColor.RED), + Component.text("Reason: " + warnReason, NamedTextColor.YELLOW), + Title.Times.times(Duration.ofSeconds(1), Duration.ofSeconds(5), Duration.ofSeconds(3)))); + msgNew("[WARNING] You received a warning from : ", Placeholder.unparsed("sender", sender.getName()), Placeholder.unparsed("reason", warnReason)); plugin.pl.getPlayer(player).incrementWarnings(quiet); plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.WARN, warnReason)); if (quiet) { - msg("You have successfully warned " + player.getName() + " quietly."); + msgNew("You have successfully warned quietly.", Placeholder.unparsed("player", player.getName())); } else { @@ -76,7 +84,7 @@ public class Command_warn extends FreedomCommand warnReason; plugin.al.messageAllAdmins(adminNotice); - msg("You have successfully warned " + player.getName() + "."); + msgNew("You have successfully warned .", Placeholder.unparsed("player", player.getName())); } return true; } diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java index c07824d9..de82c66e 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java @@ -4,6 +4,8 @@ import java.util.*; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang3.StringUtils; import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; @@ -27,11 +29,11 @@ public class Command_whitelist extends FreedomCommand { if (server.getWhitelistedPlayers().isEmpty()) { - msg("There are no whitelisted players."); + msgNew("There are no whitelisted players."); return true; } - msg("Whitelisted players: " + FUtil.listToString(server.getWhitelistedPlayers().stream().map(player -> - player.getName() != null ? player.getName() : player.getUniqueId().toString()).toList())); + msgNew("Whitelisted players: ", Placeholder.unparsed("players", FUtil.listToString(server.getWhitelistedPlayers().stream().map(player -> + player.getName() != null ? player.getName() : player.getUniqueId().toString()).toList()))); return true; } @@ -55,9 +57,9 @@ public class Command_whitelist extends FreedomCommand totalWPs++; } - msg("Online whitelisted players: " + onlineWPs); - msg("Offline whitelisted players: " + offlineWPs); - msg("Total whitelisted players: " + totalWPs); + msgNew("Online whitelisted players: ", Placeholder.unparsed("online", String.valueOf(onlineWPs))); + msgNew("Offline whitelisted players: ", Placeholder.unparsed("offline", String.valueOf(offlineWPs))); + msgNew("Total whitelisted players: ", Placeholder.unparsed("total", String.valueOf(totalWPs))); return true; } @@ -126,7 +128,7 @@ public class Command_whitelist extends FreedomCommand } else { - msg("That player is not whitelisted"); + msgNew("That player is not whitelisted"); } return true; } @@ -145,7 +147,7 @@ public class Command_whitelist extends FreedomCommand } } - msg("Whitelisted " + counter + " players."); + msgNew("Whitelisted players.", Placeholder.unparsed("count", String.valueOf(counter))); return true; } @@ -157,7 +159,7 @@ public class Command_whitelist extends FreedomCommand if (args[0].equalsIgnoreCase("purge")) { FUtil.adminAction(sender.getName(), "Removing all players from the whitelist", false); - msg("Removed " + purge() + " players from the whitelist."); + msgNew("Removed players from the whitelist.", Placeholder.unparsed("count", String.valueOf(purge()))); return true; } return false; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java index 63beb305..59bc0864 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java @@ -6,6 +6,7 @@ import java.util.List; import me.totalfreedom.totalfreedommod.rank.Rank; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; import org.bukkit.Material; import org.bukkit.command.Command; @@ -32,7 +33,7 @@ public class Command_whohas extends FreedomCommand if (material == null) { - msg(Component.text("Invalid item: " + materialName, NamedTextColor.RED)); + msgNew("Invalid item: ", Placeholder.unparsed("type", materialName)); return true; } @@ -47,12 +48,12 @@ public class Command_whohas extends FreedomCommand if (players.isEmpty()) { - msg(Component.text("There are no players with that item.")); + msgNew("There are no players with that item."); } else { - msg(Component.text("Players with item " + material.name() + ": " + - StringUtils.join(players.stream().map(HumanEntity::getName).toList(), ", "))); + msgNew("Players with item : ", Placeholder.unparsed("type", material.name()), + Placeholder.unparsed("players", StringUtils.join(players.stream().map(HumanEntity::getName).toList(), ", "))); } return true; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java index e4ee30e5..21f2f845 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java @@ -6,6 +6,7 @@ import java.util.List; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Rank; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -16,7 +17,6 @@ import org.bukkit.entity.Player; @CommandParameters(description = "Run any command on all users, username placeholder = ?.", usage = "/ [fluff] ? [fluff] ?") public class Command_wildcard extends FreedomCommand { - @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -30,7 +30,7 @@ public class Command_wildcard extends FreedomCommand boolean alias = plugin.cl.isAlias(args[0]); if (runCmd == null && fCmd == null && !alias) { - msg("Unknown command: " + args[0], ChatColor.RED); + msgNew("Unknown command: ", Placeholder.unparsed("command", args[0])); return true; } @@ -50,7 +50,7 @@ public class Command_wildcard extends FreedomCommand { if (blockedCommand.equals(args[0].toLowerCase()) || aliases.contains(blockedCommand)) { - msg("Did you really think that was going to work?", ChatColor.RED); + msgNew("Did you really think that was going to work?"); return true; } } @@ -66,7 +66,7 @@ public class Command_wildcard extends FreedomCommand for (Player player : server.getOnlinePlayers()) { String runCommand = baseCommand.replaceAll("\\x3f", player.getName()); - msg("Running Command: " + runCommand); + msgNew("Running command: ", Placeholder.unparsed("command", baseCommand)); server.dispatchCommand(sender, runCommand); } diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java index eeaa2820..bd31ae55 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java @@ -9,6 +9,7 @@ import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -142,6 +143,18 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter msg(sender, message); } + protected void msgNew(CommandSender sender, String message, TagResolver... placeholders) + { + sender.sendMessage(FUtil.miniMessage("" + message, placeholders)); + } + + protected void msgNew(String message, TagResolver... placeholders) + { + msgNew(sender, message, placeholders); + } + + + protected void msg(String message, ChatColor color) { msg(color + message);