use of com.loohp.interactivechat.objectholders.ReplaceTextBundle in project InteractiveChat by LOOHP.
the class PlayernameDisplay method getNames.
private static Collection<ReplaceTextBundle> getNames() {
List<ReplaceTextBundle> names = new ArrayList<>();
ICPlayerFactory.getOnlineICPlayers().forEach(each -> {
if (VanishUtils.isVanished(each.getUniqueId())) {
return;
}
names.add(new ReplaceTextBundle(ChatColorUtils.stripColor(each.getName()), each, each.getName()));
if (InteractiveChat.useBukkitDisplayName && !ChatColorUtils.stripColor(each.getName()).equals(ChatColorUtils.stripColor(each.getDisplayName()))) {
names.add(new ReplaceTextBundle(ChatColorUtils.stripColor(each.getDisplayName()), each, each.getDisplayName()));
}
for (String nickname : each.getNicknames()) {
names.add(new ReplaceTextBundle(ChatColorUtils.stripColor(nickname), each, nickname));
}
});
CollectionUtils.filter(names, each -> !each.getPlaceholder().isEmpty());
names.sort(Comparator.reverseOrder());
return new LinkedHashSet<>(names);
}
use of com.loohp.interactivechat.objectholders.ReplaceTextBundle in project InteractiveChat by LOOHP.
the class PlayernameDisplay method process.
public static Component process(Component component, Optional<ICPlayer> sender, Player receiver, long unix) {
Collection<ReplaceTextBundle> names = PlayernameDisplay.names;
if (names == null) {
names = getNames();
}
Set<HoverEvent<?>> doNotReplace = new HashSet<>();
for (ReplaceTextBundle entry : names) {
component = processPlayer(entry.getPlaceholder(), entry.getPlayer(), sender, receiver, component, doNotReplace, unix);
}
return ComponentCompacting.optimize(component);
}
Aggregations