mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Personal muting added.
This commit is contained in:
parent
48fc69c220
commit
861ef59334
16
TODO
16
TODO
@ -1,20 +1,14 @@
|
||||
Vminecraft b8 Todo:
|
||||
+ ^r for rainbow color code
|
||||
+ Finish work on the flat file system
|
||||
+ Antigriefs <Nos> Working on this, waiting for hMod to fix player health
|
||||
+ Antigriefs <Nos> Working on this
|
||||
+ Allow players to nickname themselves or others
|
||||
+ vminecraft Help
|
||||
* Specialized help message for vminecraft
|
||||
? /vhelp?
|
||||
+ 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>
|
||||
+ Recode Messaging
|
||||
* Reply Feature
|
||||
* Personal Muting
|
||||
+ Different types of /slay
|
||||
* /slay fire to burn them to death
|
||||
* /slay drown to drown them
|
||||
@ -26,7 +20,7 @@ Vminecraft b8 Todo:
|
||||
<Nos> We should definitely add suffixes to /modify at least
|
||||
|
||||
DONE
|
||||
+ Fixed death messages and ezModo
|
||||
+ Fixed death messages and ezModo
|
||||
+ Quick recode of /me to use the new getName function
|
||||
+ /a to toggle admin chat
|
||||
+ Code was organized
|
||||
@ -43,5 +37,11 @@ DONE
|
||||
* Now we can have color on multiple lines without
|
||||
crashing the client
|
||||
* Also does not cut words in half
|
||||
+ vminecraft Help
|
||||
* Specialized help message for vminecraft
|
||||
? /vhelp?
|
||||
+ Recode Messaging
|
||||
* Reply Feature
|
||||
* Personal Muting
|
||||
|
||||
Notes: Let's try to to finish as much of this list as possible tomorrow and push for a b8 release soon :P
|
||||
|
@ -20,7 +20,15 @@ public class vMinecraftChat {
|
||||
public static void gmsg(Player sender, String msg){
|
||||
for (Player receiver : etc.getServer().getPlayerList()) {
|
||||
if (receiver != null) {
|
||||
sendMessage(sender, receiver, msg);
|
||||
if(vMinecraftUsers.players.findProfile(receiver) == null)
|
||||
return;
|
||||
//Check if the person has the sender ignored
|
||||
if(!vMinecraftUsers.players.findProfile(receiver).isIgnored(sender))
|
||||
{
|
||||
String[] message = applyColors(wordWrap(msg));
|
||||
for(String out : message)
|
||||
receiver.sendMessage(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,9 +40,18 @@ public class vMinecraftChat {
|
||||
//Use: Outputs a message to everybody
|
||||
//=====================================================================
|
||||
public static void sendMessage(Player sender, Player receiver, String msg){
|
||||
String[] message = applyColors(wordWrap(msg));
|
||||
for(String out : message)
|
||||
receiver.sendMessage(out + " ");
|
||||
//Check if the receiver has the sender ignored
|
||||
if(vMinecraftUsers.players.findProfile(receiver) == null)
|
||||
return;
|
||||
if(!vMinecraftUsers.players.findProfile(receiver).isIgnored(sender))
|
||||
{
|
||||
String[] message = applyColors(wordWrap(msg));
|
||||
for(String out : message)
|
||||
receiver.sendMessage(out);
|
||||
//Tell them if they are
|
||||
} else
|
||||
sendMessage(sender, sender, Colors.Rose + receiver.getName() + " has you " +
|
||||
"on their ignore list.");
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
|
@ -37,7 +37,6 @@ public class vMinecraftCommands{
|
||||
//String(Optional): The help menu description
|
||||
cl.register("/tp", "teleport");
|
||||
cl.register("/vminecraft", "vminecrafthelp");
|
||||
cl.registerAlias("/vhelp", "/vminecraft");
|
||||
cl.register("/colors", "colors");
|
||||
cl.register("/masstp", "masstp", "Teleports those with lower permissions to you");
|
||||
cl.register("/reload", "reload");
|
||||
@ -56,6 +55,8 @@ public class vMinecraftCommands{
|
||||
cl.register("/me", "me");
|
||||
cl.register("/msg", "message", "Send a message to a player /msg [Player] [Message]");
|
||||
cl.register("/reply", "reply", "Reply to a player /reply [Message], Alias: /r");
|
||||
cl.register("/ignore", "addIgnored", "Adds a user to your ignore list");
|
||||
cl.register("/unignore", "removeIgnored", "Removes a user from your ignore list");
|
||||
|
||||
//registerAlias
|
||||
//String: The command that this will be called by
|
||||
@ -68,6 +69,7 @@ public class vMinecraftCommands{
|
||||
// The %0 will be replaced with wood for this instance
|
||||
// and Player will be given 100 wood.
|
||||
cl.registerAlias("/playerlist", "/who");
|
||||
cl.registerAlias("/vhelp", "/vminecraft");
|
||||
cl.registerAlias("/r", "/reply");
|
||||
cl.registerAlias("/w", "/msg");
|
||||
cl.registerAlias("/wrists", "/suicide");
|
||||
@ -127,7 +129,22 @@ public class vMinecraftCommands{
|
||||
//Use: Displays a list of all colors and color codes
|
||||
//=====================================================================
|
||||
public static int colors(Player player, String[] args){
|
||||
vMinecraftChat.sendMessage(player, player, Colors.Black + "0" + Colors.Navy + "1" + Colors.Green+ "2" + Colors.Blue + "3" + Colors.Red + "4" + Colors.Purple + "5" + Colors.Gold + "6" + Colors.LightGray + "7" + Colors.Gray + "8" + Colors.DarkPurple + "9" + Colors.LightGreen + "a" + Colors.LightBlue + "b" + Colors.Rose + "c" + Colors.LightPurple + "d" + Colors.White + "f");
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Black + "0"
|
||||
+ Colors.Navy + "1"
|
||||
+ Colors.Green + "2"
|
||||
+ Colors.Blue + "3"
|
||||
+ Colors.Red + "4"
|
||||
+ Colors.Purple + "5"
|
||||
+ Colors.Gold + "6"
|
||||
+ Colors.LightGray + "7"
|
||||
+ Colors.Gray + "8"
|
||||
+ Colors.DarkPurple + "9"
|
||||
+ Colors.LightGreen + "a"
|
||||
+ Colors.LightBlue + "b"
|
||||
+ Colors.Rose + "c"
|
||||
+ Colors.LightPurple + "d"
|
||||
+ Colors.White + "f");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@ -224,8 +241,80 @@ public class vMinecraftCommands{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
//Function: addIgnored (/ignore)
|
||||
//Input: Player player: The player using the command
|
||||
// String[] args: The name of the player to ignore
|
||||
//Output: int: Exit Code
|
||||
//Use: Adds a player to the ignore list
|
||||
//=====================================================================
|
||||
public static int addIgnored(Player player, String[] args)
|
||||
{
|
||||
//Make sure the player gave you a user to ignore
|
||||
if(args.length > 0)
|
||||
{
|
||||
//Find the player and make sure they exist
|
||||
Player ignore = etc.getServer().matchPlayer(args[0]);
|
||||
if(ignore != null)
|
||||
{
|
||||
//Don't let the player ignore themselves
|
||||
if(!ignore.getName().equalsIgnoreCase(player.getName()))
|
||||
{
|
||||
//Attempt to ignore the player and report accordingly
|
||||
if(vMinecraftUsers.players.findProfile(player).addIgnore(ignore))
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + ignore.getName()+ " has been successfuly " +
|
||||
"ignored.");
|
||||
else
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + "You are already ignoring " + ignore.getName());
|
||||
} else
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + "You cannot ignore yourself");
|
||||
}
|
||||
else
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + "The person you tried to ignore is not logged in.");
|
||||
|
||||
}
|
||||
else
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + "Usage: /ignore [Player]");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
//Function: removeIgnored (/unignore)
|
||||
//Input: Player player: The player using the command
|
||||
// String[] args: The name of the player to stop ignoring
|
||||
//Output: int: Exit Code
|
||||
//Use: Removes a player from the ignore list
|
||||
//=====================================================================
|
||||
public static int removeIgnored(Player player, String[] args)
|
||||
{
|
||||
//Make sure the player gave you a user to ignore
|
||||
if(args.length > 0)
|
||||
{
|
||||
//Find the player and make sure they exist
|
||||
Player ignore = etc.getServer().matchPlayer(args[0]);
|
||||
if(ignore != null)
|
||||
{
|
||||
//Attempt to ignore the player and report accordingly
|
||||
if(vMinecraftUsers.players.findProfile(player).removeIgnore(ignore))
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + ignore.getName()+ " has been successfuly " +
|
||||
"unignored.");
|
||||
else
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + "You are not currently ignoring " + ignore.getName());
|
||||
}
|
||||
else
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + "The person you tried to unignore is not logged in.");
|
||||
}
|
||||
else
|
||||
vMinecraftChat.sendMessage(player, player,
|
||||
Colors.Rose + "Usage: /unignore [Player]");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ class PlayerList
|
||||
nickName,
|
||||
tag,
|
||||
suffix;
|
||||
private ArrayList<Player> ignoreList;
|
||||
private ArrayList<String> ignoreList;
|
||||
private commandList aliasList;
|
||||
|
||||
static final int EXIT_FAIL = 0,
|
||||
@ -170,7 +170,7 @@ class PlayerList
|
||||
nickName = new String();
|
||||
tag = new String();
|
||||
suffix = new String();
|
||||
ignoreList = new ArrayList<Player>();
|
||||
ignoreList = new ArrayList<String>();
|
||||
aliasList = new commandList();
|
||||
String location = "vminecraftusers.txt";
|
||||
|
||||
@ -188,20 +188,21 @@ class PlayerList
|
||||
if (split.length > 0 && split[0].equalsIgnoreCase(player.getName())) {
|
||||
|
||||
//Get the tag from the 1st split
|
||||
nickName = (split[1].split(",").toString());
|
||||
if (split.length >= 2)
|
||||
nickName = split[1];
|
||||
|
||||
//Get the tag from the 2nd split
|
||||
suffix = split[2];
|
||||
if (split.length >= 3)
|
||||
suffix = split[2];
|
||||
|
||||
//Get the tag from the 3rd split
|
||||
if (split.length >= 4) {
|
||||
if (split.length >= 4)
|
||||
tag = (split[3]);
|
||||
}
|
||||
|
||||
//Add all the ignored people to the player's ignore list
|
||||
if (split.length >= 5) {
|
||||
for(String name : split[4].split(","))
|
||||
ignoreList.add(etc.getServer().getPlayer(name));
|
||||
ignoreList.add(name);
|
||||
}
|
||||
|
||||
//Get the alias list, from the 5th split
|
||||
@ -226,6 +227,7 @@ class PlayerList
|
||||
log.log(Level.SEVERE, "Exception while reading "
|
||||
+ location + " (Are you sure you formatted it correctly?)", e);
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
@ -249,7 +251,11 @@ class PlayerList
|
||||
if (!split[0].equalsIgnoreCase(playerName)) {
|
||||
continue;
|
||||
}
|
||||
bw.write(playerName + ":" + nickName + ":" + suffix + ":" + tag + ":" + ignoreList + ":" + aliasList);
|
||||
String output =playerName + ":" + nickName + ":" + suffix + ":" + tag + ":";
|
||||
for(String player : ignoreList)
|
||||
output += player + ",";
|
||||
output += ":";
|
||||
bw.write(output);
|
||||
}
|
||||
scanner.close();
|
||||
} catch (Exception e) {
|
||||
@ -275,30 +281,44 @@ class PlayerList
|
||||
//Output: boolean: If they're ignored
|
||||
//Use: Finds if the specified player is in the ignore list
|
||||
//=====================================================================
|
||||
public boolean isIgnored(Player player){return ignoreList.contains(player);}
|
||||
public boolean isIgnored(Player player){
|
||||
log.log(Level.INFO, String.valueOf(ignoreList.contains(player.getName())));
|
||||
for(String pl : ignoreList)
|
||||
log.log(Level.INFO, pl);
|
||||
return ignoreList.contains(player.getName());}
|
||||
|
||||
//=====================================================================
|
||||
//Function: addIgnore
|
||||
//Input: Player name: The player to ignore
|
||||
//Output: None
|
||||
//Output: boolean: If the player was successfully ignored
|
||||
//Use: Ignores a player.
|
||||
//=====================================================================
|
||||
public void addIgnore(Player name)
|
||||
public boolean addIgnore(Player name)
|
||||
{
|
||||
if(!ignoreList.contains(name))
|
||||
ignoreList.add(name);
|
||||
{
|
||||
ignoreList.add(name.getName());
|
||||
save();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
//Function: removeIgnore
|
||||
//Input: Player name: The player to ignore
|
||||
//Output: None
|
||||
//Use: Ignores a player.
|
||||
//Input: Player name: The player to unignore
|
||||
//Output: boolean: If the player was successfully unignored
|
||||
//Use: Stops ignoring a player.
|
||||
//=====================================================================
|
||||
public void removeIgnore(Player name)
|
||||
public boolean removeIgnore(Player name)
|
||||
{
|
||||
if(ignoreList.contains(name))
|
||||
ignoreList.remove(name);
|
||||
if(ignoreList.contains(name.getName()))
|
||||
{
|
||||
ignoreList.remove(name.getName());
|
||||
save();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
@ -311,6 +331,7 @@ class PlayerList
|
||||
public void addAlias(String name, String callCommand)
|
||||
{
|
||||
aliasList.registerAlias(name, callCommand);
|
||||
save();
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user