diff --git a/pom.xml b/pom.xml index 4a68ac9..cf9b8ab 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.tubyoub StatusPlugin - 1.5.1 + 1.5.2 jar Tub's Status Plugin diff --git a/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java b/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java index 00d717f..57ca168 100644 --- a/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java +++ b/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java @@ -50,12 +50,14 @@ public void onPlayerChat(PlayerChatEvent event) { status = PlaceholderAPI.setPlaceholders(player, status); } + // message = plugin.getStatusManager().translateColorsAndFormatting(message,player); + // Format the broadcast message String broadcastMessage; - if (status == null) { - broadcastMessage = player.getName() + ": " + message; + if (status.isEmpty()) { + broadcastMessage = player.getName() + ": " + plugin.getStatusManager().translateColorsAndFormatting(message,player); } else { - broadcastMessage = "[" + ColourUtils.format(status) + ChatColor.RESET + "] " + player.getName() + ": " + message; + broadcastMessage = configManager.getOpeningCharacter() + ColourUtils.format(status) + ChatColor.RESET + configManager.getClosingCharacter() + " " + player.getName() + ": " + plugin.getStatusManager().translateColorsAndFormatting(message,player); } // Broadcast the message and cancel the original event diff --git a/src/main/java/de/tubyoub/statusplugin/Listener/PlayerJoinListener.java b/src/main/java/de/tubyoub/statusplugin/Listener/PlayerJoinListener.java index 899d5fa..638de9f 100644 --- a/src/main/java/de/tubyoub/statusplugin/Listener/PlayerJoinListener.java +++ b/src/main/java/de/tubyoub/statusplugin/Listener/PlayerJoinListener.java @@ -49,9 +49,9 @@ public void onPlayerJoin(PlayerJoinEvent event) { if (player.hasPermission("StatusPlugin.admin") && plugin.getConfigManager().isCheckUpdate()) { // Alert if a critical update is available if (this.versionInfo.isNewVersionAvailable && this.versionInfo.urgency == UpdateUrgency.CRITICAL || this.versionInfo.urgency == UpdateUrgency.HIGH) { - player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + "A critical update for BT Grave is available!"); - player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + "Please update to version: " + this.versionInfo.latestVersion); - player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + "Backup your config"); + player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + " A critical update for Tubs StatusPlugin is available!"); + player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + " Please update to version: " + this.versionInfo.latestVersion); + player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + " Backup your config"); // only works this way and idk why TextComponent modrinthLink = new TextComponent(ChatColor.GREEN + "" + ChatColor.UNDERLINE + "Modrinth"); modrinthLink.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://modrinth.com/plugin/bt-graves/version/" + this.versionInfo.latestVersion)); diff --git a/src/main/java/de/tubyoub/statusplugin/Managers/StatusManager.java b/src/main/java/de/tubyoub/statusplugin/Managers/StatusManager.java index a9ff61b..391f430 100644 --- a/src/main/java/de/tubyoub/statusplugin/Managers/StatusManager.java +++ b/src/main/java/de/tubyoub/statusplugin/Managers/StatusManager.java @@ -120,7 +120,7 @@ public String getStatus(Player player) { public void updateDisplayName(Player player) { String status = getStatus(player); - if (status != "") { + if (status.isEmpty()) { String translatedStatus = translateColorsAndFormatting(status, player); if (plugin.isLuckPermsPresent() && player.hasPermission("StatusPlugin.placeholders")) { translatedStatus.replace("%LP_prefix%", Objects.requireNonNull(plugin.getLuckPerms().getPlayerAdapter(Player.class).getUser(player).getCachedData().getMetaData().getPrefix())); @@ -216,7 +216,7 @@ public String translateColorsAndFormatting(String status, CommandSender sender) status = status.replace(codes[i], ""); } } - return ChatColor.translateAlternateColorCodes('ยง', status); + return ChatColor.translateAlternateColorCodes('&', status); } /** diff --git a/src/main/java/de/tubyoub/statusplugin/StatusPlaceholderExpansion.java b/src/main/java/de/tubyoub/statusplugin/StatusPlaceholderExpansion.java index 546e0c4..c3012d5 100644 --- a/src/main/java/de/tubyoub/statusplugin/StatusPlaceholderExpansion.java +++ b/src/main/java/de/tubyoub/statusplugin/StatusPlaceholderExpansion.java @@ -76,7 +76,7 @@ public String getVersion(){ @Override public String onPlaceholderRequest(Player player, String identifier){ if(player == null){ - return ""; + return null; } if (Objects.equals(identifier, "status")){ return plugin.getStatusManager().getStatus(player); diff --git a/src/main/java/de/tubyoub/statusplugin/StatusPlugin.java b/src/main/java/de/tubyoub/statusplugin/StatusPlugin.java index 666da7f..fd66c3b 100644 --- a/src/main/java/de/tubyoub/statusplugin/StatusPlugin.java +++ b/src/main/java/de/tubyoub/statusplugin/StatusPlugin.java @@ -22,7 +22,7 @@ * This class extends JavaPlugin and represents the main entry point for the plugin. */ public class StatusPlugin extends JavaPlugin { - private final String version = "1.5.1"; + private final String version = "1.5.2"; private final String project = "km0yAITg"; private int pluginId = 20463; private StatusManager statusManager;