Added a nickname and suffix feature.

This commit is contained in:
cerevisiae 2010-12-09 21:09:33 -06:00
parent 56c0805fca
commit f034a9e477
2 changed files with 125 additions and 2 deletions

5
TODO
View File

@ -2,14 +2,13 @@ Vminecraft b8 Todo:
+ ^r for rainbow color code
+ Finish work on the flat file system
+ Antigriefs <Nos> Working on this
+ Allow players to nickname themselves or others
+ Time manipulation <Cere> 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) <Cere>
+ 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

View File

@ -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