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)")
|
@Comment("Whether to enable the Plugin Message API (allows backend plugins to perform certain operations)")
|
||||||
private boolean enablePluginMessageApi = true;
|
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).",
|
@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',",
|
"• Labels can be fully custom or built-in (one of 'bug_report', 'community_guidelines', 'support', 'status',",
|
||||||
" 'feedback', 'community', 'website', 'forums', 'news', or 'announcements').",
|
" 'feedback', 'community', 'website', 'forums', 'news', or 'announcements').",
|
||||||
|
@ -433,6 +433,7 @@ public class PlayerTabList {
|
|||||||
if (!tabPlayer.isLoaded()) {
|
if (!tabPlayer.isLoaded()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final boolean bypass = plugin.getSettings().isForceSendingTabListPackets();
|
||||||
players.values()
|
players.values()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(TabPlayer::isLoaded)
|
.filter(TabPlayer::isLoaded)
|
||||||
@ -444,7 +445,7 @@ public class PlayerTabList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Component lastDisplayName = displayNameOptional.get();
|
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);
|
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
|
* Update the TAB list for all players when a plugin or proxy reload is performed
|
||||||
*/
|
*/
|
||||||
public void reloadUpdate() {
|
public void reloadUpdate() {
|
||||||
|
taskManager.cancelAllTasks();
|
||||||
plugin.getTabGroups().getGroups().forEach(taskManager::updatePeriodically);
|
plugin.getTabGroups().getGroups().forEach(taskManager::updatePeriodically);
|
||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -46,8 +46,6 @@ public class TaskManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void updatePeriodically(@NotNull Group group) {
|
protected void updatePeriodically(@NotNull Group group) {
|
||||||
cancelTasks(group);
|
|
||||||
|
|
||||||
ScheduledTask headerFooterTask = null;
|
ScheduledTask headerFooterTask = null;
|
||||||
ScheduledTask updateTask = null;
|
ScheduledTask updateTask = null;
|
||||||
ScheduledTask latencyTask;
|
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