Some more encapsulation

This commit is contained in:
Daniil Z committed 2021-03-01 21:05:59 +03:00
1 parent afafcee2bb
commit 45f99cacf6
8 files changed
+33 -17

No files matched your search

@@ -222,7 +222,7 @@ public class EdithomeCommand extends CommandBase implements TabCompleter {
}
if (args.length == 1) {
final List<String> tabCompletions = new ArrayList<>();
StringUtil.copyPartialMatches(args[0], HomeCommand.Tab.homeTabCache.get(p.getUniqueId()), tabCompletions);
StringUtil.copyPartialMatches(args[0], HomeCommand.Tab.getHomeTabCache().get(p.getUniqueId()), tabCompletions);
Collections.sort(tabCompletions);
return tabCompletions;
} else if (args.length == 2) {
@@ -49,7 +49,7 @@ public class HomeCommand extends CommandBase {
// TODO Remove
// This HashMap stores a cache of a player's homes that is displayed when a user presses TAB.
// Owner UUID, Home Name
public static Map<UUID, List<String>> homeTabCache = new HashMap<>();
private static Map<UUID, List<String>> homeTabCache = new HashMap<>();
// This method updates a player's home cache.
public static void updatePlayerHomeCache(Player p) {
@@ -85,5 +85,9 @@ public class HomeCommand extends CommandBase {
return Collections.emptyList();
}
}
public static Map<UUID, List<String>> getHomeTabCache() {
return homeTabCache;
}
}
}
@@ -11,8 +11,8 @@ public class SpawnCommand extends CommandBase {
@Override
protected boolean onCommand(Player p, Command command, String label, String[] args) {
if (HuskHomes.getSettings().doSpawnCommand()) {
if (TeleportManager.spawnLocation != null) {
TeleportManager.queueTimedTeleport(p, TeleportManager.spawnLocation);
if (TeleportManager.getSpawnLocation() != null) {
TeleportManager.queueTimedTeleport(p, TeleportManager.getSpawnLocation());
} else {
MessageManager.sendMessage(p, "error_spawn_undefined");
}