mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Merge branch 'master' of github.com:nossr50/vminecraft-plugin
This commit is contained in:
commit
f719efd2ae
@ -19,17 +19,18 @@ public class vMinecraftChat {
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static void gmsg(Player sender, String msg){
|
public static void gmsg(Player sender, String msg){
|
||||||
for (Player receiver : etc.getServer().getPlayerList()) {
|
for (Player receiver : etc.getServer().getPlayerList()) {
|
||||||
if (receiver != null) {
|
|
||||||
if(vMinecraftUsers.players.findProfile(receiver) == null)
|
if (receiver == null) {return;}
|
||||||
return;
|
|
||||||
//Check if the person has the sender ignored
|
if(vMinecraftUsers.getProfile(receiver) == null)
|
||||||
if(!vMinecraftUsers.players.findProfile(receiver).isIgnored(sender))
|
return;
|
||||||
{
|
//Check if the person has the sender ignored
|
||||||
String[] message = applyColors(wordWrap(msg));
|
if(!vMinecraftUsers.getProfile(receiver).isIgnored(sender))
|
||||||
for(String out : message)
|
{
|
||||||
receiver.sendMessage(out);
|
String[] message = applyColors(wordWrap(msg));
|
||||||
}
|
for(String out : message)
|
||||||
}
|
receiver.sendMessage(out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,17 +42,17 @@ public class vMinecraftChat {
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static void sendMessage(Player sender, Player receiver, String msg){
|
public static void sendMessage(Player sender, Player receiver, String msg){
|
||||||
//Check if the receiver has the sender ignored
|
//Check if the receiver has the sender ignored
|
||||||
if(vMinecraftUsers.players.findProfile(receiver) == null)
|
if(vMinecraftUsers.getProfile(receiver) == null)
|
||||||
return;
|
return;
|
||||||
if(!vMinecraftUsers.players.findProfile(receiver).isIgnored(sender))
|
if(!vMinecraftUsers.getProfile(receiver).isIgnored(sender))
|
||||||
{
|
{
|
||||||
String[] message = applyColors(wordWrap(msg));
|
String[] message = applyColors(wordWrap(msg));
|
||||||
for(String out : message)
|
for(String out : message)
|
||||||
receiver.sendMessage(out);
|
receiver.sendMessage(out);
|
||||||
//Tell them if they are
|
//Tell them if they are
|
||||||
} else
|
} else
|
||||||
sendMessage(sender, sender, Colors.Rose + receiver.getName() + " has you " +
|
sendMessage(sender, sender, Colors.Rose + receiver.getName()
|
||||||
"on their ignore list.");
|
+ " has you on their ignore list.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -211,18 +212,24 @@ public class vMinecraftChat {
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static String getName(Player player){
|
public static String getName(Player player){
|
||||||
|
|
||||||
//Get the prefix
|
//Add the nickname or the name if there is none
|
||||||
String playerPrefix = player.getPrefix();
|
String output = vMinecraftUsers.getProfile(player).getNick();
|
||||||
|
|
||||||
//Add the name
|
if(output.isEmpty())
|
||||||
String output = player.getName();
|
output = player.getName();
|
||||||
|
|
||||||
//Add the color if there is one
|
//Add the color if there is one
|
||||||
if(player.getColor() != null && player.getColor() != "")
|
if(player.getColor() != null && player.getColor() != "")
|
||||||
output = player.getColor().substring(0,2) + output;
|
output = player.getColor().substring(0,2) + output;
|
||||||
//Add the prefix if there is one
|
|
||||||
if(playerPrefix != null && !playerPrefix.isEmpty())
|
//Add the tag if there is one
|
||||||
output = applyColors(playerPrefix.substring(1)) + output;
|
output = vMinecraftUsers.getProfile(player).getTag() + output;
|
||||||
|
|
||||||
|
//Add the suffix if there is one
|
||||||
|
output += vMinecraftUsers.getProfile(player).getSuffix();
|
||||||
|
|
||||||
|
/*if(playerPrefix != null && !playerPrefix.isEmpty())
|
||||||
|
output = applyColors(playerPrefix.substring(1)) + output;*/
|
||||||
|
|
||||||
//Return the name
|
//Return the name
|
||||||
return output;
|
return output;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@ public class vMinecraftUsers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean doesPlayerExist(String player) {
|
public boolean doesPlayerExist(String player) {
|
||||||
try {
|
try {
|
||||||
Scanner scanner = new Scanner(new File(location));
|
Scanner scanner = new Scanner(new File(location));
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
@ -65,10 +65,26 @@ public class vMinecraftUsers {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: addUser
|
||||||
|
//Input: Player player: The player to create a profile for
|
||||||
|
//Output: none
|
||||||
|
//Use: Creates the player profile
|
||||||
|
//=====================================================================
|
||||||
public static void addUser(Player player){
|
public static void addUser(Player player){
|
||||||
players.addPlayer(player);
|
players.addPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: getProfile
|
||||||
|
//Input: Player player: The player to find the profile for
|
||||||
|
//Output: PlayerList.PlayerProfile: The profile
|
||||||
|
//Use: Gets the player profile
|
||||||
|
//=====================================================================
|
||||||
|
public static PlayerList.PlayerProfile getProfile(Player player){
|
||||||
|
return players.findProfile(player);
|
||||||
|
}
|
||||||
|
|
||||||
public static vMinecraftUsers getInstance() {
|
public static vMinecraftUsers getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new vMinecraftUsers();
|
instance = new vMinecraftUsers();
|
||||||
@ -319,6 +335,17 @@ class PlayerList
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: removeIgnore
|
||||||
|
//Input: Player name: The player to unignore
|
||||||
|
//Output: boolean: If the player was successfully unignored
|
||||||
|
//Use: Stops ignoring a player.
|
||||||
|
//=====================================================================
|
||||||
|
public String[] listIgnore()
|
||||||
|
{
|
||||||
|
return ignoreList.toArray(new String[ignoreList.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: addAlias
|
//Function: addAlias
|
||||||
//Input: String command: The command to try to call
|
//Input: String command: The command to try to call
|
||||||
@ -370,6 +397,38 @@ class PlayerList
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public String getTag() { return tag; }
|
public String getTag() { return tag; }
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: setNick
|
||||||
|
//Input: String newTag: The nickname to set for the player
|
||||||
|
//Output: None
|
||||||
|
//Use: Sets a player nickname
|
||||||
|
//=====================================================================
|
||||||
|
public void setNick(String newNick){ nickName = newNick; }
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: getNick
|
||||||
|
//Input: None
|
||||||
|
//Output: String: The player nickname
|
||||||
|
//Use: Gets a player nickname
|
||||||
|
//=====================================================================
|
||||||
|
public String getNick() { return nickName; }
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: setSuffix
|
||||||
|
//Input: String newTag: The suffix to set for the player
|
||||||
|
//Output: None
|
||||||
|
//Use: Sets a player suffix
|
||||||
|
//=====================================================================
|
||||||
|
public void setSuffix(String newSuffix){ suffix = newSuffix; }
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: getSuffix
|
||||||
|
//Input: None
|
||||||
|
//Output: String: The player suffix
|
||||||
|
//Use: Gets a player suffix
|
||||||
|
//=====================================================================
|
||||||
|
public String getSuffix() { return suffix; }
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: setMessage
|
//Function: setMessage
|
||||||
//Input: String newName: The name of the player they last messaged
|
//Input: String newName: The name of the player they last messaged
|
||||||
|
Loading…
Reference in New Issue
Block a user