Fixed a bug with handling tablist
This commit is contained in:
parent
afb35c06eb
commit
5a37aa5d74
7 changed files with 13 additions and 6 deletions
Binary file not shown.
|
@ -111,7 +111,7 @@ public class MaybeOfflinePlayer {
|
||||||
// Flairs from Command Block The Button - Teams
|
// Flairs from Command Block The Button - Teams
|
||||||
// PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard().getTeams().add()
|
// PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard().getTeams().add()
|
||||||
Player p = Bukkit.getPlayer(UUID);
|
Player p = Bukkit.getPlayer(UUID);
|
||||||
p.setPlayerListName(String.format("%s%s", p.getPlayerListName(),
|
p.setPlayerListName(String.format("%s%s", p.getName(),
|
||||||
GetFormattedFlair()));
|
GetFormattedFlair()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Random;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class PlayerListener implements Listener { // 2015.07.16.
|
public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
public static HashMap<String, UUID> nicknames = new HashMap<>();
|
public static HashMap<String, UUID> nicknames = new HashMap<>();
|
||||||
|
@ -139,8 +140,11 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
: mp.GetFlairColor())); // TODO: Quiz queue
|
: mp.GetFlairColor())); // TODO: Quiz queue
|
||||||
}
|
}
|
||||||
|
|
||||||
message = message.replace(p.getName(), color + p.getName()
|
message = message.replaceAll("(?i)" + Pattern.quote(p.getName()),
|
||||||
+ (event.getMessage().startsWith("§2>") ? "§2" : "§r"));
|
color
|
||||||
|
+ p.getName()
|
||||||
|
+ (event.getMessage().startsWith("§2>") ? "§2"
|
||||||
|
: "§r"));
|
||||||
}
|
}
|
||||||
for (String n : nicknames.keySet()) {
|
for (String n : nicknames.keySet()) {
|
||||||
Player p = null;
|
Player p = null;
|
||||||
|
@ -166,8 +170,10 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId()); // 2015.08.17.
|
MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId()); // 2015.08.17.
|
||||||
}
|
}
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
message = message.replace(nwithoutformatting, n
|
message = message.replaceAll(
|
||||||
+ (event.getMessage().startsWith("§2>") ? "§2" : "§r"));
|
"(?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\"}]}}}");
|
sb.append("\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Open on Twitter\",\"color\":\"blue\"}]}}}");
|
||||||
}
|
}
|
||||||
for (String original : list)
|
for (String original : list)
|
||||||
|
// Hashtags
|
||||||
e.setMessage(e.getMessage().replace(
|
e.setMessage(e.getMessage().replace(
|
||||||
original,
|
original,
|
||||||
"§9"
|
"§9"
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue