Sorry everyone, posted this at the middle of the night, so I fell asleep afterwards.
Here's my yell method;
Also, for some reason it's handled in Client.java, I'm not sure if that has anything to do with it or not.
Code:
public void handleYell(String playerCommand) {
/**
* The ::yell command
* and the censor for it.
*/
String text = playerCommand.substring(5);
String[] bad = {"<img=1>", "<img=2>", "<img=0>", "join", "www.", "http"};
for(int i = 0; i < bad.length; i++){
if(text.indexOf(bad[i]) >= 0){
sendMessage("You cannot use <img= 1>, <img= 2>, or <img= 3 in yell!");
sendMessage("You cannot use the words "Join" - "www." or "http" in yell either!");
return;
}
}
for (int j = 0; j < Server.playerHandler.players.length; j++) {
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if(Connection.isMuted(this)){
sendMessage("You are muted and cannot yell");
return;
}
if (isDonator == 0) {
sendMessage("You must be a donator to use this command!");
return;
}
if (isDonator == 1 && (playerRights == 4 )) {
c2.sendMessage("<shad=6081134>[Donator]</col><img=2>"+ Misc.optimizeText(playerName) +": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
} else if (isDonator > 0 && (playerRights == 5 )) {
c2.sendMessage("<shad=6081134>[Super Donator]</col><img=3>"+ Misc.optimizeText(playerName) +": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
} else if (isDonator > 0 && (playerRights == 6 )) {
c2.sendMessage("<shad=6081134>["+customYellTag+"]</col><img=4>"+ Misc.optimizeText(playerName) +": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
} else if (playerRights == 1) {
c2.sendMessage("<shad=3781373>[Moderator]</col><img=0>"+ Misc.optimizeText(playerName) +": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
} else if (playerRights == 2) {
c2.sendMessage("<shad=16112652>[Administrator]</col><img=1>"+ Misc.optimizeText(playerName) +": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
} else if (playerRights == 9) {
c2.sendMessage("<shad=750301>[GFX Designer]</col>"+ Misc.optimizeText(playerName) +": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
} else if (playerRights == 8) {
c2.sendMessage("<shad=750301>[Trial Moderator]</col>"+ Misc.optimizeText(playerName) +": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
} else if (playerName.equalsIgnoreCase("phaethon")) {
c2.sendMessage("<shad=12595455>[Main Owner/Coder]</col><img=1></shad>"+ Misc.optimizeText(playerName) +": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
}
}
}
}
So I'm not sure if I need to modify it to put in with commands.java or what I need to do.
Edit: Also, here's my yell command in commands.java
Code:
if (playerCommand.startsWith("yell")) {
c.handleYell(playerCommand);
}