Add some color to commands

This commit is contained in:
RedSparr0w 2019-09-21 12:28:17 +12:00
parent 12f598768a
commit df44ba4c40
2 changed files with 27 additions and 24 deletions

View file

@ -62,7 +62,13 @@ public final class PlayerCommandPlugin extends CommandPlugin {
case "credits": case "credits":
int credits = CREDIT_STORE.getPoints(player); int credits = CREDIT_STORE.getPoints(player);
player.sendMessage("<col=CC0000>You currently have " + credits + " credits to spend."); player.sendMessage("<col=3498db>You currently have " + credits + " credits to spend.");
break;
case "bank":
if (!player.isAdmin()) {
player.sendChat("Hey, everyone, I just tried to do something very silly!");
}
break; break;
case "bankresettabs": case "bankresettabs":
@ -73,12 +79,12 @@ public final class PlayerCommandPlugin extends CommandPlugin {
if (player.getBank().isOpen()) { if (player.getBank().isOpen()) {
player.getInterfaceManager().close(); player.getInterfaceManager().close();
} }
player.getPacketDispatch().sendMessage("Bank tabs are reset!"); player.sendMessage("<col=3498db>Your bank tabs have been reset!");
return true; return true;
case "bankresetpin": case "bankresetpin":
if (arguments.length < 2) { if (arguments.length < 2) {
player.sendMessage("Syntax error: ::resetpin oldpin"); player.sendMessage("<col=e74c3c>You must specify your current pin!");
return true; return true;
} }
String oldPin = arguments[1]; String oldPin = arguments[1];
@ -86,24 +92,20 @@ public final class PlayerCommandPlugin extends CommandPlugin {
return true; return true;
} }
if (!player.getBankPinManager().hasPin()) { if (!player.getBankPinManager().hasPin()) {
player.sendMessage("You don't have a pin."); player.sendMessage("<col=e74c3c>You don't currently have a pin set.");
return true; return true;
} }
if (!oldPin.equals(player.getBankPinManager().getPin())) { if (!oldPin.equals(player.getBankPinManager().getPin())) {
player.sendMessage("Your old pin doesn't match your current pin."); player.sendMessage("<col=e74c3c>" + oldPin + " doesn't match your current pin.");
return true; return true;
} }
player.getBankPinManager().setPin(null); player.getBankPinManager().setPin(null);
player.sendMessage("Your pin has been reset."); player.sendMessage("<col=3498db>Your pin has been reset.");
return true; return true;
case "bank":// The players want OSRS content, let's give it to em
if (!player.isAdmin()) {
player.sendChat("Hey, everyone, I just tried to do something very silly!");
}
break;
case "players": case "players":
int count = Repository.getPlayers().size(); int count = Repository.getPlayers().size();
int ironCount = 1; int ironCount = 0;
int ultIronCount = 0; int ultIronCount = 0;
for (Player p : Repository.getPlayers()) { for (Player p : Repository.getPlayers()) {
if (p.getIronmanManager().checkRestriction(IronmanMode.ULTIMATE)) { if (p.getIronmanManager().checkRestriction(IronmanMode.ULTIMATE)) {
@ -115,33 +117,34 @@ public final class PlayerCommandPlugin extends CommandPlugin {
} }
int regular = count - ironCount - ultIronCount; int regular = count - ironCount - ultIronCount;
if (count == 1) { if (count == 1) {
player.getPacketDispatch().sendMessage("There is 1 active player in this world."); player.sendMessage("<col=3498db>There is 1 active player in this world.");
} else { } else {
player.getPacketDispatch().sendMessage("There are " + count + " active players in this world: " + regular + " regular, " + ironCount + " iron, and " + ultIronCount + " ultimate iron."); player.sendMessage("<col=3498db>There are " + count + " active players in this world: " + regular + " regular, " + ironCount + " iron, and " + ultIronCount + " ultimate iron.");
} }
return player.getRights() == Rights.REGULAR_PLAYER; return player.getRights() == Rights.REGULAR_PLAYER;
case "yell": case "yell":
if (!player.isDonator() && !player.isAdmin()) { if (!player.isDonator() && !player.isAdmin()) {
player.getPacketDispatch().sendMessages("Join clan chat \"" + GameWorld.getName() + "\" to talk globally, or become a donator to have access to", "this benefit."); player.sendMessages("Join clan chat \"" + GameWorld.getName() + "\" to talk globally, or become a donator to have access to", "this benefit.");
return true; return true;
} }
if (player.getDetails().isMuted()) { if (player.getDetails().isMuted()) {
player.getPacketDispatch().sendMessage("You have been " + (player.getDetails().isPermMute() ? "permanently" : "temporarily") + " muted due to breaking a rule."); player.sendMessage("<col=e74c3c>You have been " + (player.getDetails().isPermMute() ? "permanently" : "temporarily") + " muted due to breaking a rule.");
return true; return true;
} }
if(WorldCommunicator.isEnabled()){ if(WorldCommunicator.isEnabled()){
if(ClanRepository.getDefault().isBanned(player.getName())){ if(ClanRepository.getDefault().isBanned(player.getName())){
player.sendMessages("You are temporarily unable to yell as you are banned from the main clan chat.", "Don't be annoying!"); player.sendMessages("<col=e74c3c>You are temporarily unable to yell as you are banned from the main clan chat.", "Don't be annoying!");
return true; return true;
} }
} }
if (player.getAttribute("yell-delay", 0.0) > GameWorld.getTicks()) { if (player.getAttribute("yell-delay", 0.0) > GameWorld.getTicks()) {
player.sendMessages("You have yelled in the last " + player.getDonatorType().getCooldown() + " seconds. Upgrade to an extreme donator to have", "unlimited yelling abilities."); player.sendMessages("<col=e74c3c>You have yelled in the last " + player.getDonatorType().getCooldown() + " seconds. Upgrade to an extreme donator to have", "unlimited yelling abilities.");
return true; return true;
} }
String text = getArgumentLine(arguments); String text = getArgumentLine(arguments);
if(text.contains("<img=") || text.contains("<br>") || text.contains("<col=") || text.contains("<shad=")){ if(text.contains("<img=") || text.contains("<br>") || text.contains("<col=") || text.contains("<shad=")){
player.sendMessage("Bad! No images/text effects allowed in yell chat."); player.sendMessage("<col=e74c3c>Bad! No images/text effects allowed in yell chat.");
return true; return true;
} }
int length = text.length(); int length = text.length();
@ -162,12 +165,12 @@ public final class PlayerCommandPlugin extends CommandPlugin {
player.setAttribute("yell-delay", (int) GameWorld.getTicks() + (player.getDonatorType().getCooldown() / 0.6)); player.setAttribute("yell-delay", (int) GameWorld.getTicks() + (player.getDonatorType().getCooldown() / 0.6));
} }
} else { } else {
player.getPacketDispatch().sendMessage("Your message was too short."); player.sendMessage("<col=e74c3c>Your message was too short.");
} }
return true; return true;
case "togglenews": case "togglenews":
player.getSavedData().getGlobalData().setDisableNews(!player.getSavedData().getGlobalData().isDisableNews()); player.getSavedData().getGlobalData().setDisableNews(!player.getSavedData().getGlobalData().isDisableNews());
player.sendMessage("<col=FF0000>" + (player.getSavedData().getGlobalData().isDisableNews() ? "You will no longer see news notifications." : "You will now see news notifications.")); player.sendMessage("<col=3498db>" + (player.getSavedData().getGlobalData().isDisableNews() ? "You will no longer see news notifications." : "You will now see news notifications."));
return true; return true;
case "commands": case "commands":
case "command": case "command":
@ -182,7 +185,7 @@ public final class PlayerCommandPlugin extends CommandPlugin {
return true; return true;
case "reply": case "reply":
if(player.getInterfaceManager().isOpened()){ if(player.getInterfaceManager().isOpened()){
player.sendMessage("Please finish what you're doing first."); player.sendMessage("<col=e74c3c>Please finish what you're doing first.");
return true; return true;
} }
if (player.getAttributes().containsKey("replyTo")) { if (player.getAttributes().containsKey("replyTo")) {
@ -198,7 +201,7 @@ public final class PlayerCommandPlugin extends CommandPlugin {
}); });
player.getDialogueInterpreter().sendMessageInput(StringUtils.formatDisplayName(replyTo)); player.getDialogueInterpreter().sendMessageInput(StringUtils.formatDisplayName(replyTo));
} else { } else {
player.getPacketDispatch().sendMessage("You have not recieved any recent messages to which you can reply."); player.getPacketDispatch().sendMessage("<col=3498db>You have not recieved any recent messages to which you can reply.");
} }
return true; return true;
} }

View file

@ -129,7 +129,7 @@ public final class GrandExchangeZone extends MapZone implements Plugin<Object> {
if (player.getDetails().getShop().syncCredits()) { if (player.getDetails().getShop().syncCredits()) {
CreditStore.super.open(player); CreditStore.super.open(player);
int credits = player.getDetails().getShop().getCredits(); int credits = player.getDetails().getShop().getCredits();
player.sendMessage("<col=CC0000>You currently have " + credits + (credits == 1 ? " credit" : " credits") + " to spend."); player.sendMessage("<col=3498db>You currently have " + credits + (credits == 1 ? " credit" : " credits") + " to spend.");
} }
} }