Lang tweaks.

This commit is contained in:
TadahTech 2016-07-08 15:32:25 -05:00
parent 1313db4071
commit cbb0fa37fb
4 changed files with 47 additions and 17 deletions

View File

@ -4,6 +4,8 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* All chat messages for the party system to align with PE
*/
@ -56,40 +58,68 @@ public enum Lang
public void send(Player player, String... args)
{
String message = _message;
String colored = "";
String color = C.mBody;
if(args.length == 0)
{
player.sendMessage(F.main("Party", _message));
return;
}
if(_message.startsWith("Error:"))
{
color = C.cRed;
}
int firstIndex = _message.indexOf("{");
String[] coloredArgs = new String[args.length];
for(int i = 0; i < args.length; i++)
{
String s = args[i];
message = message.replace("{" + i + "}", F.elem(s));
colored = C.mBody + message;
coloredArgs[i] = C.cYellow + args[i] + color;
}
player.sendMessage(C.mHead + "Party> " + colored);
String message = MessageFormat.format(_message, coloredArgs);
String coloredRest = message.substring(firstIndex);
message = color + message.substring(0, firstIndex) + coloredRest;
player.sendMessage(C.mHead + "Party> " + message);
}
public void send(Party party, String... args)
{
String message = _message;
String colored = "";
String color = C.mBody;
if(args.length == 0)
{
party.sendMessage(F.main("Party", _message));
return;
}
if(_message.startsWith("Error:"))
{
color = C.cRed;
}
int firstIndex = _message.indexOf("{");
String[] coloredArgs = new String[args.length];
for(int i = 0; i < args.length; i++)
{
String s = args[i];
message = message.replace("{" + i + "}", F.elem(s));
colored = C.mBody + message;
coloredArgs[i] = C.cYellow + args[i] + color;
}
party.sendMessage(C.mHead + "Party> " + colored);
String message = MessageFormat.format(_message, coloredArgs);
String coloredRest = message.substring(firstIndex);
message = color + message.substring(0, firstIndex) + coloredRest;
party.sendMessage(C.mHead + "Party> " + message);
}

View File

@ -15,7 +15,7 @@ import java.util.Map;
import java.util.UUID;
/**
* Uh, yeah, I'll get back to this when it isn't 2 AM
* The main object for Parites.
*/
public class Party
{

View File

@ -386,8 +386,8 @@ public class PartyInviteManager
textComponent.addExtra(deny);
textComponent.addExtra(" ");
TextComponent view = new TextComponent("VIEW INVITES");
view.setColor(ChatColor.GOLD);
TextComponent view = new TextComponent("VIEW");
view.setColor(ChatColor.YELLOW);
view.setBold(true);
view.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/openinvitesmenu"));
view.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{

View File

@ -160,7 +160,7 @@ public class PartyRedisManager
*/
public void findAndInvite(String player, String sender)
{
Bukkit.getPlayerExact(sender).sendMessage(F.main("Party", "Locating " + player + "..."));
Bukkit.getPlayerExact(sender).sendMessage(F.main("Party", "Locating " + F.elem(player) + "..."));
TASKS.put(player, new BukkitRunnable()
{
@Override
@ -180,7 +180,7 @@ public class PartyRedisManager
}
senderPlayer.sendMessage(F.main("Party", "Could not locate " + F.elem(player) + "."));
}
}.runTaskLater(_plugin.getPlugin(), 20L * 10));
}.runTaskLater(_plugin.getPlugin(), 20L * 5));
_plugin.runAsync(() -> {
try (Jedis jedis = _writePool.getResource())