mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Use interfaces rather than classes
This commit is contained in:
9 files changed
+41
-37
No files matched your search
@@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class HomeCommand extends CommandBase {
|
||||
@@ -32,7 +33,7 @@ public class HomeCommand extends CommandBase {
|
||||
MessageManager.sendMessage(p, "error_home_invalid", homeName);
|
||||
}
|
||||
} else {
|
||||
ArrayList<Home> homes = DataManager.getPlayerHomes(p.getName());
|
||||
List<Home> homes = DataManager.getPlayerHomes(p.getName());
|
||||
if (homes != null) {
|
||||
if (homes.size() == 1) {
|
||||
// Teleport the player if they only have one home
|
||||
@@ -52,13 +53,13 @@ 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 HashMap<UUID, ArrayList<String>> homeTabCache = new HashMap<>();
|
||||
public static Map<UUID, List<String>> homeTabCache = new HashMap<>();
|
||||
|
||||
// This method updates a player's home cache.
|
||||
public static void updatePlayerHomeCache(Player p) {
|
||||
UUID uuid = p.getUniqueId();
|
||||
ArrayList<Home> playerHomes = DataManager.getPlayerHomes(p.getName());
|
||||
ArrayList<String> homeNames = new ArrayList<>();
|
||||
List<Home> playerHomes = DataManager.getPlayerHomes(p.getName());
|
||||
List<String> homeNames = new ArrayList<>();
|
||||
for (Home home : playerHomes) {
|
||||
homeNames.add(home.getName());
|
||||
}
|
||||
@@ -74,7 +75,7 @@ public class HomeCommand extends CommandBase {
|
||||
if (args.length == 1) {
|
||||
final List<String> tabCompletions = new ArrayList<>();
|
||||
|
||||
ArrayList<String> homes = homeTabCache.get(p.getUniqueId());
|
||||
List<String> homes = homeTabCache.get(p.getUniqueId());
|
||||
if (homes == null) {
|
||||
updatePlayerHomeCache(p);
|
||||
return new ArrayList<>();
|
||||
|
||||
@@ -126,7 +126,7 @@ public class HuskhomesCommand extends CommandBase implements TabCompleter {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
if (args.length == 1) {
|
||||
final List<String> tabCompletions = new ArrayList<>();
|
||||
ArrayList<String> tabOptions = new ArrayList<>();
|
||||
List<String> tabOptions = new ArrayList<>();
|
||||
tabOptions.add("about");
|
||||
tabOptions.add("reload");
|
||||
tabOptions.add("update");
|
||||
|
||||
@@ -15,13 +15,14 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PublichomeCommand extends CommandBase implements TabCompleter {
|
||||
|
||||
// TODO Remove it
|
||||
// Cached HashMap of public homes
|
||||
// HomeName, OwnerName
|
||||
public static final HashMap<String,String> publicHomeTabCache = new HashMap<>();
|
||||
private static final Map<String,String> publicHomeTabCache = new HashMap<>();
|
||||
|
||||
// Updates the public home cache
|
||||
public static void updatePublicHomeTabCache() {
|
||||
|
||||
@@ -88,7 +88,7 @@ public class TpCommand extends CommandBase {
|
||||
public static class Tab implements TabCompleter {
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
ArrayList<String> players = new ArrayList<>();
|
||||
List<String> players = new ArrayList<>();
|
||||
if (args.length == 0 || args.length == 1) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!VanishChecker.isVanished(p) && !(p.getName().equals(sender.getName()))) {
|
||||
|
||||
Reference in new issue
Block a user