diff --git a/pom.xml b/pom.xml
index 2e068d7..4da39e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
dev.majek.hexnicks
HexNicks
- 1.4.3
+ 1.4.4
jar
HexNicks
diff --git a/src/main/java/dev/majek/hexnicks/CommandNick.java b/src/main/java/dev/majek/hexnicks/CommandNick.java
index 7aa0c68..f9f2c8f 100755
--- a/src/main/java/dev/majek/hexnicks/CommandNick.java
+++ b/src/main/java/dev/majek/hexnicks/CommandNick.java
@@ -36,17 +36,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
FileConfiguration config = HexNicks.instance.getConfig();
int max = config.getInt("max-length");
int min = config.getInt("min-length");
- String foo = "$This is a &btest message with a gradient &fwoo! &c and maybe some fancy ${hover,&ahover,WOOO} text? ${";
- //player.sendMessage(TextUtils.parseExpression(BaseComponent.toLegacyText(BungeeComponentSerializer.get().serialize(MiniMessage.get().parse(HexNicks.applyColorCodes(foo))))));
- //player.sendMessage(MiniMessage.get().parse("This is a &btest message with a gradient &fwoo!"));
- //player.sendMessage(HexNicks.format("This is a &btest message with a gradient &fwoo!"));
-
- if (config.getBoolean("use-permissions", false)) {
- if (!player.hasPermission("hexnicks.use")) {
- player.sendMessage(TextUtils.applyColorCodes(config.getString("no-permission")));
- return true;
- }
+ if (!player.hasPermission("hexnicks.nick")) {
+ player.sendMessage(TextUtils.applyColorCodes(config.getString("no-permission")));
+ return true;
}
if (args.length >= 1) {
@@ -108,11 +101,9 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
Player player = (Player) sender;
FileConfiguration config = HexNicks.instance.getConfig();
- if (config.getBoolean("use-permissions")) {
- if (!player.hasPermission("hexnicks.use")) {
- player.sendMessage(TextUtils.applyColorCodes(config.getString("no-permission")));
- return true;
- }
+ if (!player.hasPermission("hexnicks.nonick")) {
+ player.sendMessage(TextUtils.applyColorCodes(config.getString("no-permission")));
+ return true;
}
if (args.length > 0) {
@@ -130,7 +121,6 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
} else {
setNickname(player, player.getName(), false);
-
player.sendMessage(TextUtils.applyColorCodes(config.getString("nickname-removed")));
}
@@ -148,12 +138,11 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
Player player = (Player) sender;
FileConfiguration config = HexNicks.instance.getConfig();
- if (config.getBoolean("use-permissions")) {
- if (!player.hasPermission("hexnicks.changecolor")) {
- player.sendMessage(TextUtils.applyColorCodes(config.getString("no-permission")));
- return true;
- }
+ if (!player.hasPermission("hexnicks.nickcolor")) {
+ player.sendMessage(TextUtils.applyColorCodes(config.getString("no-permission")));
+ return true;
}
+
if (args.length == 1) {
String nick;
if (TextUtils.removeColorCodes(args[0]).equals("")) {
@@ -174,7 +163,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
if (cmd.getName().equalsIgnoreCase("hexreload")) {
FileConfiguration config = HexNicks.instance.getConfig();
- if (sender.hasPermission("hexnicks.admin")) {
+ if (sender.hasPermission("hexnicks.reload")) {
HexNicks.instance.reloadConfig();
HexNicks.instance.loadNicksFromJSON();
sender.sendMessage(TextUtils.applyColorCodes(config.getString("config-reloaded")));
@@ -199,26 +188,25 @@ public static void setNickname(Player player, String nick, boolean sendMessage)
FileConfiguration config = HexNicks.instance.getConfig();
// Separate lines to help with debugging if something goes wrong
- String finalNick = nick;
if (player.hasPermission("hexnicks.colors.hex")) {
- Component nickComp = MiniMessage.get().parse(finalNick);
+ Component nickComp = MiniMessage.get().parse(nick);
BaseComponent[] nickBase = BungeeComponentSerializer.get().serialize(nickComp);
- finalNick = BaseComponent.toLegacyText(nickBase);
- finalNick = TextUtils.applyColorCodes(finalNick + "&r&f");
+ nick = BaseComponent.toLegacyText(nickBase);
+ nick = TextUtils.applyColorCodes(nick + "&r&f");
} else if (player.hasPermission("hexnicks.colors.normal"))
- finalNick = TextUtils.applyColorCodes(finalNick, false, true);
+ nick = TextUtils.applyColorCodes(nick, false, true);
else
- finalNick = TextUtils.removeColorCodes(finalNick);
+ nick = TextUtils.removeColorCodes(nick);
- player.setDisplayName(finalNick);
+ player.setDisplayName(nick);
if (config.getBoolean("tab-nicknames"))
- player.setPlayerListName(finalNick);
+ player.setPlayerListName(nick);
- nicks.put(player.getUniqueId(), finalNick);
+ nicks.put(player.getUniqueId(), nick);
try {
- HexNicks.instance.jsonConfig.putInJSONObject(player.getUniqueId().toString(), finalNick);
+ HexNicks.instance.jsonConfig.putInJSONObject(player.getUniqueId().toString(), nick);
} catch (IOException | ParseException e) {
HexNicks.instance.getLogger().severe("Error saving nickname to nicknames.json data file.");
e.printStackTrace();
@@ -226,9 +214,9 @@ public static void setNickname(Player player, String nick, boolean sendMessage)
// SQL shit
if (HexNicks.instance.SQL.isConnected())
- HexNicks.instance.data.addNickname(player.getUniqueId(), finalNick);
+ HexNicks.instance.data.addNickname(player.getUniqueId(), nick);
if (sendMessage)
- player.sendMessage(TextUtils.applyColorCodes((config.getString("nickname-set") + "").replace("%nick%", finalNick)));
+ player.sendMessage(TextUtils.applyColorCodes((config.getString("nickname-set") + "").replace("%nick%", nick)));
}
public String getNickFromMsg(String[] args, Player player) {
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index bebfc96..32c5eb2 100755
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -7,6 +7,7 @@ max-length: 20
min-length: 3
# If set to true only players with permission hexnicks.use will be able to use /nick (false by default)
+# No longer does anything, all permissions are given by default. Must be negated with permission manager,
use-permissions: false
# If set to true then players nicknames will be shown in the tablist
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index a78875e..2c41da5 100755
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -10,29 +10,45 @@ commands:
description: Change your nickname.
aliases: [nickname]
usage: /nick [player] | Use /nick help for more
+ permission: hexnicks.nick
nickcolor:
description: Change just the color of your nickname.
aliases: [colornick]
usage: /nick
+ permission: hexnicks.nickcolor
nonick:
description: Remove you nickname.
usage: /nonick [player]
+ permission: hexnicks.nonick
hexreload:
description: Reload the plugin config file and data file.
+ permission: hexnicks.reload
permissions:
- hexnicks.use:
- description: Use /nick if use-permissions is enabled in the config.yml
- children: [hexnicks.changecolor, hexnicks.colors.normal, hexnicks.colors.hex]
- hexnicks.changecolor:
- description: Use /nickcolor if use-permissions is enabled in the config.yml
+ hexnicks.nick:
+ description: Permission to use /nick with normal and hex color codes.
+ children:
+ - hexnicks.colors.normal
+ - hexnicks.colors.hex
+ default: true
+ hexnicks.nickcolor:
+ description: Permission to use /nickcolor with normal and hex color codes.
+ children:
+ - hexnicks.colors.normal
+ - hexnicks.colors.hex
+ default: true
hexnicks.colors.normal:
- description: Ability to use normal color codes in nicknames
+ description: Ability to use normal color codes in nicknames.
hexnicks.colors.hex:
- description: Ability to use hex color codes in nicknames
+ description: Ability to use hex color codes in nicknames.
hexnicks.admin:
description: Ability to run HexNicks admin commands.
+ children:
+ - hexnicks.reload
default: op
- hexnicks.chat:
- description: Ability to use color codes in chat if use-permissions is enabled in the config.yml
+ hexnicks.reload:
+ description: Permission to reload the plugin.
default: op
+ hexnicks.chat:
+ description: Permission to use color codes in chat.
+ default: true