Implemented #42

Players should be already allowed without flairs
This commit is contained in:
Norbi Peti 2016-09-08 16:51:11 +02:00
parent 4031d9df46
commit e83e4724f7
2 changed files with 16 additions and 29 deletions

View file

@ -199,39 +199,26 @@ public class ChatProcessing {
.setClickEvent(TellrawEvent.create(TellrawEvent.ClickAC, TellrawEvent.ClickAction.SUGGEST_COMMAND, .setClickEvent(TellrawEvent.create(TellrawEvent.ClickAC, TellrawEvent.ClickAction.SUGGEST_COMMAND,
suggestmsg))); suggestmsg)));
json.addExtra(new TellrawPart(" <")); json.addExtra(new TellrawPart(" <"));
json.addExtra( json.addExtra(new TellrawPart((player != null ? player.getDisplayName() : sender.getName())).setHoverEvent(
new TellrawPart( TellrawEvent.create(TellrawEvent.HoverAC, TellrawEvent.HoverAction.SHOW_TEXT, new TellrawPart("")
(player != null ? player.getDisplayName() : sender.getName())) .addExtra(new TellrawPart(String.format("Flair: %s", mp.GetFormattedFlair())))
.setHoverEvent( .addExtra(new TellrawPart(String.format("Playername: %s\n",
TellrawEvent (player != null ? player.getName() : sender.getName()))).setColor(Color.Aqua))
.create(TellrawEvent.HoverAC, TellrawEvent.HoverAction.SHOW_TEXT, .addExtra(new TellrawPart(
new TellrawPart("") String.format("World: %s\n", (player != null ? player.getWorld().getName() : "-"))))
.addExtra(new TellrawPart( .addExtra(new TellrawPart(String.format("Respect: %s%s%s",
String.format("Playername: %s\n", (mp != null ? (mp.FCount / (double) mp.FDeaths) : "Infinite"),
(player != null ? player.getName() (mp != null && mp.UserName != null && !mp.UserName.isEmpty()
: sender.getName()))) ? "\nUserName: " + mp.UserName : ""),
.setColor(Color.Aqua)) (mp != null && mp.PlayerName.equals("\nAlpha_Bacca44")
.addExtra(new TellrawPart(String.format("World: %s\n", ? "\nDeaths: " + PlayerListener.AlphaDeaths
(player != null ? player.getWorld().getName() : "")))))));
: "-"))))
.addExtra(new TellrawPart(String.format(
"Respect: %s%s%s",
(mp != null ? (mp.FCount / (double) mp.FDeaths)
: "Infinite"),
(mp != null && mp.UserName != null
&& !mp.UserName.isEmpty()
? "\nUserName: " + mp.UserName
: ""),
(mp != null && mp.PlayerName.equals(
"\nAlpha_Bacca44") ? "\nDeaths: "
+ PlayerListener.AlphaDeaths
: "")))))));
json.addExtra(new TellrawPart("> ")); json.addExtra(new TellrawPart("> "));
ChatFormatter.Combine(formatters, formattedmessage, json); ChatFormatter.Combine(formatters, formattedmessage, json);
String jsonstr = new Gson().toJson(json); String jsonstr = new Gson().toJson(json);
if (jsonstr.length() >= 32767) { if (jsonstr.length() >= 32767) {
sender.sendMessage( sender.sendMessage(
"§cError: Message too large. Try shortening it, or remove hashtags and other formatting."); "§cError: Message too long. Try shortening it, or remove hashtags and other formatting.");
return true; return true;
} }
DebugCommand.SendDebugMessage(jsonstr); DebugCommand.SendDebugMessage(jsonstr);

View file

@ -32,7 +32,7 @@ public final class IgnoreCommand extends UCommandBase {
p.FlairState = FlairStates.Ignored; p.FlairState = FlairStates.Ignored;
p.SetFlair(ChatPlayer.FlairTimeNone); p.SetFlair(ChatPlayer.FlairTimeNone);
p.UserName = ""; p.UserName = "";
player.sendMessage("§bYou have ignored the message. You can still use /u accept to get a flair.§r"); player.sendMessage("§bYou have ignored the message.§r");
} else } else
player.sendMessage("§cYou already ignored the message.§r"); player.sendMessage("§cYou already ignored the message.§r");
return true; return true;