forked from Upstream/Velocitab
Fixed tablist problem for some mods
This commit is contained in:
parent
b4746dd483
commit
59c8b08290
@ -97,6 +97,9 @@ public class Settings implements ConfigValidator {
|
||||
@Comment("Whether to enable the Plugin Message API (allows backend plugins to perform certain operations)")
|
||||
private boolean enablePluginMessageApi = true;
|
||||
|
||||
@Comment("Whether to force sending tab list packets to all players, even if a packet for that action has already been sent. This could fix issues with some mods.")
|
||||
private boolean forceSendingTabListPackets = false;
|
||||
|
||||
@Comment({"A list of links that will be sent to display on player pause menus (Minecraft 1.21+ clients only).",
|
||||
"• Labels can be fully custom or built-in (one of 'bug_report', 'community_guidelines', 'support', 'status',",
|
||||
" 'feedback', 'community', 'website', 'forums', 'news', or 'announcements').",
|
||||
|
@ -433,6 +433,7 @@ public class PlayerTabList {
|
||||
if (!tabPlayer.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
final boolean bypass = plugin.getSettings().isForceSendingTabListPackets();
|
||||
players.values()
|
||||
.stream()
|
||||
.filter(TabPlayer::isLoaded)
|
||||
@ -444,7 +445,7 @@ public class PlayerTabList {
|
||||
}
|
||||
|
||||
final Component lastDisplayName = displayNameOptional.get();
|
||||
if (entry.getDisplayNameComponent().isEmpty() || !lastDisplayName.equals(entry.getDisplayNameComponent().get())) {
|
||||
if (bypass || entry.getDisplayNameComponent().isEmpty() || !lastDisplayName.equals(entry.getDisplayNameComponent().get())) {
|
||||
entry.setDisplayName(lastDisplayName);
|
||||
}
|
||||
}));
|
||||
@ -488,6 +489,7 @@ public class PlayerTabList {
|
||||
* Update the TAB list for all players when a plugin or proxy reload is performed
|
||||
*/
|
||||
public void reloadUpdate() {
|
||||
taskManager.cancelAllTasks();
|
||||
plugin.getTabGroups().getGroups().forEach(taskManager::updatePeriodically);
|
||||
if (players.isEmpty()) {
|
||||
return;
|
||||
|
@ -46,8 +46,6 @@ public class TaskManager {
|
||||
}
|
||||
|
||||
protected void updatePeriodically(@NotNull Group group) {
|
||||
cancelTasks(group);
|
||||
|
||||
ScheduledTask headerFooterTask = null;
|
||||
ScheduledTask updateTask = null;
|
||||
ScheduledTask latencyTask;
|
||||
@ -120,13 +118,4 @@ public class TaskManager {
|
||||
});
|
||||
}
|
||||
|
||||
private void cancelTasks(@NotNull Group group) {
|
||||
groupTasks.entrySet()
|
||||
.stream()
|
||||
.filter(entry -> entry.getKey().name().equals(group.name()))
|
||||
.map(Map.Entry::getValue)
|
||||
.findFirst().ifPresent(GroupTasks::cancel);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user