diff --git a/build.gradle b/build.gradle index 3135fe4..ab08b99 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { -version = '1.3.0' +version = '1.3.1' group = 'dev.zontreck.otemod' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'otemod' @@ -156,7 +156,7 @@ jar { attributes([ "Specification-Title" : "otemod", "Specification-Vendor" : "Zontreck", - "Specification-Version" : "1.3.0", // We are version 1 of ourselves + "Specification-Version" : "1.3.1", // We are version 1 of ourselves "Implementation-Title" : project.name, "Implementation-Version" : project.jar.archiveVersion, "Implementation-Vendor" : "Zontreck", diff --git a/src/main/java/dev/zontreck/otemod/chat/ChatColor.java b/src/main/java/dev/zontreck/otemod/chat/ChatColor.java index 4795d0b..b9ea4e2 100644 --- a/src/main/java/dev/zontreck/otemod/chat/ChatColor.java +++ b/src/main/java/dev/zontreck/otemod/chat/ChatColor.java @@ -62,13 +62,93 @@ public class ChatColor { return RESET+WHITE; } - public static String from(String nick){ - switch(nick.toLowerCase()){ - case "black": + public static String from(ColorOptions nick){ + switch(nick){ + case Black: { return BLACK; } - case "crazy": + case Dark_Blue: + { + return DARK_BLUE; + } + case Dark_Green: + { + return DARK_GREEN; + } + case Dark_Aqua: + { + return DARK_AQUA; + } + case Dark_Red: + { + return DARK_RED; + } + case Dark_Purple: + { + return DARK_PURPLE; + } + case Gold: + { + return GOLD; + } + case Gray: + { + return GRAY; + } + case Dark_Gray: + { + return DARK_GRAY; + } + case Blue: + { + return BLUE; + } + case Green: + { + return GREEN; + } + case Aqua: + { + return AQUA; + } + case Red: + { + return RED; + } + case Light_Purple: + { + return LIGHT_PURPLE; + } + case Yellow: + { + return YELLOW; + } + case White: + { + return WHITE; + } + case MinecoinGold: + { + return MINECOIN_GOLD; + } + case Underline: + { + return UNDERLINE; + } + case Bold: + { + return BOLD; + } + case Italic: + { + return ITALIC; + } + case Strikethrough: + { + return STRIKETHROUGH; + } + case Crazy: { return CRAZY; } diff --git a/src/main/java/dev/zontreck/otemod/commands/profilecmds/ChatColorCommand.java b/src/main/java/dev/zontreck/otemod/commands/profilecmds/ChatColorCommand.java index 1dbd39d..15e9cb3 100644 --- a/src/main/java/dev/zontreck/otemod/commands/profilecmds/ChatColorCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/profilecmds/ChatColorCommand.java @@ -31,9 +31,8 @@ public class ChatColorCommand { public static int setchatcolor(CommandSourceStack source, ColorOptions string) { // Chat Color has a registry of colors that we can use to map back to our desired color - String actual_color = string.toString(); // To code - String colorcoded = ChatColor.from(actual_color); + String colorcoded = ChatColor.from(string); // Get profile if(source.getPlayer()==null){ @@ -44,7 +43,7 @@ public class ChatColorCommand { p.chat_color = colorcoded; p.commit(); OTEMod.PROFILES.put(source.getPlayer().getStringUUID(), p); - + source.sendSuccess(Component.literal(ChatColor.DARK_GRAY+ "["+ChatColor.DARK_GREEN+ "OTEMOD" + ChatColor.DARK_GRAY + "] "+ChatColor.DARK_PURPLE + "Your chat color has been updated"), false); return 0; diff --git a/src/main/java/dev/zontreck/otemod/commands/profilecmds/NameColorCommand.java b/src/main/java/dev/zontreck/otemod/commands/profilecmds/NameColorCommand.java index b3f6f1e..1107d49 100644 --- a/src/main/java/dev/zontreck/otemod/commands/profilecmds/NameColorCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/profilecmds/NameColorCommand.java @@ -31,9 +31,8 @@ public class NameColorCommand { public static int setchatcolor(CommandSourceStack source, ColorOptions string) { // Chat Color has a registry of colors that we can use to map back to our desired color - String actual_color = string.toString(); // To code - String colorcoded = ChatColor.from(actual_color); + String colorcoded = ChatColor.from(string); // Get profile if(source.getPlayer()==null){ diff --git a/src/main/java/dev/zontreck/otemod/commands/profilecmds/PrefixColorCommand.java b/src/main/java/dev/zontreck/otemod/commands/profilecmds/PrefixColorCommand.java index b846aa6..36bd5a9 100644 --- a/src/main/java/dev/zontreck/otemod/commands/profilecmds/PrefixColorCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/profilecmds/PrefixColorCommand.java @@ -31,9 +31,8 @@ public class PrefixColorCommand { public static int setchatcolor(CommandSourceStack source, ColorOptions string) { // Chat Color has a registry of colors that we can use to map back to our desired color - String actual_color = string.toString(); // To code - String colorcoded = ChatColor.from(actual_color); + String colorcoded = ChatColor.from(string); // Get profile if(source.getPlayer()==null){ diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index f1032ed..ed77691 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="otemod" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="1.3.0" #mandatory +version="1.3.1" #mandatory # A display name for the mod displayName="OTEMod Resources" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/