From 56b712729abfe2da487db23d69b36c113832a064 Mon Sep 17 00:00:00 2001 From: Lemon Date: Sat, 2 Jun 2018 02:28:44 +0500 Subject: [PATCH 1/9] might as well shorten that --- src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java index e418bb66..13a00141 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java @@ -6,7 +6,7 @@ import org.bukkit.ChatColor; public enum Title implements Displayable { - MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, "Master-Builder"), + MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, "MB"), EXECUTIVE("an", "Executive", ChatColor.RED, "Exec"), DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, "Dev"), OWNER("the", "Owner", ChatColor.BLUE, "Owner"); From 4cf338bfb5584c392e5d99534807e9876e13fbc2 Mon Sep 17 00:00:00 2001 From: Lemon Date: Sat, 2 Jun 2018 03:39:52 +0500 Subject: [PATCH 2/9] add customization of admin format --- .../totalfreedommod/ChatManager.java | 32 +++++++++++-------- .../totalfreedommod/admin/Admin.java | 16 +++++++--- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java index 69134f96..934ef049 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod; +import com.google.common.base.Strings; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.rank.Displayable; @@ -106,22 +107,22 @@ public class ChatManager extends FreedomService event.setFormat(format); } - public String getOldPrefix(Displayable display) + public String getColoredTag(Admin admin, Displayable display) { ChatColor color = display.getColor(); - - if (color.equals(ChatColor.AQUA)) + if(admin.getOldTags()) { - color = ChatColor.GOLD; - } - else if (color.equals(ChatColor.GOLD)) - { - color = ChatColor.LIGHT_PURPLE; - } - String prefix = "(" + display.getAbbr() + ")"; - - return color + prefix; + if (color.equals(ChatColor.AQUA)) + { + color = ChatColor.GOLD; + } + else if (color.equals(ChatColor.GOLD)) + { + color = ChatColor.LIGHT_PURPLE; + } + } + return color + display.getAbbr(); } public void adminChat(CommandSender sender, String message) @@ -134,9 +135,12 @@ public class ChatManager extends FreedomService if (plugin.al.isAdmin(player)) { Admin admin = plugin.al.getAdmin(player); - if (admin.getOldAdminMode()) + if (!Strings.isNullOrEmpty(admin.getAcFormat())) { - player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + " " + getOldPrefix(display) + ChatColor.WHITE + ": " + ChatColor.AQUA + message); + String coloredTag = getColoredTag(admin, display); + String format = admin.getAcFormat(); + String msg = format.replace("%name%", sender.getName()).replace("%tag%", coloredTag).replace("%message%", message); + player.sendMessage(msg); } else { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java index 1aaefda2..caaa2b30 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java @@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod.admin; import com.google.common.collect.Lists; import java.util.Date; import java.util.List; + import lombok.Getter; import lombok.Setter; import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode; @@ -53,7 +54,10 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable private Boolean potionSpy = false; @Getter @Setter - private Boolean oldAdminMode = false; + private String acFormat = null; + @Getter + @Setter + private Boolean oldTags = null; public static final String CONFIG_FILENAME = "admins.yml"; @@ -81,7 +85,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable .append("- Rank: ").append(rank.getName()).append("\n") .append("- Is Active: ").append(active).append("\n") .append("- Discord ID: ").append(discordID).append("\n") - .append("- Tag: ").append(tag); + .append("- Tag: ").append(tag).append("\n") + .append("- Admin Chat Format:").append(acFormat); return output.toString(); } @@ -108,7 +113,9 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable tag = cs.getString("tag", null); commandSpy = cs.getBoolean("command_spy", false); potionSpy = cs.getBoolean("potion_spy", false); - oldAdminMode = cs.getBoolean("old_admin_mode", false); + acFormat = cs.getString("acformat", null); + oldTags = cs.getBoolean("oldtags", false); + } @Override @@ -125,7 +132,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable cs.set("tag", tag); cs.set("command_spy", commandSpy); cs.set("potion_spy", potionSpy); - cs.set("old_admin_mode", oldAdminMode); + cs.set("acformat", acFormat); + cs.set("oldtags", oldTags); } public boolean isAtLeast(Rank pRank) From 6647088429a9f13475adc9bd279201357eacaeb8 Mon Sep 17 00:00:00 2001 From: Lemon Date: Sat, 2 Jun 2018 03:40:25 +0500 Subject: [PATCH 3/9] why did that not push --- .../command/Command_myadmin.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java index a80b8a2e..d62e68a8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java @@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.OP, source = SourceType.BOTH) -@CommandParameters(description = "Manage my admin entry", usage = "/ [-o ] | setlogin | clearlogin | settag | cleartag>") +@CommandParameters(description = "Manage my admin entry", usage = "/ [-o ] | setlogin | clearlogin | settag | cleartag | setacformat | clearacformat> | oldtags>") public class Command_myadmin extends FreedomCommand { @@ -174,12 +174,38 @@ public class Command_myadmin extends FreedomCommand case "cleartag": { FUtil.adminAction(sender.getName(), "Clearing personal default tag" + (init == null ? "" : " for " + targetPlayer.getName()), false); - String tag = StringUtils.join(args, " ", 1, args.length); target.setTag(null); plugin.al.save(); plugin.al.updateTables(); return true; } + case "setacformat": + { + String format = StringUtils.join(args, " ", 1, args.length); + target.setAcFormat(format); + plugin.al.save(); + plugin.al.updateTables(); + msg("Set admin chat format to \"" + format + "\".", ChatColor.GRAY); + String example = format.replace("%name%", "ExampleAdmin").replace("%rank%", "STA").replace("%msg%", "The quick brown fox jumps over the lazy dog."); + msg(ChatColor.GRAY + "Example: " + FUtil.colorize(example)); + return true; + } + case "clearacformat": + { + target.setAcFormat(null); + plugin.al.save(); + plugin.al.updateTables(); + msg("Cleared admin chat format.", ChatColor.GRAY); + return true; + } + case "oldtags": + { + target.setOldTags(!target.getOldTags()); + plugin.al.save(); + plugin.al.updateTables(); + msg(target.getOldTags() ? "Enabled" : "Disabled" + " old tags."); + return true; + } default: { From b8f4119924c5947e5ff060df9e22ff31c675d2ed Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Fri, 1 Jun 2018 22:36:37 -0700 Subject: [PATCH 4/9] Bring changes from the official repo over to here --- pom.xml | 6 +++--- .../totalfreedommod/command/Command_saconfig.java | 1 + .../totalfreedommod/httpd/module/Module_players.java | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index bd9b4a82..c3e51255 100644 --- a/pom.xml +++ b/pom.xml @@ -184,9 +184,9 @@ 3.3 TotalFreedomMod.jar - 1.7 - 1.7 - 1.7 + 1.8 + 1.8 + 1.8 diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java index 688eedeb..7572be8b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java @@ -200,6 +200,7 @@ public class Command_saconfig extends FreedomCommand { admin.setName(player.getName()); admin.addIp(Ips.getIp(player)); + admin.getName().isEmpty(); } // Handle master builders diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java index e420343c..98ac0327 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java @@ -25,6 +25,7 @@ public class Module_players extends HTTPDModule final JSONObject responseObject = new JSONObject(); final JSONArray players = new JSONArray(); + final JSONArray onlineadmins = new JSONArray(); final JSONArray masterbuilders = new JSONArray(); final JSONArray superadmins = new JSONArray(); final JSONArray telnetadmins = new JSONArray(); @@ -35,6 +36,10 @@ public class Module_players extends HTTPDModule for (Player player : Bukkit.getOnlinePlayers()) { players.add(player.getName()); + if (plugin.al.isAdmin(player) && !plugin.al.isAdminImpostor(player)) + { + onlineadmins.add(player.getName()); + } } // Admins From 100e155fe003f42a032dcc86e05517003950c2a4 Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Fri, 1 Jun 2018 22:38:01 -0700 Subject: [PATCH 5/9] What --- .../totalfreedom/totalfreedommod/command/Command_saconfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java index 7572be8b..688eedeb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java @@ -200,7 +200,6 @@ public class Command_saconfig extends FreedomCommand { admin.setName(player.getName()); admin.addIp(Ips.getIp(player)); - admin.getName().isEmpty(); } // Handle master builders From 435898550b3bdd4cee8a4108b7533db1f8c25b39 Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Fri, 1 Jun 2018 23:13:52 -0700 Subject: [PATCH 6/9] Lemon at least make sure it compiles --- .../totalfreedommod/command/Command_list.java | 2 +- .../command/Command_oldadminmode.java | 26 ------------------- 2 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_oldadminmode.java diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java index eb1923e2..fd060efc 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java @@ -107,7 +107,7 @@ public class Command_list extends FreedomCommand } final Displayable display = plugin.rm.getDisplay(p); - if (!senderIsConsole && plugin.al.isAdmin(playerSender) && plugin.al.getAdmin(playerSender).getOldAdminMode()) + if (!senderIsConsole && plugin.al.isAdmin(playerSender) && plugin.al.getAdmin(playerSender).getOldTags()) { n.add(getOldPrefix(display) + p.getName()); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_oldadminmode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_oldadminmode.java deleted file mode 100644 index 933f9f6b..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_oldadminmode.java +++ /dev/null @@ -1,26 +0,0 @@ -package me.totalfreedom.totalfreedommod.command; - -import me.totalfreedom.totalfreedommod.admin.Admin; -import me.totalfreedom.totalfreedommod.rank.Rank; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) -@CommandParameters(description = "Toggle old admin formatting", usage = "/", aliases = "oam") -public class Command_oldadminmode extends FreedomCommand -{ - - @Override - public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) - { - - Admin admin = plugin.al.getAdmin(playerSender); - admin.setOldAdminMode(!admin.getOldAdminMode()); - plugin.al.save(); - plugin.al.updateTables(); - msg("Old admin mode has been " + (admin.getOldAdminMode() ? "enabled." : "disabled.")); - - return true; - } -} From 7026423e8eb6f0a45011cf4b918eed89eb45b375 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sat, 2 Jun 2018 01:18:28 -0700 Subject: [PATCH 7/9] TotalFreedomMod 5.2 God (#69) --- .gitignore | 1 + pom.xml | 104 +++++++++--------- .../totalfreedommod/TotalFreedomMod.java | 18 ++- .../command/Command_totalfreedommod.java | 2 +- 4 files changed, 65 insertions(+), 60 deletions(-) diff --git a/.gitignore b/.gitignore index 24d67e9b..55aa6361 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # TFM excludes /lib build.properties +git.properties # Netbeans excludes /nbproject/private diff --git a/pom.xml b/pom.xml index c3e51255..cc90811e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,14 @@ me.totalfreedom totalfreedom - 5.0 + 5.2 jar UTF-8 ${project.version} - Electrum - + God + ${maven.buildnumber} ${maven.build.timestamp} ${buildAuthor} ${buildHead} @@ -60,7 +60,7 @@ sk89q-snapshots - http://maven.sk89q.com/artifactory/repo + http://maven.sk89q.com/artifactory/repo/ @@ -159,9 +159,9 @@ net.dv8tion JDA - 3.5.1_339-withDependencies + JDA-3.6.0_354-withDependencies system - ${project.basedir}/lib/JDA-3.5.1_339-withDependencies.jar + ${project.basedir}/lib/JDA-3.6.0_354-withDependencies.jar @@ -192,6 +192,7 @@ + org.apache.maven.plugins maven-antrun-plugin 1.8 @@ -199,8 +200,11 @@ initialize - + + + + @@ -209,8 +213,10 @@ + + org.codehaus.mojo @@ -224,7 +230,7 @@ - ${basedir}/build.properties + ${basedir}/src/main/resources/build.properties @@ -254,26 +260,47 @@ - com.lukegb.mojo - gitdescribe-maven-plugin - 3.0 + pl.project13.maven + git-commit-id-plugin + 2.2.4 - git-describe - initialize + get-the-git-infos - gitdescribe + revision - - buildHead - - --tags - --always - HEAD - - + + + validate-the-git-infos + + validateRevision + + package + + ${project.basedir}/.git + git + yyyy-MM-dd HH:mm:ss + false + true + ${basedir}/src/main/resources/git.properties + properties + false + false + + git.build.time + git.commit.id + git.commit.id.abbrev + + + false + false + 7 + -dirty + * + + @@ -292,42 +319,13 @@ maven.buildnumber - ${basedir}/build.properties + ${basedir}/src/main/resources/build.properties {0,number,#} buildNumber - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3.1 - - target/generated-sources - - - - - - org.apache.maven.plugins - maven-shade-plugin - 1.4 - - - package - - shade - - - target/${project.name}.jar - false - - - - @@ -353,4 +351,4 @@ - \ No newline at end of file + diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index cf0b6375..d6781dfb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -283,18 +283,24 @@ public class TotalFreedomMod extends AeroPlugin try { final Properties props; + final Properties gitprops; try (InputStream in = plugin.getResource("build.properties")) { props = new Properties(); props.load(in); } + try (InputStream in = plugin.getResource("git.properties")) + { + gitprops = new Properties(); + gitprops.load(in); + } - author = props.getProperty("program.build.author", "unknown"); - codename = props.getProperty("program.build.codename", "unknown"); - version = props.getProperty("program.build.version", "unknown"); - number = props.getProperty("program.build.number", "1"); - date = props.getProperty("program.build.date", "unknown"); - head = props.getProperty("program.build.head", "unknown"); + author = props.getProperty("buildAuthor", "unknown"); + codename = props.getProperty("buildCodeName", "unknown"); + version = props.getProperty("buildVersion", pluginVersion); + number = props.getProperty("buildNumber", "1"); + date = gitprops.getProperty("git.build.time", "unknown"); + head = gitprops.getProperty("git.commit.id.abbrev", "unknown"); } catch (Exception ex) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java index d3c721af..384d46ce 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java @@ -52,7 +52,7 @@ public class Command_totalfreedommod extends FreedomCommand msg("Running on " + ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD); msg("Created by Madgeek1450 and Prozza.", ChatColor.GOLD); msg(String.format("Version " - + ChatColor.BLUE + "%s %s.%s " + ChatColor.GOLD + "(" + + ChatColor.BLUE + "%s - %s Build %s " + ChatColor.GOLD + "(" + ChatColor.BLUE + "%s" + ChatColor.GOLD + ")", build.codename, build.version, From c835d38b7cd5af47b97af2b6d08c89300ee125a1 Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Sat, 2 Jun 2018 13:08:35 -0700 Subject: [PATCH 8/9] attempting to make good codes at 3 in the morning isnt very bright --- .../java/me/totalfreedom/totalfreedommod/ChatManager.java | 7 ++++--- .../totalfreedommod/command/Command_myadmin.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java index 934ef049..3e8c71e3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java @@ -7,6 +7,8 @@ import me.totalfreedom.totalfreedommod.rank.Displayable; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FSync; import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg; + +import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.Sound; import org.bukkit.SoundCategory; import org.bukkit.ChatColor; @@ -137,10 +139,9 @@ public class ChatManager extends FreedomService Admin admin = plugin.al.getAdmin(player); if (!Strings.isNullOrEmpty(admin.getAcFormat())) { - String coloredTag = getColoredTag(admin, display); String format = admin.getAcFormat(); - String msg = format.replace("%name%", sender.getName()).replace("%tag%", coloredTag).replace("%message%", message); - player.sendMessage(msg); + String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", display.getColor().toString()).replace("%msg%", message); + player.sendMessage(FUtil.colorize(msg)); } else { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java index d62e68a8..7860fe68 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java @@ -186,7 +186,7 @@ public class Command_myadmin extends FreedomCommand plugin.al.save(); plugin.al.updateTables(); msg("Set admin chat format to \"" + format + "\".", ChatColor.GRAY); - String example = format.replace("%name%", "ExampleAdmin").replace("%rank%", "STA").replace("%msg%", "The quick brown fox jumps over the lazy dog."); + String example = format.replace("%name%", "ExampleAdmin").replace("%rank%", Rank.TELNET_ADMIN.getAbbr()).replace("%rankcolor%", Rank.TELNET_ADMIN.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog."); msg(ChatColor.GRAY + "Example: " + FUtil.colorize(example)); return true; } From b44d08eb5508ef4bff41f4de5d25b0451e16f74e Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Sat, 2 Jun 2018 13:45:05 -0700 Subject: [PATCH 9/9] *sigh* --- .../totalfreedommod/ChatManager.java | 26 +++++++++++++++---- .../command/Command_myadmin.java | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java index 3e8c71e3..e7f7d240 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java @@ -7,10 +7,7 @@ import me.totalfreedom.totalfreedommod.rank.Displayable; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FSync; import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg; - import me.totalfreedom.totalfreedommod.util.FUtil; -import org.bukkit.Sound; -import org.bukkit.SoundCategory; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -109,10 +106,28 @@ public class ChatManager extends FreedomService event.setFormat(format); } + public ChatColor getColor(Admin admin, Displayable display) + { + ChatColor color = display.getColor(); + if (admin.getOldTags()) + { + + if (color.equals(ChatColor.AQUA)) + { + color = ChatColor.GOLD; + } + else if (color.equals(ChatColor.GOLD)) + { + color = ChatColor.LIGHT_PURPLE; + } + } + return color; + } + public String getColoredTag(Admin admin, Displayable display) { ChatColor color = display.getColor(); - if(admin.getOldTags()) + if (admin.getOldTags()) { if (color.equals(ChatColor.AQUA)) @@ -140,7 +155,8 @@ public class ChatManager extends FreedomService if (!Strings.isNullOrEmpty(admin.getAcFormat())) { String format = admin.getAcFormat(); - String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", display.getColor().toString()).replace("%msg%", message); + ChatColor color = getColor(admin, display); + String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message); player.sendMessage(FUtil.colorize(msg)); } else diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java index 7860fe68..bbedc2d2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java @@ -203,7 +203,7 @@ public class Command_myadmin extends FreedomCommand target.setOldTags(!target.getOldTags()); plugin.al.save(); plugin.al.updateTables(); - msg(target.getOldTags() ? "Enabled" : "Disabled" + " old tags."); + msg((target.getOldTags() ? "Enabled" : "Disabled") + " old tags."); return true; }