Skip to content

Commit

Permalink
Merge pull request #6 from BT-Pluginz/v1.4.1
Browse files Browse the repository at this point in the history
v1.4.1
  • Loading branch information
TubYoub authored Sep 12, 2024
2 parents 13e237f + c0fff90 commit b9f9d82
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.tubyoub</groupId>
<artifactId>StatusPlugin</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<packaging>jar</packaging>

<name>Tub's Status Plugin</name>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/de/tubyoub/statusplugin/Managers/ConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class ConfigManager {
private boolean chatFormatter;
private boolean tablistFormatter;
private boolean groupMode;
private String openingCharacter;
private String closingCharacter;
private Map<String, String> statusGroups;
private final StatusPlugin plugin;

Expand All @@ -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());
Expand Down Expand Up @@ -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<String, String> getStatusGroups() {
return statusGroups;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/tubyoub/statusplugin/StatusPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public List<String> 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")) {
Expand All @@ -54,7 +54,7 @@ public List<String> 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());
}
Expand Down
9 changes: 7 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,4 +26,9 @@ statusGroups:
t2:
status: 'Team2'
t3:
status: 'Team3'
status: 'Team3'

# Opening and closing characters for the status
# default: '[' & ']'
openingCharacter: '['
closingCharacter: ']'

0 comments on commit b9f9d82

Please sign in to comment.