Improvements on server switch

This commit is contained in:
AlexDev_ 2025-01-05 18:48:59 +01:00
parent ea40814c71
commit 2cf4f4956b
6 changed files with 6 additions and 12 deletions

View File

@ -102,9 +102,9 @@ public class Velocitab implements ConfigProvider, ScoreboardProvider, LoggerProv
checkCompatibility(); checkCompatibility();
loadConfigs(); loadConfigs();
loadHooks(); loadHooks();
preparePlaceholderManager();
prepareVanishManager(); prepareVanishManager();
prepareChannelManager(); prepareChannelManager();
preparePlaceholderManager();
prepareScoreboard(); prepareScoreboard();
registerCommands(); registerCommands();
registerMetrics(); registerMetrics();

View File

@ -74,6 +74,7 @@ public class PlaceholderManager {
if (player == null) { if (player == null) {
return; return;
} }
final Map<String, String> parsed = placeholders.computeIfAbsent(uuid, k -> Maps.newConcurrentMap()); final Map<String, String> parsed = placeholders.computeIfAbsent(uuid, k -> Maps.newConcurrentMap());
final TabPlayer tabPlayer = plugin.getTabList().getTabPlayer(player) final TabPlayer tabPlayer = plugin.getTabList().getTabPlayer(player)
.orElse(new TabPlayer(plugin, player, .orElse(new TabPlayer(plugin, player,

View File

@ -110,14 +110,6 @@ public final class TabPlayer implements Comparable<TabPlayer> {
return plugin.getTabGroups().getPosition(group); return plugin.getTabGroups().getPosition(group);
} }
@NotNull
public String getDisplayName(@NotNull Velocitab plugin) {
final String format = group.format();
final String displayName = plugin.getPlaceholderManager().applyPlaceholders(this, format);
return lastDisplayName = displayName;
}
public Nametag getNametag(@NotNull Velocitab plugin) { public Nametag getNametag(@NotNull Velocitab plugin) {
final String prefix = plugin.getPlaceholderManager().applyPlaceholders(this, group.nametag().prefix()); final String prefix = plugin.getPlaceholderManager().applyPlaceholders(this, group.nametag().prefix());
final String suffix = plugin.getPlaceholderManager().applyPlaceholders(this, group.nametag().suffix()); final String suffix = plugin.getPlaceholderManager().applyPlaceholders(this, group.nametag().suffix());

View File

@ -91,7 +91,7 @@ public interface ScoreboardProvider {
setTabList(tabList); setTabList(tabList);
getPlugin().getServer().getEventManager().register(this, tabList); getPlugin().getServer().getEventManager().register(this, tabList);
getPlugin().getServer().getScheduler().buildTask(this, tabList::load).delay(1, TimeUnit.SECONDS).schedule(); getPlugin().getServer().getScheduler().buildTask(this, tabList::load).delay(250, TimeUnit.MILLISECONDS).schedule();
final SortingManager sortingManager = new SortingManager(getPlugin()); final SortingManager sortingManager = new SortingManager(getPlugin());
setSortingManager(sortingManager); setSortingManager(sortingManager);

View File

@ -68,7 +68,6 @@ public class PlayerTabList {
this.players = Maps.newConcurrentMap(); this.players = Maps.newConcurrentMap();
this.taskManager = new TaskManager(plugin); this.taskManager = new TaskManager(plugin);
this.entriesFields = Maps.newHashMap(); this.entriesFields = Maps.newHashMap();
this.reloadUpdate();
this.registerListener(); this.registerListener();
this.ensureDisplayNameTask(); this.ensureDisplayNameTask();
this.registerFields(); this.registerFields();
@ -137,6 +136,8 @@ public class PlayerTabList {
joinPlayer(p, group.get()); joinPlayer(p, group.get());
}); });
reloadUpdate();
} }
/** /**

View File

@ -151,7 +151,7 @@ public class TabListListener {
final ScheduledTask task = plugin.getServer().getScheduler() final ScheduledTask task = plugin.getServer().getScheduler()
.buildTask(plugin, () -> plugin.getPlaceholderManager().fetchPlaceholders(joined.getUniqueId(), group.getTextsWithPlaceholders())) .buildTask(plugin, () -> plugin.getPlaceholderManager().fetchPlaceholders(joined.getUniqueId(), group.getTextsWithPlaceholders()))
.delay(100, TimeUnit.MILLISECONDS) .delay(10, TimeUnit.MILLISECONDS)
.repeat(50, TimeUnit.MILLISECONDS) .repeat(50, TimeUnit.MILLISECONDS)
.schedule(); .schedule();