TAB list logic tweaks

This commit is contained in:
William committed 2023-03-23 02:09:21 +00:00
1 parent 9f4fb11dda
commit efdf8660b1
3 files changed
+16 -17

No files matched your search

@@ -12,7 +12,7 @@ public interface UserListTabProvider extends TabProvider {
@Override @Override
@Nullable @Nullable
default List<String> suggest(@NotNull CommandUser user, @NotNull String[] args) { default List<String> suggest(@NotNull CommandUser user, @NotNull String[] args) {
return args.length < 2 ? getPlugin().getPlayerList() : List.of(); return args.length < 2 ? getPlugin().getPlayerList() : null;
} }
@NotNull @NotNull
@@ -2,7 +2,6 @@ package net.william278.huskhomes.listener;
import de.themoep.minedown.adventure.MineDown; import de.themoep.minedown.adventure.MineDown;
import net.william278.huskhomes.HuskHomes; import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.network.Broker;
import net.william278.huskhomes.network.Message; import net.william278.huskhomes.network.Message;
import net.william278.huskhomes.network.Payload; import net.william278.huskhomes.network.Payload;
import net.william278.huskhomes.position.Position; import net.william278.huskhomes.position.Position;
@@ -40,25 +39,24 @@ public class EventListener {
if (plugin.getSettings().isCrossServer()) { if (plugin.getSettings().isCrossServer()) {
this.handleInboundTeleport(onlineUser); this.handleInboundTeleport(onlineUser);
// Update caches // Send a player list update to other servers
this.sendPlayerListUpdates(onlineUser);
// Request updated player lists from other servers
if (plugin.getOnlineUsers().size() == 1) { if (plugin.getOnlineUsers().size() == 1) {
plugin.runLater(() -> {
plugin.getGlobalPlayerList().clear();
Message.builder()
.type(Message.Type.REQUEST_PLAYER_LIST)
.scope(Message.Scope.SERVER)
.target(Message.TARGET_ALL)
.build().send(plugin.getMessenger(), onlineUser);
}, 40L);
// Update caches
plugin.getManager().homes().updatePublicHomeCache(); plugin.getManager().homes().updatePublicHomeCache();
plugin.getManager().warps().updateWarpCache(); plugin.getManager().warps().updateWarpCache();
} }
// Update the player list
plugin.runLater(() -> {
// Send a player list update to other servers
sendPlayerListUpdates(onlineUser);
// Request updated player lists from other servers
plugin.getGlobalPlayerList().clear();
Message.builder()
.scope(Message.Scope.SERVER)
.target(Message.TARGET_ALL)
.type(Message.Type.REQUEST_PLAYER_LIST)
.build().send(plugin.getMessenger(), onlineUser);
}, plugin.getSettings().getBrokerType() == Broker.Type.PLUGIN_MESSAGE ? 40L : 0L);
} }
// Cache this user's homes // Cache this user's homes
@@ -30,6 +30,7 @@ public class Payload {
@Nullable @Nullable
@Expose @Expose
@SerializedName("string_list")
private List<String> stringList; private List<String> stringList;
/** /**