Added removeNick, removeSuffix, and removePrefix to remove each respective feature

This commit is contained in:
cerevisiae 2010-12-10 03:15:39 -06:00
parent 8d8553c568
commit 4d730dbd00
4 changed files with 175 additions and 12 deletions

2
TODO
View File

@ -1,7 +1,7 @@
Vminecraft b8 Todo:
+ Finish work on the flat file system
+ Antigriefs <Nos> Working on this
+ Time manipulation <Cere> Working on this
? 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

View File

@ -465,11 +465,11 @@ public class vMinecraftChat {
//Output: boolean: If this feature is enabled
//Use: /me but with our custom colors applied
//=====================================================================
public static boolean emote(Player player, String message)
{
gmsg(player, "* " + getName(player) + " " + Colors.White + message);
return true;
}
public static boolean emote(Player player, String message)
{
gmsg(player, "* " + getName(player) + " " + Colors.White + message);
return true;
}
//=====================================================================
@ -501,7 +501,7 @@ public class vMinecraftChat {
{
//If the char is a ^ or <EFBFBD>
if(taste || msg.charAt(x) == '^'
|| msg.charAt(x) == Colors.White.charAt(0))
|| msg.charAt(x) == Colors.Red.charAt(0))
{
if(x != msg.length() - 1)
{

View File

@ -38,8 +38,11 @@ public class vMinecraftCommands{
//Administrative
cl.register("/prefix", "prefix");
cl.register("/rprefix", "removePrefix");
cl.register("/nick", "nickName");
cl.register("/rnick", "removeNick");
cl.register("/suffix", "suffix");
cl.register("/rsuffix", "removeSuffix");
cl.register("/vminecraft", "vminecrafthelp");
cl.register("/reload", "reload");
cl.register("/whois", "whois", "/whois [user]");
@ -251,6 +254,50 @@ public class vMinecraftCommands{
return EXIT_SUCCESS;
}
//=====================================================================
//Function: removeTag (/rprefix)
//Input: Player player: The player using the command
// String[] args: Ignored
//Output: int: Exit Code
//Use: Removes your prefix
//=====================================================================
public static int removeTag(Player player, String[] args){
//if the player can suffix others
if(player.canUseCommand("/prefixother")){
if(args.length < 1){
vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /rprefix [Player]");
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).setTag("");
return EXIT_SUCCESS;
}
//Check if the player can set their own prefix.
if(!player.canUseCommand("/prefix")){
return EXIT_FAIL;
}
if(args.length < 1){
vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /rprefix");
return EXIT_SUCCESS;
}
vMinecraftUsers.getProfile(player).setTag("");
return EXIT_SUCCESS;
}
//=====================================================================
//Function: nickName (/nick)
//Input: Player player: The player using the command
@ -272,7 +319,7 @@ public class vMinecraftCommands{
if(vMinecraftChat.msgLength(args[1]) > 85)
{
vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "The suffix you entered was too long.");
+ "The nick you entered was too long.");
return EXIT_SUCCESS;
}
@ -298,7 +345,7 @@ public class vMinecraftCommands{
if(vMinecraftChat.msgLength(args[1]) > 85)
{
vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "The suffix you entered was too long.");
+ "The nick you entered was too long.");
return EXIT_SUCCESS;
}
@ -312,10 +359,54 @@ public class vMinecraftCommands{
return EXIT_SUCCESS;
}
//=====================================================================
//Function: removeNick (/rnick)
//Input: Player player: The player using the command
// String[] args: Ignored
//Output: int: Exit Code
//Use: Removes your nick
//=====================================================================
public static int removeNick(Player player, String[] args){
//if the player can nick others
if(player.canUseCommand("/nickother")){
if(args.length < 1){
vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /rnick [Player]");
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("");
return EXIT_SUCCESS;
}
//Check if the player can set their own nick.
if(!player.canUseCommand("/nick")){
return EXIT_FAIL;
}
if(args.length < 1){
vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /rnick");
return EXIT_SUCCESS;
}
vMinecraftUsers.getProfile(player).setNick("");
return EXIT_SUCCESS;
}
//=====================================================================
//Function: suffix (/suffix)
//Input: Player player: The player using the command
// String[] args: The color and the prefix
// String[] args: The color and the suffix
//Output: int: Exit Code
//Use: Changes your suffix
//=====================================================================
@ -372,6 +463,50 @@ public class vMinecraftCommands{
return EXIT_SUCCESS;
}
//=====================================================================
//Function: removeSuffix (/rsuffix)
//Input: Player player: The player using the command
// String[] args: Ignored
//Output: int: Exit Code
//Use: Removes your suffix
//=====================================================================
public static int removeSuffix(Player player, String[] args){
//if the player can suffix others
if(player.canUseCommand("/suffixother")){
if(args.length < 1){
vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /rsuffix [Player]");
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("");
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 /rsuffix");
return EXIT_SUCCESS;
}
vMinecraftUsers.getProfile(player).setSuffix("");
return EXIT_SUCCESS;
}
//=====================================================================
//Function: colors (/colors)
//Input: Player player: The player using the command
@ -379,7 +514,10 @@ public class vMinecraftCommands{
//Use: Displays a list of all colors and color codes
//=====================================================================
public static int colors(Player player, String[] args){
player.sendMessage(Colors.Rose + "You use these color codes like in quake or MW2, ^4 would make text red, ^a would make it light green.");
player.sendMessage(Colors.Rose + "You use these color codes like in quake or MW2.");
player.sendMessage(Colors.Rose + "^4 would make text " + Colors.Red
+ "red" + Colors.Rose + ", ^a would make it " + Colors.LightGreen
+ "light green" + Colors.Rose + ".");
vMinecraftChat.sendMessage(player, player,
Colors.Black + "0"
+ Colors.Navy + "1"
@ -537,6 +675,13 @@ public class vMinecraftCommands{
return EXIT_SUCCESS;
}
if(ignore.hasControlOver(player))
{
vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "You can't ignore someone a higher rank than you.");
return EXIT_SUCCESS;
}
//Don't let the player ignore themselves
if(!ignore.getName().equalsIgnoreCase(player.getName()))
{

View File

@ -164,7 +164,9 @@ class PlayerList
lastMessage,
nickName,
tag,
suffix;
suffix,
defaultColor;
private ArrayList<String> ignoreList;
private commandList aliasList;
@ -429,6 +431,22 @@ class PlayerList
//=====================================================================
public String getSuffix() { return suffix; }
//=====================================================================
//Function: setColor
//Input: String newTag: The color to set for the player
//Output: None
//Use: Sets a player color
//=====================================================================
public void setColor(String newColor){ defaultColor = newColor; }
//=====================================================================
//Function: getColor
//Input: None
//Output: String: The player color
//Use: Gets a player color
//=====================================================================
public String getColor() { return defaultColor; }
//=====================================================================
//Function: setMessage
//Input: String newName: The name of the player they last messaged