Originally Posted by
5tuart
Code:
if (playerCommand.startsWith("yell")) {
if((System.currentTimeMillis() - c.yellTimer < 20000) && !c.isDonator && c.playerRights == 0) {
c.sendMessage("Sorry, You must wait 20 seconds");
return;
}
c.yellTimer = System.currentTimeMillis();
String yell = "";
switch(c.playerRights) {
case 0:
if(c.isDonator) {
yell = "[Player]"+ Misc.optimizeText(c.playerName) +": " + Misc.optimizeText(playerCommand.substring(5));
} else {
yell = "<shad=6081134>[Donator]</col><img=0>"+ Misc.optimizeText(c.playerName) +": " + Misc.optimizeText(playerCommand.substring(5));
}
break;
case 1:
case 2:
yell = "<col=255>[" + (c.playerRights == 1 ? "Mod" : "Admin") + "]</col><img=2>"+ Misc.optimizeText(c.playerName) +": " + Misc.optimizeText(playerCommand.substring(5))
break;
case 3:
yell = "<shad=15695415>[Owner]</col><img=2>"+ Misc.optimizeText(c.playerName) +": " + Misc.optimizeText(playerCommand.substring(5));
break;
}
for (int j = 0; j < Server.playerHandler.players.length; j++)
if (Server.playerHandler.players[j] != null)
((Client)Server.playerHandler.players[j]).sendMessage(yell);
}
Code:
src\server\model\players\packets\Commands.java:274: operator ! cannot be applied
to int
if((System.currentTimeMillis() - c.yellTimer < 20000) && !c.isDonator && c.p
layerRights == 0) {
^
src\server\model\players\packets\Commands.java:282: incompatible types
found : int
required: boolean
if(c.isDonator) {
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
Press any key to continue . . .
Do you mean c.ifDonator == 1 or c.ifDonator == 0 since this is a boolean.
I made it like:
Code:
if (playerCommand.startsWith("yell")) {
if((System.currentTimeMillis() - c.yellTimer < 20000) && c.isDonator == 0 && c.playerRights == 0) {
c.sendMessage("Sorry, You must wait 20 seconds");
return;
}
c.yellTimer = System.currentTimeMillis();
String yell = "";
switch(c.playerRights) {
case 0:
if(c.isDonator == 1) {
yell = "[Player]"+ Misc.optimizeText(c.playerName) +": " + Misc.optimizeText(playerCommand.substring(5));
} else {
yell = "<shad=6081134>[Donator]</col><img=0>"+ Misc.optimizeText(c.playerName) +": " + Misc.optimizeText(playerCommand.substring(5));
}
break;
case 1:
case 2:
yell = "<col=255>[" + (c.playerRights == 1 ? "Mod" : "Admin") + "]</col><img=2>"+ Misc.optimizeText(c.playerName) +": " + Misc.optimizeText(playerCommand.substring(5));
break;
case 3:
yell = "<shad=15695415>[Owner]</col><img=2>"+ Misc.optimizeText(c.playerName) +": " + Misc.optimizeText(playerCommand.substring(5));
break;
}
for (int j = 0; j < Server.playerHandler.players.length; j++)
if (Server.playerHandler.players[j] != null)
((Client)Server.playerHandler.players[j]).sendMessage(yell);
}
With no errors, but I am not sure if this is what your going at.