mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Fixes to /tpall and /tpaall, update locales
This commit is contained in:
1 parent
5552db2de0
commit
85f8fe9a50
4 files changed
+19
-7
No files matched your search
@@ -95,11 +95,10 @@ public class Cache {
|
|||||||
public void updateOnlinePlayerList(@NotNull HuskHomes plugin, @NotNull OnlineUser requester) {
|
public void updateOnlinePlayerList(@NotNull HuskHomes plugin, @NotNull OnlineUser requester) {
|
||||||
if (plugin.getSettings().crossServer) {
|
if (plugin.getSettings().crossServer) {
|
||||||
assert plugin.getNetworkMessenger() != null;
|
assert plugin.getNetworkMessenger() != null;
|
||||||
CompletableFuture.runAsync(() -> plugin.getNetworkMessenger().
|
plugin.getNetworkMessenger().getOnlinePlayerNames(requester).thenAccept(returnedPlayerList -> {
|
||||||
getOnlinePlayerNames(requester).thenAcceptAsync(returnedPlayerList -> {
|
players.clear();
|
||||||
players.clear();
|
players.addAll(List.of(returnedPlayerList));
|
||||||
players.addAll(List.of(returnedPlayerList));
|
});
|
||||||
}));
|
|
||||||
} else {
|
} else {
|
||||||
players.clear();
|
players.clear();
|
||||||
players.addAll(plugin.getOnlinePlayers().stream().map(onlineUser -> onlineUser.username).toList());
|
players.addAll(plugin.getOnlinePlayers().stream().map(onlineUser -> onlineUser.username).toList());
|
||||||
|
|||||||
@@ -15,12 +15,18 @@ public class TpAllCommand extends CommandBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
||||||
|
if (args.length != 0) {
|
||||||
|
plugin.getLocales().getLocale("error_invalid_syntax", "/tpaall")
|
||||||
|
.ifPresent(onlineUser::sendMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Update cached players
|
// Update cached players
|
||||||
plugin.getCache().updateOnlinePlayerList(plugin, onlineUser);
|
plugin.getCache().updateOnlinePlayerList(plugin, onlineUser);
|
||||||
|
|
||||||
// Determine players to teleport
|
// Determine players to teleport
|
||||||
final List<String> players = plugin.getCache().players.stream()
|
final List<String> players = plugin.getCache().players.stream()
|
||||||
.filter(userName -> !userName.equals(onlineUser.username)).toList();
|
.filter(userName -> !userName.equalsIgnoreCase(onlineUser.username)).toList();
|
||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
plugin.getLocales().getLocale("error_no_players_online").ifPresent(onlineUser::sendMessage);
|
plugin.getLocales().getLocale("error_no_players_online").ifPresent(onlineUser::sendMessage);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -19,12 +19,18 @@ public class TpaAllCommand extends CommandBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
||||||
|
if (args.length != 0) {
|
||||||
|
plugin.getLocales().getLocale("error_invalid_syntax", "/tpaall")
|
||||||
|
.ifPresent(onlineUser::sendMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Update cached players
|
// Update cached players
|
||||||
plugin.getCache().updateOnlinePlayerList(plugin, onlineUser);
|
plugin.getCache().updateOnlinePlayerList(plugin, onlineUser);
|
||||||
|
|
||||||
// Determine players to send teleport requests to
|
// Determine players to send teleport requests to
|
||||||
final List<String> players = plugin.getCache().players.stream()
|
final List<String> players = plugin.getCache().players.stream()
|
||||||
.filter(userName -> !userName.equals(onlineUser.username)).toList();
|
.filter(userName -> !userName.equalsIgnoreCase(onlineUser.username)).toList();
|
||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
plugin.getLocales().getLocale("error_no_players_online").ifPresent(onlineUser::sendMessage);
|
plugin.getLocales().getLocale("error_no_players_online").ifPresent(onlineUser::sendMessage);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ error_no_homes_set_other: '[Error:](#ff3300) [%1% has not set any homes!](#ff7e5
|
|||||||
error_home_invalid_other: '[Error:](#ff3300) [%1% does not have a home set named "%2%"](#ff7e5e)'
|
error_home_invalid_other: '[Error:](#ff3300) [%1% does not have a home set named "%2%"](#ff7e5e)'
|
||||||
error_edit_home_maximum_public_homes: '[Error:](#ff3300) [You can only make a maximum of %1% homes public.](#ff7e5e)'
|
error_edit_home_maximum_public_homes: '[Error:](#ff3300) [You can only make a maximum of %1% homes public.](#ff7e5e)'
|
||||||
error_illegal_target_coordinates: '[Error:](#ff3300) [Cancelled teleport as it exceeds the possible game world limits.](#ff7e5e)'
|
error_illegal_target_coordinates: '[Error:](#ff3300) [Cancelled teleport as it exceeds the possible game world limits.](#ff7e5e)'
|
||||||
|
error_no_players_online: '[Error:](#ff3300) [There are no players online who could teleport to you.](#ff7e5e)'
|
||||||
|
|
||||||
home_command_description: 'Teleport to one of your homes'
|
home_command_description: 'Teleport to one of your homes'
|
||||||
sethome_command_description: 'Set a new home with given name'
|
sethome_command_description: 'Set a new home with given name'
|
||||||
|
|||||||
Reference in new issue
Block a user