Decided to release my version of yell. There's an option to reset the yelltag/color.
Look at code, to see how you reset.
TO DO: Add playerSave yelltag/color.
TAG:
Code:
if (playerCommand.startsWith("yelltag") && playerCommand.length() > 8) {
if (c.playerRights > 0 && c.playerRights < 6) {
String tempTag = playerCommand.substring(8);
if (tempTag.toLowerCase().equals("reset")) {
c.customYellTag = "";
c.sendMessage("Yell tag reset.");
return;
}
if (c.playerRights != 2) {
if (tempTag.length() < 3 || tempTag.length() > 12) {
c.sendMessage("Custom yell tags may only be 3-12 characters long!");
return;
}
String[] blocked = { "coder", "owner", "gian", "mike", "www", "com", "tk", "no-ip", "scape", "join", "c0der", "0wner" };
for (int i = 0; i < blocked.length; i++) {
if (tempTag.toLowerCase().contains(blocked[i])) {
c.sendMessage("The yell tag you have tried using contains words which arent allowed...");
c.sendMessage("If you abuse the custom yell tag system your donator rights will be taken away.");
return;
}
}
}
c.customYellTag = tempTag;
c.sendMessage("Your custom yell tag is now: " + tempTag);
c.sendMessage("If you abuse the custom yell tag system, your donator rights will be taken away.");
} else {
c.sendMessage("Only special donators may use this feature.");
}
}
Color:
Code:
if (playerCommand.startsWith("yellcolor")) {
if (c.playerRights > 0 && c.playerRights < 6) {
String tempColor = playerCommand.substring(10);
if (tempColor.length() > 6 || tempColor.length() < 18) {
if (tempColor.toLowerCase().startsWith("col=") || tempColor.toLowerCase().startsWith("shad=")) {
try {
int color = Integer.parseInt(tempColor.split("=")[1]);
c.customYellColor = "<" + tempColor + ">";
} catch (Exception ex) {
c.sendMessage("Error setting color: " + ex.getMessage());
}
} else if (tempColor.toLowerCase().equals("blue")
|| tempColor.toLowerCase().equals("purple")
|| tempColor.toLowerCase().equals("green")
|| tempColor.toLowerCase().equals("black")
|| tempColor.toLowerCase().equals("orange")
|| tempColor.toLowerCase().equals("yellow")
|| tempColor.toLowerCase().equals("red")
|| tempColor.toLowerCase().equals("white")
|| tempColor.toLowerCase().equals("reset")) {
if (tempColor.toLowerCase().equals("blue")) {
c.customYellColor = "<" + "col=255" + ">";
} else if (tempColor.toLowerCase().equals("purple")) {
c.customYellColor = "<" + "col=20451204" + ">";
} else if (tempColor.toLowerCase().equals("green")) {
c.customYellColor = "<" + "col=255125000" + ">";
} else if (tempColor.toLowerCase().equals("black")) {
c.customYellColor = "<" + "col=330000" + ">";
} else if (tempColor.toLowerCase().equals("orange")) {
c.customYellColor = "<" + "col=616582400" + ">";
} else if (tempColor.toLowerCase().equals("yellow")) {
c.customYellColor = "<" + "col=200000000" + ">";
} else if (tempColor.toLowerCase().equals("red")) {
c.customYellColor = "<" + "col=800000000" + ">";
} else if (tempColor.toLowerCase().equals("white")) {
c.customYellColor = "<" + "col=99999999" + ">";
} else if (tempColor.toLowerCase().equals("reset")) {
c.customYellColor = "";
}
} else {
c.sendMessage("Custom yell colors needs to start with 'col=' or 'shad='.");
}
} else {
c.sendMessage("Custom yell colors must only be 3-12 characters long!");
}
} else {
c.sendMessage("Only donators may use this feature.");
}
}
Yell (Players uses one pk point for each yell):
Code:
if (playerCommand.startsWith("yell ")) {
if (!Connection.isMuted(c)) {
if (c.playerRights == 0) {
if (c.pkPoints >= 100) {
c.pkPoints -= 1;
} else {
c.sendMessage("You need at least 1 pkPoint to do this command!");
return;
}
}
for (int i = 0; i < Server.playerHandler.players.length; i++) {
Client c2 = (Client) Server.playerHandler.players[i];
if (c2 != null) {
String color = "";
String image = "";
String prefix = "";
String nameColor = "<col=000000000>";
String optimizedName = Misc.optimizeText(c.playerName);
String optimizedText = Misc.optimizeText(playerCommand.substring(5));
//PlayerRights
if (c.playerRights == 1) {
color = "<col=000000000>";
image = "<img=0>";
prefix = "[Member]";
} else if (c.playerRights == 1) {
color = "<col=255255255>";
image = "<img=1>";
prefix = "[Moderator]";
} else if (c.playerRights == 2) {
color = "<col=600000000>";
image = "<img=2>";
prefix = "[Admin]";
} else if (c.playerRights == 3) {
color = "<col=200000000";
image = "<img=2>";
prefix = "[Owner]<img=2>";
} else if (c.playerRights == 4) {
color = "<shad=6081134>";
image = "<img=0>";
prefix = "[Donator]";
} else if (c.playerRights == 5) {
color = "<col=60811334>";
image = "<img=3>";
prefix = "[Extreme Donator]";
}
//Override
//PlayerNames
if (c.playerName.toLowerCase().equals("")) {
color = "<col=000000000>";
image = "<img=0>";
prefix = ""; //Add what you want here
} else if (c.playerName.toLowerCase().equals("")) { //Add whatever u want
color = "<col=000000000>";
image = "<img=0>";
prefix = "[Default]";
}
//Override
//YellTag
if (!c.customYellTag.equals("")) {
prefix = "[" + c.customYellTag + "]";
}
//Override
//YellColor
if (!c.customYellColor.equals("")) {
color = c.customYellColor;
nameColor = c.customYellColor;
}
c2.sendMessage(color + image + " " + prefix + "</col> " + nameColor + optimizedName + ": " + optimizedText);
}
}
} else {
c.sendMessage("You are muted and cannot yell.");
}
You can figure where you put this! (Not going to spoonfeed):
Code:
public int yellDelay = 0;
public String lastYell = "";
public String customYellTag = "";
public String customYellColor = "";
Please don't release this saying it's yours!
If you like this, don't forget to leave a thanks down below!
Tell me if I'm missing something as well, if you need help post it below as well.
First thread on Rune-server! (Sorry a bit new to this!)