mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Misc Updates
This commit is contained in:
parent
35e4550f81
commit
db8ac45ad5
@ -131,7 +131,7 @@ public class vminecraftChat {
|
|||||||
public static String getName(Player player){
|
public static String getName(Player player){
|
||||||
|
|
||||||
//Get the prefix
|
//Get the prefix
|
||||||
String[] playerPrefix = new String[]{player.getPrefix()};
|
String playerPrefix = player.getPrefix();
|
||||||
|
|
||||||
//Add the name
|
//Add the name
|
||||||
String output = player.getName();
|
String output = player.getName();
|
||||||
@ -140,8 +140,8 @@ public class vminecraftChat {
|
|||||||
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
|
//Add the prefix if there is one
|
||||||
if(playerPrefix[0] != null && playerPrefix[0] != "")
|
if(playerPrefix != null && playerPrefix != "")
|
||||||
output = applyColors(playerPrefix)[0].substring(3) + output;
|
output = applyColors(playerPrefix).substring(3) + output;
|
||||||
|
|
||||||
//Return the name
|
//Return the name
|
||||||
return output;
|
return output;
|
||||||
@ -365,9 +365,9 @@ public class vminecraftChat {
|
|||||||
//Output: String[]: The lines, but colorful
|
//Output: String[]: The lines, but colorful
|
||||||
//Use: Colors each line
|
//Use: Colors each line
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
private static String[] applyColors(String[] message)
|
public static String[] applyColors(String[] message)
|
||||||
{
|
{
|
||||||
|
if(message != null && message[0] != null && !message[0].equals("")){
|
||||||
//The color to start the line with
|
//The color to start the line with
|
||||||
String recentColor = Colors.White;
|
String recentColor = Colors.White;
|
||||||
|
|
||||||
@ -381,8 +381,10 @@ public class vminecraftChat {
|
|||||||
//Loop through looking for a color code
|
//Loop through looking for a color code
|
||||||
for(int x = 0; x< msg.length(); x++)
|
for(int x = 0; x< msg.length(); x++)
|
||||||
{
|
{
|
||||||
//If the char is a ^
|
//If the char is a ^ or §
|
||||||
if(msg.charAt(x)=='^' && x != msg.length() - 1)
|
if(msg.charAt(x) == '^' || msg.charAt(x) == '§')
|
||||||
|
{
|
||||||
|
if(x != msg.length() - 1)
|
||||||
{
|
{
|
||||||
//If the following character is a color code
|
//If the following character is a color code
|
||||||
if(vminecraftChat.colorChange(msg.charAt(x+1)) != null)
|
if(vminecraftChat.colorChange(msg.charAt(x+1)) != null)
|
||||||
@ -398,6 +400,7 @@ public class vminecraftChat {
|
|||||||
temp += msg.charAt(x);
|
temp += msg.charAt(x);
|
||||||
}
|
}
|
||||||
//Insert the character
|
//Insert the character
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
temp += msg.charAt(x);
|
temp += msg.charAt(x);
|
||||||
}
|
}
|
||||||
@ -406,6 +409,68 @@ public class vminecraftChat {
|
|||||||
message[counter] = temp;
|
message[counter] = temp;
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: applyColors
|
||||||
|
//Input: String message: The line to be colored
|
||||||
|
//Output: String: The line, but colorful
|
||||||
|
//Use: Colors a line
|
||||||
|
//=====================================================================
|
||||||
|
public static String applyColors(String message)
|
||||||
|
{
|
||||||
|
return applyColors(message, Colors.White);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: applyColors
|
||||||
|
//Input: String message: The line to be colored
|
||||||
|
// String color: The color to start the line with
|
||||||
|
//Output: String: The line, but colorful
|
||||||
|
//Use: Colors a line
|
||||||
|
//=====================================================================
|
||||||
|
public static String applyColors(String message, String color)
|
||||||
|
{
|
||||||
|
if(message != null && !message.equals(""))
|
||||||
|
{
|
||||||
|
//The color to start the line with
|
||||||
|
if(color == null)
|
||||||
|
color = Colors.White;
|
||||||
|
|
||||||
|
//Start the line with the most recent color
|
||||||
|
String temp = color;
|
||||||
|
|
||||||
|
//Loop through looking for a color code
|
||||||
|
for(int x = 0; x< message.length(); x++)
|
||||||
|
{
|
||||||
|
//If the char is a ^ or §
|
||||||
|
if(message.charAt(x) == '^' || message.charAt(x) == '§')
|
||||||
|
{
|
||||||
|
if(x != message.length() - 1)
|
||||||
|
{
|
||||||
|
//If the following character is a color code
|
||||||
|
if(vminecraftChat.colorChange(message.charAt(x+1)) != null)
|
||||||
|
{
|
||||||
|
//Set the most recent color to the new color
|
||||||
|
color = vminecraftChat.colorChange(message.charAt(x+1));
|
||||||
|
//Add the color
|
||||||
|
temp += color;
|
||||||
|
//Skip these chars
|
||||||
|
x++;
|
||||||
|
//Otherwise ignore it.
|
||||||
|
} else {
|
||||||
|
temp += message.charAt(x);
|
||||||
|
}
|
||||||
|
//Insert the character
|
||||||
|
} else {
|
||||||
|
temp += message.charAt(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,11 +237,17 @@ public class vminecraftCommands{
|
|||||||
{
|
{
|
||||||
//If the rules exist
|
//If the rules exist
|
||||||
if(vminecraftSettings.getInstance().cmdRules()
|
if(vminecraftSettings.getInstance().cmdRules()
|
||||||
&& vminecraftSettings.getInstance().getRules().length != 0) {
|
&& vminecraftSettings.getInstance().getRules().length > 0) {
|
||||||
|
|
||||||
|
//Apply QuakeCode Colors to the rules
|
||||||
|
String[] rules = vminecraftChat.applyColors(
|
||||||
|
vminecraftSettings.getInstance().getRules());
|
||||||
//Display them
|
//Display them
|
||||||
for (String str : vminecraftSettings.getInstance().getRules()) {
|
for (String str : rules ) {
|
||||||
if(str.isEmpty())
|
if(!str.isEmpty())
|
||||||
player.sendMessage(Colors.Blue+str);
|
player.sendMessage(Colors.Blue + str);
|
||||||
|
else
|
||||||
|
player.sendMessage(Colors.Blue + "!!!The Rules Have Not Been Set!!!");
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,6 @@ public class vminecraftSettings {
|
|||||||
public boolean cmdRules() {return cmdRules;}
|
public boolean cmdRules() {return cmdRules;}
|
||||||
public boolean globalmessages() {return globalmessages;}
|
public boolean globalmessages() {return globalmessages;}
|
||||||
public boolean cmdMasstp() {return cmdMasstp;}
|
public boolean cmdMasstp() {return cmdMasstp;}
|
||||||
public boolean cmdEzModo() {return cmdEzModo;}
|
|
||||||
public boolean cmdWho() {return cmdWho;}
|
public boolean cmdWho() {return cmdWho;}
|
||||||
public boolean stopFire() {return stopFire;}
|
public boolean stopFire() {return stopFire;}
|
||||||
public boolean stopTnt() {return stopTnt;}
|
public boolean stopTnt() {return stopTnt;}
|
||||||
@ -179,11 +178,13 @@ public class vminecraftSettings {
|
|||||||
public boolean cmdHeal() {return cmdHeal;}
|
public boolean cmdHeal() {return cmdHeal;}
|
||||||
|
|
||||||
//EzModo methods
|
//EzModo methods
|
||||||
|
public boolean cmdEzModo() {return cmdEzModo;}
|
||||||
public boolean isEzModo(String playerName) {return ezModo.contains(playerName);}
|
public boolean isEzModo(String playerName) {return ezModo.contains(playerName);}
|
||||||
public void removeEzModo(String playerName) {ezModo.remove(ezModo.indexOf(playerName));}
|
public void removeEzModo(String playerName) {ezModo.remove(ezModo.indexOf(playerName));}
|
||||||
public void addEzModo(String playerName) {ezModo.add(playerName);}
|
public void addEzModo(String playerName) {ezModo.add(playerName);}
|
||||||
public int ezModoHealth() {return ezHealth;}
|
public int ezModoHealth() {return ezHealth;}
|
||||||
public String ezModoList() {return ezModo.toString();}
|
public String ezModoList() {return ezModo.toString();}
|
||||||
|
|
||||||
//Random death message method
|
//Random death message method
|
||||||
public static String randomDeathMsg() {
|
public static String randomDeathMsg() {
|
||||||
if (deathMessages == null) {
|
if (deathMessages == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user