Fix player cache not being updated on single-server mode, make #getNetworkMessenger @NotNull

This commit is contained in:
William committed 2022-08-30 18:15:26 +01:00
1 parent a952a372cc
commit 90291196f9
9 files changed
+31 -30

No files matched your search

@@ -22,7 +22,7 @@ public class TpAllCommand extends CommandBase {
}
// Determine players to teleport and teleport them
plugin.getCache().fetchAndCacheGlobalPlayerList(plugin, onlineUser).thenAccept(fetchedPlayers -> {
plugin.getCache().updatePlayerListCache(plugin, onlineUser).thenAccept(fetchedPlayers -> {
final List<String> players = fetchedPlayers.stream()
.filter(userName -> !userName.equalsIgnoreCase(onlineUser.username)).toList();
if (players.isEmpty()) {
@@ -38,7 +38,7 @@ public class TpCommand extends CommandBase implements TabCompletable, ConsoleExe
: onlineUser.username : onlineUser.username);
// Find the online user to teleport
plugin.getCache().fetchAndCacheGlobalPlayerList(plugin, onlineUser).join();
plugin.getCache().updatePlayerListCache(plugin, onlineUser).join();
final String playerToTeleport = plugin.getCache().players.stream()
.filter(user -> user.equalsIgnoreCase(targetPlayerToTeleport)).findFirst()
.or(() -> plugin.getCache().players.stream()
@@ -26,7 +26,7 @@ public class TpaAllCommand extends CommandBase {
}
// Determine players to teleport and teleport them
plugin.getCache().fetchAndCacheGlobalPlayerList(plugin, onlineUser).thenAccept(playerList -> {
plugin.getCache().updatePlayerListCache(plugin, onlineUser).thenAccept(playerList -> {
final List<String> players = plugin.getCache().players.stream()
.filter(userName -> !userName.equalsIgnoreCase(onlineUser.username)).toList();
if (players.isEmpty()) {