Fixed a bug with handling tablist

This commit is contained in:
Norbi Peti 2015-12-19 21:17:42 +01:00
parent afb35c06eb
commit 5a37aa5d74
7 changed files with 13 additions and 6 deletions

Binary file not shown.

View file

@ -111,7 +111,7 @@ public class MaybeOfflinePlayer {
// Flairs from Command Block The Button - Teams
// PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard().getTeams().add()
Player p = Bukkit.getPlayer(UUID);
p.setPlayerListName(String.format("%s%s", p.getPlayerListName(),
p.setPlayerListName(String.format("%s%s", p.getName(),
GetFormattedFlair()));
}

View file

@ -28,6 +28,7 @@ import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.regex.Pattern;
public class PlayerListener implements Listener { // 2015.07.16.
public static HashMap<String, UUID> nicknames = new HashMap<>();
@ -97,7 +98,7 @@ public class PlayerListener implements Listener { // 2015.07.16.
mp.RPMode = true; // 2015.08.25.
mp.SetFlairColor(mp.GetFlairColor()); //Update display
mp.SetFlairColor(mp.GetFlairColor()); // Update display
}
@EventHandler
@ -139,8 +140,11 @@ public class PlayerListener implements Listener { // 2015.07.16.
: mp.GetFlairColor())); // TODO: Quiz queue
}
message = message.replace(p.getName(), color + p.getName()
+ (event.getMessage().startsWith("§2>") ? "§2" : "§r"));
message = message.replaceAll("(?i)" + Pattern.quote(p.getName()),
color
+ p.getName()
+ (event.getMessage().startsWith("§2>") ? "§2"
: "§r"));
}
for (String n : nicknames.keySet()) {
Player p = null;
@ -166,8 +170,10 @@ public class PlayerListener implements Listener { // 2015.07.16.
MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId()); // 2015.08.17.
}
if (p != null) {
message = message.replace(nwithoutformatting, n
+ (event.getMessage().startsWith("§2>") ? "§2" : "§r"));
message = message.replaceAll(
"(?i)" + Pattern.quote(nwithoutformatting), n
+ (event.getMessage().startsWith("§2>") ? "§2"
: "§r"));
}
}
@ -267,6 +273,7 @@ public class PlayerListener implements Listener { // 2015.07.16.
sb.append("\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Open on Twitter\",\"color\":\"blue\"}]}}}");
}
for (String original : list)
// Hashtags
e.setMessage(e.getMessage().replace(
original,
"§9"