diff --git a/TODO b/TODO index a5c68005b..7ca19068a 100644 --- a/TODO +++ b/TODO @@ -2,14 +2,13 @@ Vminecraft b8 Todo: + ^r for rainbow color code + Finish work on the flat file system + Antigriefs Working on this - + Allow players to nickname themselves or others + Time manipulation Working on this * Have time changes not be instant but move the sky faster to get to the time entered * Loop through specific times of the day and then rewind ex: Sunrise to sunset, mid-morning to noon + Aliasing Commands (Global Aliases and Personal Aliases) - + Different types of /slay + ? Different types of /slay * /slay fire to burn them to death * /slay drown to drown them * /slay boil to burn them with lava @@ -43,5 +42,7 @@ DONE + Recode Messaging * Reply Feature * Personal Muting + + Allow players to nickname themselves or others + + Allow players to set suffixes Notes: Let's try to to finish as much of this list as possible tomorrow and push for a b8 release soon :P diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 38b323854..fb35751ca 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -174,6 +174,7 @@ public class vMinecraftCommands{ //===================================================================== //Function: prefix (/prefix) //Input: Player player: The player using the command + // String[] args: The color and the prefix //Output: int: Exit Code //Use: Changes your name color and prefix //===================================================================== @@ -197,6 +198,127 @@ public class vMinecraftCommands{ return EXIT_SUCCESS; } + //===================================================================== + //Function: nickName (/nick) + //Input: Player player: The player using the command + // String[] args: The color and the prefix + //Output: int: Exit Code + //Use: Changes your name color and prefix + //===================================================================== + public static int nickName(Player player, String[] args){ + + //if the player can nickname others + if(player.canUseCommand("/nickother")){ + if(args.length < 2){ + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "Usage is /prefix [Player] [Name]"); + return EXIT_SUCCESS; + } + + //Check if the nickname is too long + if(args[1].length() > 20) + { + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "The suffix you entered was too long."); + return EXIT_SUCCESS; + } + + //Check if the player exists + Player other = etc.getServer().matchPlayer(args[0]); + if(other == null) + { + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "The player you specified could not be found"); + return EXIT_SUCCESS; + } + vMinecraftUsers.getProfile(other).setNick(args[1]); + + return EXIT_SUCCESS; + } + + //Make sure they can nickname themselves + if(!player.canUseCommand("/nick")){ + return EXIT_FAIL; + } + + //Check if the nickname is too long + if(args[0].length() > 20) + { + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "The suffix you entered was too long."); + return EXIT_SUCCESS; + } + + if(args.length < 1){ + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "Usage is /prefix [Name]"); + return EXIT_SUCCESS; + } + vMinecraftUsers.getProfile(player).setNick(args[0]); + + return EXIT_SUCCESS; + } + + //===================================================================== + //Function: suffix (/suffix) + //Input: Player player: The player using the command + // String[] args: The color and the prefix + //Output: int: Exit Code + //Use: Changes your name color and prefix + //===================================================================== + public static int suffix(Player player, String[] args){ + + //if the player can suffix others + if(player.canUseCommand("/suffixother")){ + if(args.length < 2){ + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "Usage is /suffix [Player] [Name]"); + return EXIT_SUCCESS; + } + + //Check if the suffix is too long + if(args[1].length() > 10) + { + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "The suffix you entered was too long."); + return EXIT_SUCCESS; + } + + //Check if the player exists + Player other = etc.getServer().matchPlayer(args[0]); + if(other == null) + { + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "The player you specified could not be found"); + return EXIT_SUCCESS; + } + vMinecraftUsers.getProfile(other).setSuffix(args[1]); + + return EXIT_SUCCESS; + } + + //Check if the player can set their own suffix. + if(!player.canUseCommand("/suffix")){ + return EXIT_FAIL; + } + if(args.length < 1){ + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "Usage is /suffix [Suffix]"); + return EXIT_SUCCESS; + } + + //Check if the suffix is too long + if(args[0].length() > 10) + { + vMinecraftChat.sendMessage(player, player, Colors.Rose + + "The suffix you entered was too long."); + return EXIT_SUCCESS; + } + vMinecraftUsers.getProfile(player).setSuffix(args[0]); + + return EXIT_SUCCESS; + } + //===================================================================== //Function: colors (/colors) //Input: Player player: The player using the command