From 774ca0cf0af823ffe402dda8620b220f0e13b770 Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Sun, 11 Nov 2012 13:11:06 -0500 Subject: [PATCH] Increment to v2.9 Add "Login Title Message Customization" --- src/config.yml | 10 ++++- .../TotalFreedomMod/TFM_Util.java | 39 ++++++++++--------- .../TotalFreedomMod/TotalFreedomMod.java | 13 +++++++ src/plugin.yml | 2 +- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/config.yml b/src/config.yml index 3045e83..36c9313 100644 --- a/src/config.yml +++ b/src/config.yml @@ -1,4 +1,4 @@ -# Total Freedom Mod v2.7 Configuration +# Total Freedom Mod v2.9 Configuration # by Madgeek1450 # Block placement prevention: @@ -61,9 +61,17 @@ auto_protect_radius: 25.0 # SuperAwesomeAdmins - Because normal superadmin just isn't awesome enough. These users can do even more awesomey admin shit. super_awesome_admins: + - console - markbyron - mark - madgeek1450 - madgeek - darthsalamon - darth + +# Login Title Message Customization - Format: '&b is ', where &b is a color code. +user_titles: + markbyron: the &downer&b. + madgeek1450: the &5chief-developer&b and &6master-ass-kicker&b. + darthsalamon: a &5developer&b! + miwojedk: a &4master-builder&b. diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java index 8e20017..5bc24ac 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java @@ -5,8 +5,6 @@ import java.net.InetSocketAddress; import java.net.URI; import java.util.*; import java.util.jar.JarFile; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipEntry; @@ -686,24 +684,29 @@ public class TFM_Util return "an " + ChatColor.YELLOW + ChatColor.UNDERLINE + "impostor" + ChatColor.RESET + ChatColor.AQUA + "!"; } - if (sender.getName().equalsIgnoreCase("markbyron")) - { - return "the " + ChatColor.LIGHT_PURPLE + "owner" + ChatColor.AQUA + "."; - } +// if (sender.getName().equalsIgnoreCase("markbyron")) +// { +// return "the " + ChatColor.LIGHT_PURPLE + "owner" + ChatColor.AQUA + "."; +// } +// +// if (sender.getName().equalsIgnoreCase("madgeek1450")) +// { +// return "the " + ChatColor.DARK_PURPLE + "chief-developer" + ChatColor.AQUA + " and " + ChatColor.GOLD + "master-ass-kicker" + ChatColor.AQUA + "."; +// } +// +// if (sender.getName().equalsIgnoreCase("darthsalamon")) +// { +// return "a " + ChatColor.DARK_PURPLE + "developer" + ChatColor.AQUA + "!"; +// } +// +// if (sender.getName().equalsIgnoreCase("miwojedk")) +// { +// return "a " + ChatColor.DARK_RED + "master-builder" + ChatColor.AQUA + "!"; +// } - if (sender.getName().equalsIgnoreCase("madgeek1450")) + if (TotalFreedomMod.customUserTitles.containsKey(sender.getName().toLowerCase())) { - return "the " + ChatColor.DARK_PURPLE + "chief-developer" + ChatColor.AQUA + " and " + ChatColor.GOLD + "master-ass-kicker" + ChatColor.AQUA + "."; - } - - if (sender.getName().equalsIgnoreCase("darthsalamon")) - { - return "a " + ChatColor.DARK_PURPLE + "developer" + ChatColor.AQUA + "!"; - } - - if (sender.getName().equalsIgnoreCase("miwojedk")) - { - return "a " + ChatColor.DARK_RED + "master-builder" + ChatColor.AQUA + "!"; + return ChatColor.translateAlternateColorCodes('&', TotalFreedomMod.customUserTitles.get(sender.getName().toLowerCase())); } if (TFM_Util.isUserSuperadmin(sender)) diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java index 8cd4721..c19d7b5 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java @@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod; import java.io.File; import java.io.InputStream; import java.util.*; +import java.util.Map.Entry; import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command; import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener; import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener; @@ -198,6 +199,7 @@ public class TotalFreedomMod extends JavaPlugin public static boolean protectedAreasEnabled = true; public static boolean autoProtectSpawnpoints = true; public static double autoProtectRadius = 25.0D; + public static Map customUserTitles = new HashMap(); public void loadMainConfig() { @@ -239,6 +241,17 @@ public class TotalFreedomMod extends JavaPlugin protectedAreasEnabled = config.getBoolean("protected_areas_enabled", protectedAreasEnabled); autoProtectSpawnpoints = config.getBoolean("auto_protect_spawnpoints", autoProtectSpawnpoints); autoProtectRadius = config.getDouble("auto_protect_radius", autoProtectRadius); + + if (config.isConfigurationSection("user_titles")) + { + Map raw_titles = config.getConfigurationSection("user_titles").getValues(false); + Iterator> it = raw_titles.entrySet().iterator(); + while (it.hasNext()) + { + Entry pair = it.next(); + customUserTitles.put(pair.getKey(), (String) pair.getValue()); + } + } } catch (Exception ex) { diff --git a/src/plugin.yml b/src/plugin.yml index 5adfcc4..4233db8 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TotalFreedomMod main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod -version: 2.8 +version: 2.9 description: Plugin for the Total Freedom server. authors: [StevenLawson / Madgeek1450, JeromSar / DarthSalamon] commands: