Lower tab completion cache time and fix "Invalid player" message for /plot kick

This commit is contained in:
Alexander Söderberg 2020-06-24 13:44:06 +02:00
parent f69cc5cc98
commit efab6e92f7
No known key found for this signature in database
GPG key ID: C0207FF7EA146678
2 changed files with 6 additions and 6 deletions

View file

@ -72,12 +72,12 @@ public class Kick extends SubCommand {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
} else if (throwable != null || uuids.isEmpty()) { } else if (throwable != null || uuids.isEmpty()) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
} else { } else {
Set<PlotPlayer> players = new HashSet<>(); Set<PlotPlayer<?>> players = new HashSet<>();
for (UUID uuid : uuids) { for (UUID uuid : uuids) {
if (uuid == DBFunc.EVERYONE) { if (uuid == DBFunc.EVERYONE) {
for (PlotPlayer pp : plot.getPlayersInPlot()) { for (PlotPlayer<?> pp : plot.getPlayersInPlot()) {
if (pp == player || Permissions if (pp == player || Permissions
.hasPermission(pp, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) { .hasPermission(pp, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) {
continue; continue;
@ -86,7 +86,7 @@ public class Kick extends SubCommand {
} }
continue; continue;
} }
PlotPlayer pp = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); PlotPlayer<?> pp = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid);
if (pp != null) { if (pp != null) {
players.add(pp); players.add(pp);
} }
@ -96,7 +96,7 @@ public class Kick extends SubCommand {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
return; return;
} }
for (PlotPlayer player2 : players) { for (PlotPlayer<?> player2 : players) {
if (!plot.equals(player2.getCurrentPlot())) { if (!plot.equals(player2.getCurrentPlot())) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
return; return;

View file

@ -56,7 +56,7 @@ import java.util.stream.Collectors;
public class TabCompletions { public class TabCompletions {
private final Cache<String, List<String>> cachedCompletionValues = private final Cache<String, List<String>> cachedCompletionValues =
CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(); CacheBuilder.newBuilder().expireAfterWrite(15, TimeUnit.SECONDS).build();
private final Command booleanTrueCompletion = new Command(null, false, "true", "", private final Command booleanTrueCompletion = new Command(null, false, "true", "",
RequiredType.NONE, null) {}; RequiredType.NONE, null) {};