mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 14:38:53 +00:00
Prefer using Collections.emptyList() rather than new ArrayList
This commit is contained in:
6 files changed
+14
-13
No files matched your search
@@ -218,7 +218,7 @@ public class EdithomeCommand extends CommandBase implements TabCompleter {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
Player p = (Player) sender;
|
||||
if (!p.hasPermission("huskhomes.edithome")) {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (args.length == 1) {
|
||||
final List<String> tabCompletions = new ArrayList<>();
|
||||
@@ -236,7 +236,7 @@ public class EdithomeCommand extends CommandBase implements TabCompleter {
|
||||
}
|
||||
return editHomeOptions;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class EditwarpCommand extends CommandBase implements TabCompleter {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
Player p = (Player) sender;
|
||||
if (!p.hasPermission("huskhomes.editwarp")) {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (args.length == 1) {
|
||||
final List<String> tabCompletions = new ArrayList<>();
|
||||
@@ -175,7 +175,7 @@ public class EditwarpCommand extends CommandBase implements TabCompleter {
|
||||
editWarpOptions.add("description");
|
||||
return editWarpOptions;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class HomeCommand extends CommandBase {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
Player p = (Player) sender;
|
||||
if (!sender.hasPermission("huskhomes.home")) {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (args.length == 1) {
|
||||
final List<String> tabCompletions = new ArrayList<>();
|
||||
@@ -74,7 +74,7 @@ public class HomeCommand extends CommandBase {
|
||||
List<String> homes = homeTabCache.get(p.getUniqueId());
|
||||
if (homes == null) {
|
||||
updatePlayerHomeCache(p);
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[0], homes, tabCompletions);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class HomeCommand extends CommandBase {
|
||||
|
||||
return tabCompletions;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class HuskhomesCommand extends CommandBase implements TabCompleter {
|
||||
|
||||
return tabCompletions;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class PublichomeCommand extends CommandBase implements TabCompleter {
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
if (!sender.hasPermission("huskhomes.publichome")) {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (args.length == 1) {
|
||||
final List<String> sortedHomeNames = new ArrayList<>();
|
||||
@@ -75,7 +75,7 @@ public class PublichomeCommand extends CommandBase implements TabCompleter {
|
||||
return finalCompletions;
|
||||
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class WarpCommand extends CommandBase {
|
||||
|
||||
@@ -43,7 +44,7 @@ public class WarpCommand extends CommandBase {
|
||||
|
||||
// TODO Remove
|
||||
// Cached HashMap of warps
|
||||
public static final HashSet<String> warpsTabCache = new HashSet<>();
|
||||
public static final Set<String> warpsTabCache = new HashSet<>();
|
||||
|
||||
// Updates the public home cache
|
||||
public static void updateWarpsTabCache() {
|
||||
@@ -57,7 +58,7 @@ public class WarpCommand extends CommandBase {
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
if (!sender.hasPermission("huskhomes.warp")) {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (args.length == 1) {
|
||||
final List<String> tabCompletions = new ArrayList<>();
|
||||
@@ -69,7 +70,7 @@ public class WarpCommand extends CommandBase {
|
||||
return tabCompletions;
|
||||
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user