From c0fff90138ea14ff4219f75e08330fcbec0a8ff5 Mon Sep 17 00:00:00 2001 From: TubYoub Date: Thu, 12 Sep 2024 18:27:49 +0200 Subject: [PATCH] v1.4.1 added config for opening and closing Characters for the status fixed typo for `/status group`, from "grave" > "group" Took 25 minutes --- pom.xml | 2 +- .../tubyoub/statusplugin/Managers/ConfigManager.java | 10 ++++++++++ .../tubyoub/statusplugin/Managers/StatusManager.java | 2 +- .../java/de/tubyoub/statusplugin/StatusPlugin.java | 2 +- .../commands/tabCompleter/StatusTabCompleter.java | 4 ++-- src/main/resources/config.yml | 9 +++++++-- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 0f56e25..a722e2d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.tubyoub StatusPlugin - 1.4 + 1.4.1 jar Tub's Status Plugin diff --git a/src/main/java/de/tubyoub/statusplugin/Managers/ConfigManager.java b/src/main/java/de/tubyoub/statusplugin/Managers/ConfigManager.java index 4009529..336a891 100644 --- a/src/main/java/de/tubyoub/statusplugin/Managers/ConfigManager.java +++ b/src/main/java/de/tubyoub/statusplugin/Managers/ConfigManager.java @@ -20,6 +20,8 @@ public class ConfigManager { private boolean chatFormatter; private boolean tablistFormatter; private boolean groupMode; + private String openingCharacter; + private String closingCharacter; private Map statusGroups; private final StatusPlugin plugin; @@ -41,6 +43,8 @@ public void loadConfig() { chatFormatter = config.getBoolean("chatFormatter", true); tablistFormatter = config.getBoolean("changeTablistNames", true); groupMode = config.getBoolean("groupMode", false); + openingCharacter = config.getString("openingCharacter", "["); + closingCharacter = config.getString("closingCharacter", "]"); loadStatusGroups(); } catch (IOException e) { plugin.getLogger().severe("Could not load configuration: " + e.getMessage()); @@ -113,6 +117,12 @@ public void setGroupMode(boolean groupMode) { config.set("groupMode", groupMode); saveConfig(); } + public String getOpeningCharacter() { + return openingCharacter; + } + public String getClosingCharacter() { + return closingCharacter; + } public Map getStatusGroups() { return statusGroups; diff --git a/src/main/java/de/tubyoub/statusplugin/Managers/StatusManager.java b/src/main/java/de/tubyoub/statusplugin/Managers/StatusManager.java index a9d07e2..f37632b 100644 --- a/src/main/java/de/tubyoub/statusplugin/Managers/StatusManager.java +++ b/src/main/java/de/tubyoub/statusplugin/Managers/StatusManager.java @@ -124,7 +124,7 @@ public void updateDisplayName(Player player) { if (placeholderAPIPresent && player.hasPermission("StatusPlugin.placeholders")) { translatedStatus = PlaceholderAPI.setPlaceholders(player, translatedStatus); } - String displayName = "[" + translatedStatus + ChatColor.RESET + "] " + ChatColor.WHITE + player.getName(); + String displayName = configManager.getOpeningCharacter() + translatedStatus + ChatColor.RESET + configManager.getClosingCharacter() + " " + ChatColor.WHITE + player.getName(); displayName = ColourUtils.format(displayName); player.setDisplayName(displayName); player.setPlayerListName(displayName); diff --git a/src/main/java/de/tubyoub/statusplugin/StatusPlugin.java b/src/main/java/de/tubyoub/statusplugin/StatusPlugin.java index 068f7dd..78ae5a4 100644 --- a/src/main/java/de/tubyoub/statusplugin/StatusPlugin.java +++ b/src/main/java/de/tubyoub/statusplugin/StatusPlugin.java @@ -23,7 +23,7 @@ * This class extends JavaPlugin and represents the main entry point for the plugin. */ public class StatusPlugin extends JavaPlugin { - private final String version = "1.4"; + private final String version = "1.4.1"; private StatusManager statusManager; private VersionChecker versionChecker; private boolean placeholderAPIPresent = false; diff --git a/src/main/java/de/tubyoub/statusplugin/commands/tabCompleter/StatusTabCompleter.java b/src/main/java/de/tubyoub/statusplugin/commands/tabCompleter/StatusTabCompleter.java index ba78526..da98f96 100644 --- a/src/main/java/de/tubyoub/statusplugin/commands/tabCompleter/StatusTabCompleter.java +++ b/src/main/java/de/tubyoub/statusplugin/commands/tabCompleter/StatusTabCompleter.java @@ -40,7 +40,7 @@ public List onTabComplete(CommandSender sender, Command command, String suggestions.add("resetmaxlength"); suggestions.add("info"); suggestions.add("reload"); - suggestions.add("grave"); + suggestions.add("group"); } else if (args.length == 2) { // Add suggestions for the second argument of the command based on the first argument if (args[0].equalsIgnoreCase("remove")) { @@ -54,7 +54,7 @@ public List onTabComplete(CommandSender sender, Command command, String } else if (args[0].equalsIgnoreCase("help")) { // If the first argument is "help", suggest "colorcodes" suggestions.add("colorcodes"); - } else if (args[0].equalsIgnoreCase("grave")) { + } else if (args[0].equalsIgnoreCase("group")) { // If the first argument is the group command, suggest available groups suggestions.addAll(plugin.getConfigManager().getStatusGroups().keySet()); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index bfa6732..c7ab57c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -3,7 +3,7 @@ # by TubYoub # ################################ # Don't change this value, it's changed by the plugin if needed -fileversion: 3 +fileversion: 4 # maximum Character length a Status should be allowed to have. # default: 15 @@ -26,4 +26,9 @@ statusGroups: t2: status: 'Team2' t3: - status: 'Team3' \ No newline at end of file + status: 'Team3' + +# Opening and closing characters for the status +# default: '[' & ']' +openingCharacter: '[' +closingCharacter: ']' \ No newline at end of file