Capitalize mod name in message prefix
This commit is contained in:
@@ -110,7 +110,7 @@ public final class BlockPlaceMods implements Module, Listener
|
||||
if (args.length > 0) {
|
||||
Mod target = ModAbstract.getMod(args[0].toLowerCase());
|
||||
if (target != null) {
|
||||
prefix += "&7[&2" + target.getName() + "&7]&a";
|
||||
prefix += "&7[&2" + capitalize(target.getName()) + "&7]&a";
|
||||
if (!(sender instanceof Player)) {
|
||||
message = "&cYou must be a player to use any block place mod";
|
||||
} else {
|
||||
@@ -158,4 +158,17 @@ public final class BlockPlaceMods implements Module, Listener
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static String capitalize(String modName) {
|
||||
if (modName.isEmpty()) {
|
||||
return modName;
|
||||
}
|
||||
char first = modName.charAt(0);
|
||||
if (first != (first = Character.toUpperCase(first))) {
|
||||
char[] result = modName.toCharArray();
|
||||
result[0] = first;
|
||||
return String.valueOf(result);
|
||||
}
|
||||
return modName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user