From fe7f787891ee6fb7cf87616906e3991d7dd7e23a Mon Sep 17 00:00:00 2001 From: TubYoub Date: Sun, 15 Dec 2024 18:15:17 +0100 Subject: [PATCH 1/4] changed Plugin name for alerting admin for new updates Took 19 minutes --- .../tubyoub/statusplugin/Listener/PlayerJoinListener.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)); From d23a320ae5fcb56f33ae41be22b13e8e12f6c04d Mon Sep 17 00:00:00 2001 From: TubYoub Date: Sun, 15 Dec 2024 19:38:45 +0100 Subject: [PATCH 2/4] there will no empty brackets when someone has no status and sends a message when chatformatter is turned on Took 49 minutes --- .../de/tubyoub/statusplugin/Listener/ChatListener.java | 8 +++++--- .../de/tubyoub/statusplugin/Managers/StatusManager.java | 4 ++-- .../tubyoub/statusplugin/StatusPlaceholderExpansion.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java b/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java index 00d717f..dc2e881 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,event.getPlayer()); } 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/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); From c8567142557acb725e820613c56238f04c82b1fb Mon Sep 17 00:00:00 2001 From: TubYoub Date: Sun, 15 Dec 2024 19:39:23 +0100 Subject: [PATCH 3/4] version bump Took 38 seconds --- pom.xml | 2 +- src/main/java/de/tubyoub/statusplugin/StatusPlugin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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; From ab28867c17e67920ad8e78aea8934de5c6a85c06 Mon Sep 17 00:00:00 2001 From: TubYoub Date: Sun, 15 Dec 2024 19:43:17 +0100 Subject: [PATCH 4/4] typo Took 4 minutes --- .../java/de/tubyoub/statusplugin/Listener/ChatListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java b/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java index dc2e881..57ca168 100644 --- a/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java +++ b/src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.java @@ -55,9 +55,9 @@ public void onPlayerChat(PlayerChatEvent event) { // Format the broadcast message String broadcastMessage; if (status.isEmpty()) { - broadcastMessage = player.getName() + ": " + plugin.getStatusManager().translateColorsAndFormatting(message,event.getPlayer()); + broadcastMessage = player.getName() + ": " + plugin.getStatusManager().translateColorsAndFormatting(message,player); } else { - broadcastMessage = configManager.getOpeningCharacter() + ColourUtils.format(status) + ChatColor.RESET + configManager.getClosingCharacter() + " " + player.getName() + ": " + plugin.getStatusManager().translateColorsAndFormatting(message,player);; + 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