1.7.0 beta 1

This commit is contained in:
tylermurphy534 2022-10-31 23:28:45 -04:00
parent 1325e042a6
commit 7530fe5e2d
31 changed files with 372 additions and 294 deletions

View file

@ -19,6 +19,9 @@
package net.tylermurphy.hideAndSeek;
import net.tylermurphy.hideAndSeek.command.*;
import net.tylermurphy.hideAndSeek.command.location.*;
import net.tylermurphy.hideAndSeek.command.map.*;
import net.tylermurphy.hideAndSeek.configuration.Config;
import net.tylermurphy.hideAndSeek.configuration.Items;
import net.tylermurphy.hideAndSeek.configuration.Localization;
@ -26,13 +29,13 @@ import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.database.Database;
import net.tylermurphy.hideAndSeek.game.*;
import net.tylermurphy.hideAndSeek.game.util.Status;
import net.tylermurphy.hideAndSeek.util.CommandHandler;
import net.tylermurphy.hideAndSeek.command.util.CommandGroup;
import net.tylermurphy.hideAndSeek.game.listener.*;
import net.tylermurphy.hideAndSeek.util.PAPIExpansion;
import net.tylermurphy.hideAndSeek.util.TabCompleter;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
@ -43,8 +46,8 @@ import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static net.tylermurphy.hideAndSeek.configuration.Config.exitPosition;
import static net.tylermurphy.hideAndSeek.configuration.Config.exitWorld;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Main extends JavaPlugin implements Listener {
@ -56,6 +59,7 @@ public class Main extends JavaPlugin implements Listener {
private Disguiser disguiser;
private EntityHider entityHider;
private Game game;
private CommandGroup commandGroup;
public void onEnable() {
Main.instance = this;
@ -72,9 +76,36 @@ public class Main extends JavaPlugin implements Listener {
this.entityHider = new EntityHider(this, EntityHider.Policy.BLACKLIST);
this.registerListeners();
CommandHandler.registerCommands();
this.commandGroup = new CommandGroup("hs",
new About(),
new Debug(),
new Help(),
new Reload(),
new Join(),
new Leave(),
new Start(),
new Stop(),
new CommandGroup("map",
new CommandGroup("set",
new SetLobbyLocation(),
new SetSpawnLocation(),
new SetSeekerLobbyLocation(),
new SetBorder(),
new SetBounds()
),
new AddMap(),
new RemoveMap(),
new ListMaps(),
new SetMap(),
new Setup(),
new SaveMap()
),
new SetExitLocation(),
new Top(),
new Wins()
);
game = new Game(game.getCurrentMap(), board);
game = new Game(null, board);
getServer().getScheduler().runTaskTimer(this, this::onTick,0,1).getTaskId();
@ -102,7 +133,7 @@ public class Main extends JavaPlugin implements Listener {
}
private void onTick() {
if(game.getStatus() == Status.ENDED) game = new Game(board);
if(game.getStatus() == Status.ENDED) game = new Game(game.getCurrentMap(), board);
game.onTick();
disguiser.check();
}
@ -130,11 +161,15 @@ public class Main extends JavaPlugin implements Listener {
}
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
return CommandHandler.handleCommand(sender, args);
if (!(sender instanceof Player)) {
sender.sendMessage(errorPrefix + message("COMMAND_PLAYER_ONLY"));
return true;
}
return commandGroup.handleCommand((Player)sender, "", args);
}
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
return TabCompleter.handleTabComplete(sender, args);
return commandGroup.handleTabComplete(sender, args);
}
public static Main getInstance() {

View file

@ -19,12 +19,13 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.command.util.Command;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.List;
public class About implements ICommand {
public class About extends Command {
public void execute(Player sender, String[] args) {
sender.sendMessage(

View file

@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.command;
import com.cryptomorin.xseries.XMaterial;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.PlayerLoader;
import net.tylermurphy.hideAndSeek.game.util.Status;
@ -21,7 +22,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Debug implements ICommand {
public class Debug extends Command {
private static final Map<Player, Map<Integer, Consumer<Player>>> debugMenuFunctions = new HashMap<>();

View file

@ -20,20 +20,21 @@
package net.tylermurphy.hideAndSeek.command;
import net.md_5.bungee.api.ChatColor;
import net.tylermurphy.hideAndSeek.util.CommandHandler;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.command.util.CommandGroup;
import org.bukkit.entity.Player;
import java.util.List;
public class Help implements ICommand {
public class Help extends Command {
public void execute(Player sender, String[] args) {
StringBuilder message = new StringBuilder();
for(ICommand command : CommandHandler.COMMAND_REGISTER.values()) {
message.append(String.format("%s/hs %s%s %s%s\n %s%s%s", ChatColor.AQUA, ChatColor.WHITE, command.getLabel().toLowerCase(), ChatColor.BLUE, command.getUsage(), ChatColor.GRAY, ChatColor.ITALIC, command.getDescription() + "\n"));
}
message = new StringBuilder(message.substring(0, message.length() - 1));
sender.sendMessage(message.toString());
// StringBuilder message = new StringBuilder();
// for(Command command : CommandGroup.COMMAND_REGISTER.values()) {
// message.append(String.format("%s/hs %s%s %s%s\n %s%s%s", ChatColor.AQUA, ChatColor.WHITE, command.getLabel().toLowerCase(), ChatColor.BLUE, command.getUsage(), ChatColor.GRAY, ChatColor.ITALIC, command.getDescription() + "\n"));
// }
// message = new StringBuilder(message.substring(0, message.length() - 1));
// sender.sendMessage(message.toString());
}
public String getLabel() {

View file

@ -20,6 +20,7 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -28,7 +29,7 @@ import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Join implements ICommand {
public class Join extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().checkCurrentMap()) {

View file

@ -20,6 +20,7 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -28,7 +29,7 @@ import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Leave implements ICommand {
public class Leave extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().checkCurrentMap()) {

View file

@ -20,6 +20,7 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Config;
import net.tylermurphy.hideAndSeek.configuration.Items;
import net.tylermurphy.hideAndSeek.configuration.Localization;
@ -33,7 +34,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Reload implements ICommand {
public class Reload extends Command {
public void execute(Player sender, String[] args) {

View file

@ -20,7 +20,7 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.minPlayers;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Start implements ICommand {
public class Start extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().checkCurrentMap()) {

View file

@ -20,17 +20,17 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.abortPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Stop implements ICommand {
public class Stop extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().checkCurrentMap()) {

View file

@ -20,6 +20,7 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.database.util.PlayerInfo;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -30,7 +31,7 @@ import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Top implements ICommand {
public class Top extends Command {
public void execute(Player sender, String[] args) {
int page;

View file

@ -20,6 +20,7 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.database.util.PlayerInfo;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -31,7 +32,7 @@ import java.util.UUID;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Wins implements ICommand {
public class Wins extends Command {
public void execute(Player sender, String[] args) {
Main.getInstance().getServer().getScheduler().runTaskAsynchronously(Main.getInstance(), () -> {

View file

@ -19,18 +19,16 @@
package net.tylermurphy.hideAndSeek.command.location;
import net.tylermurphy.hideAndSeek.command.ICommand;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
public class SetExitLocation implements ICommand {
public class SetExitLocation extends Command {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.EXIT, null, map -> {

View file

@ -19,7 +19,7 @@
package net.tylermurphy.hideAndSeek.command.location;
import net.tylermurphy.hideAndSeek.command.ICommand;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
@ -28,9 +28,7 @@ import org.bukkit.entity.Player;
import java.util.List;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
public class SetLobbyLocation implements ICommand {
public class SetLobbyLocation extends Command {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.LOBBY, args[0], map -> {
@ -39,7 +37,7 @@ public class SetLobbyLocation implements ICommand {
}
public String getLabel() {
return "setlobby";
return "lobby";
}
public String getUsage() {

View file

@ -1,6 +1,6 @@
package net.tylermurphy.hideAndSeek.command.location;
import net.tylermurphy.hideAndSeek.command.ICommand;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
@ -11,7 +11,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class SetSeekerLobbyLocation implements ICommand {
public class SetSeekerLobbyLocation extends Command {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.SEEKER, args[0], map -> {
@ -26,7 +26,7 @@ public class SetSeekerLobbyLocation implements ICommand {
}
public String getLabel() {
return "setseekerlobby";
return "seekerlobby";
}
public String getUsage() {

View file

@ -19,7 +19,7 @@
package net.tylermurphy.hideAndSeek.command.location;
import net.tylermurphy.hideAndSeek.command.ICommand;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class SetSpawnLocation implements ICommand {
public class SetSpawnLocation extends Command {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.GAME, args[0], map -> {
@ -58,7 +58,7 @@ public class SetSpawnLocation implements ICommand {
}
public String getLabel() {
return "setspawn";
return "spawn";
}
public String getUsage() {

View file

@ -1,12 +1,12 @@
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -14,7 +14,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class AddMap implements ICommand {
public class AddMap extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
@ -33,7 +33,7 @@ public class AddMap implements ICommand {
}
public String getLabel() {
return "addmap";
return "add";
}
public String getUsage() {

View file

@ -1,5 +1,6 @@
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import org.bukkit.ChatColor;
@ -12,7 +13,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class ListMaps implements ICommand {
public class ListMaps extends Command {
public void execute(Player sender, String[] args) {
Collection<Map> maps = Maps.getAllMaps();
@ -28,7 +29,7 @@ public class ListMaps implements ICommand {
}
public String getLabel() {
return "listmaps";
return "list";
}
public String getUsage() {

View file

@ -1,6 +1,7 @@
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
@ -13,7 +14,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class RemoveMap implements ICommand {
public class RemoveMap extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
@ -31,7 +32,7 @@ public class RemoveMap implements ICommand {
}
public String getLabel() {
return "removemap";
return "remove";
}
public String getUsage() {

View file

@ -17,9 +17,10 @@
*
*/
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
@ -33,7 +34,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class SaveMap implements ICommand {
public class SaveMap extends Command {
public static boolean runningBackup = false;
@ -75,7 +76,7 @@ public class SaveMap implements ICommand {
}
public String getLabel() {
return "saveMap";
return "save";
}
public String getUsage() {

View file

@ -17,16 +17,15 @@
*
*/
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@ -34,7 +33,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class SetBorder implements ICommand {
public class SetBorder extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
@ -59,15 +58,15 @@ public class SetBorder implements ICommand {
return;
}
int num,delay,change;
try { num = Integer.parseInt(args[0]); } catch (Exception e) {
try { num = Integer.parseInt(args[1]); } catch (Exception e) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[0]));
return;
}
try { delay = Integer.parseInt(args[1]); } catch (Exception e) {
try { delay = Integer.parseInt(args[2]); } catch (Exception e) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[1]));
return;
}
try { change = Integer.parseInt(args[2]); } catch (Exception e) {
try { change = Integer.parseInt(args[3]); } catch (Exception e) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[2]));
return;
}
@ -92,7 +91,7 @@ public class SetBorder implements ICommand {
}
public String getLabel() {
return "setBorder";
return "border";
}
public String getUsage() {

View file

@ -17,9 +17,10 @@
*
*/
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
@ -31,7 +32,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class SetBounds implements ICommand {
public class SetBounds extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
@ -90,7 +91,7 @@ public class SetBounds implements ICommand {
}
public String getLabel() {
return "setBounds";
return "bounds";
}
public String getUsage() {

View file

@ -1,6 +1,7 @@
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
@ -12,7 +13,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class SetMap implements ICommand {
public class SetMap extends Command {
public void execute(Player sender, String[] args) {
@ -45,7 +46,7 @@ public class SetMap implements ICommand {
}
public String getLabel() {
return "setmap";
return "goto";
}
public String getUsage() {

View file

@ -17,9 +17,10 @@
*
*/
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import org.bukkit.entity.Player;
@ -31,7 +32,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Setup implements ICommand {
public class Setup extends Command {
public void execute(Player sender, String[] args) {
@ -42,19 +43,19 @@ public class Setup implements ICommand {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
return;
}
if (map.getSpawn().getWorld() == null || map.getSpawn().getBlockX() == 0 && map.getSpawn().getBlockY() == 0 && map.getSpawn().getBlockZ() == 0) {
if (map.getSpawn().getBlockX() == 0 && map.getSpawn().getBlockY() == 0 && map.getSpawn().getBlockZ() == 0 || !Map.worldExists(map.getLobbyName())) {
msg = msg + "\n" + message("SETUP_GAME");
count++;
}
if (map.getLobby().getWorld() == null || map.getLobby().getBlockX() == 0 && map.getLobby().getBlockY() == 0 && map.getLobby().getBlockZ() == 0) {
if (map.getLobby().getBlockX() == 0 && map.getLobby().getBlockY() == 0 && map.getLobby().getBlockZ() == 0 || !Map.worldExists(map.getLobbyName())) {
msg = msg + "\n" + message("SETUP_LOBBY");
count++;
}
if (map.getSeekerLobby().getWorld() == null || map.getSeekerLobby().getBlockX() == 0 && map.getSeekerLobby().getBlockY() == 0 && map.getSeekerLobby().getBlockZ() == 0) {
if (map.getSeekerLobby().getBlockX() == 0 && map.getSeekerLobby().getBlockY() == 0 && map.getSeekerLobby().getBlockZ() == 0 || !Map.worldExists(map.getSeekerLobbyName())) {
msg = msg + "\n" + message("SETUP_SEEKER_LOBBY");
count++;
}
if (exitWorld == null || exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) {
if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0 || !Map.worldExists(exitWorld)) {
msg = msg + "\n" + message("SETUP_EXIT");
count++;
}
@ -63,12 +64,9 @@ public class Setup implements ICommand {
msg = msg + "\n" + message("SETUP_BOUNDS");
count++;
}
if (mapSaveEnabled) {
File destenation = new File(Main.getInstance().getWorldContainer() + File.separator + map.getGameSpawnName());
if (!destenation.exists()) {
msg = msg + "\n" + message("SETUP_SAVEMAP");
count++;
}
if (mapSaveEnabled && !Map.worldExists(map.getGameSpawnName())) {
msg = msg + "\n" + message("SETUP_SAVEMAP");
count++;
}
if (count < 1) {
sender.sendMessage(messagePrefix + message("SETUP_COMPLETE"));

View file

@ -17,23 +17,27 @@
*
*/
package net.tylermurphy.hideAndSeek.command;
package net.tylermurphy.hideAndSeek.command.util;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public interface ICommand {
public abstract class Command {
void execute(Player sender, String[] args);
String getLabel();
public abstract void execute(Player sender, String[] args);
String getUsage();
String getDescription();
public abstract String getLabel();
List<String> autoComplete(@Nullable String parameter);
public abstract String getUsage();
public abstract String getDescription();
public abstract List<String> autoComplete(@Nullable String parameter);
public boolean hasPermission(Player sender, String permission) {
return sender.hasPermission(permission+"."+getLabel());
}
}

View file

@ -0,0 +1,170 @@
/*
* This file is part of Kenshins Hide and Seek
*
* Copyright (c) 2021 Tyler Murphy.
*
* Kenshins Hide and Seek free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* he Free Software Foundation version 3.
*
* Kenshins Hide and Seek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package net.tylermurphy.hideAndSeek.command.util;
import net.tylermurphy.hideAndSeek.command.*;
import net.tylermurphy.hideAndSeek.command.map.SaveMap;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.*;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.permissionsRequired;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class CommandGroup {
private final Map<String, Object> commandRegister;
private final String label;
public CommandGroup(String label, Object... data) {
this.label = label;
this.commandRegister = new HashMap<>();
for(Object o : data) registerCommand(o);
}
public String getLabel() {
return label;
}
private void registerCommand(Object object) {
if(object instanceof Command) {
Command command = (Command) object;
if (!commandRegister.containsKey(command.getLabel())) {
commandRegister.put(command.getLabel().toLowerCase(), command);
}
} else if(object instanceof CommandGroup) {
CommandGroup group = (CommandGroup) object;
if (!commandRegister.containsKey(group.getLabel())) {
commandRegister.put(group.getLabel().toLowerCase(), group);
}
}
}
public boolean handleCommand(Player player, String permission, String[] args) {
if (args.length < 1 && permission.equals("hs") || !commandRegister.containsKey(args[0].toLowerCase()) ) {
if (permissionsRequired && !player.hasPermission("hs.about")) {
player.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED"));
} else {
new About().execute(player, null);
}
} else {
String invoke = args[0].toLowerCase();
if (!invoke.equals("about") && !invoke.equals("help") && SaveMap.runningBackup) {
player.sendMessage(errorPrefix + message("MAPSAVE_INPROGRESS"));
} else if (permissionsRequired && !player.hasPermission(permission+"."+invoke)) {
player.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED"));
} else {
try {
Object object = commandRegister.get(invoke);
if(object instanceof CommandGroup) return ((CommandGroup) object).handleCommand(player, permission+"."+this.label, Arrays.copyOfRange(args, 1, args.length));
Command command = (Command) object;
int parameters = (int) Arrays.stream(command.getUsage().split(" ")).filter(p -> p.startsWith("<") && !p.startsWith("<*")).count();
if(args.length - 1 < parameters) {
player.sendMessage(errorPrefix + message("ARGUMENT_COUNT"));
return true;
}
command.execute(player,Arrays.copyOfRange(args, 1, args.length));
} catch (Exception e) {
player.sendMessage(errorPrefix + "An error has occurred.");
e.printStackTrace();
}
}
}
return true;
}
public List<String> handleTabComplete(CommandSender sender, String[] args) {
String invoke = args[0].toLowerCase();
if (args.length == 1) {
if(sender instanceof Player) {
Player player = (Player) sender;
return new ArrayList<>(commandRegister.keySet())
.stream()
.filter(handle -> handle.toLowerCase().startsWith(invoke))
.filter(handle -> {
Object object = commandRegister.get(handle);
if (object instanceof Command) return ((Command) object).hasPermission(player, this.label);
if (object instanceof CommandGroup)
return ((CommandGroup) object).hasPermission(player, this.label);
return false;
})
.collect(Collectors.toList());
}
return commandRegister.keySet().stream().filter(handle -> handle.toLowerCase().startsWith(invoke)).collect(Collectors.toList());
} else {
if (!commandRegister.containsKey(invoke)) {
return new ArrayList<>();
} else {
Object object = commandRegister.get(invoke);
if(object instanceof CommandGroup) return ((CommandGroup) object).handleTabComplete(sender, Arrays.copyOfRange(args, 1, args.length));
Command command = (Command) object;
String[] usage = command.getUsage().split(" ");
List<String> complete;
if (args.length - 2 < usage.length) {
String parameter = usage[args.length-2];
String name = parameter.replace("<", "").replace(">", "");
complete = command.autoComplete(name);
} else {
complete = command.autoComplete(null);
}
if(complete == null) return new ArrayList<>();
else return complete;
}
}
}
private boolean hasPermission(Player player, String permission) {
for(Object object : commandRegister.values()) {
if(object instanceof Command) if(((Command) object).hasPermission(player, this.label)) return true;
if(object instanceof CommandGroup) if (((CommandGroup) object).hasPermission(player, permission+"."+this.label)) return true;
}
return false;
}
// public static void registerCommands() {
// registerCommand(new About());
// registerCommand(new Help());
// registerCommand(new Setup());
// registerCommand(new Start());
// registerCommand(new Stop());
// registerCommand(new SetSpawnLocation());
// registerCommand(new SetLobbyLocation());
// registerCommand(new SetSeekerLobbyLocation());
// registerCommand(new SetExitLocation());
// registerCommand(new SetBorder());
// registerCommand(new Reload());
// registerCommand(new SaveMap());
// registerCommand(new SetBounds());
// registerCommand(new Join());
// registerCommand(new Leave());
// registerCommand(new Top());
// registerCommand(new Wins());
// registerCommand(new Debug());
// registerCommand(new AddMap());
// registerCommand(new RemoveMap());
// registerCommand(new ListMaps());
// registerCommand(new SetMap());
// }
}

View file

@ -23,7 +23,9 @@ public class Map {
seekerLobbyPosition = new Location(null, 0, 0, 0);
private String
gameWorldName = "world";
spawnWorldName = "world",
lobbyWorldName = "world",
seekerLobbyWorldName = "world";
private int
xBoundMin = 0,
@ -57,15 +59,31 @@ public class Map {
public void setSpawn(Location pos) {
this.spawnPosition = pos;
if(pos.getWorld() != null)
this.gameWorldName = pos.getWorld().getName();
this.spawnWorldName = pos.getWorld().getName();
}
public void setLobby(Location pos) {
this.lobbyPosition = pos;
if(pos.getWorld() != null)
this.lobbyWorldName = pos.getWorld().getName();
}
public void setSeekerLobby(Location pos) {
this.seekerLobbyPosition = pos;
if(pos.getWorld() != null)
this.seekerLobbyWorldName = pos.getWorld().getName();
}
public void setSpawnName(String name) {
this.spawnWorldName = name;
}
public void setLobbyName(String name) {
this.lobbyWorldName = name;
}
public void setSeekerLobbyName(String name) {
this.seekerLobbyWorldName = name;
}
public void setWorldBorderData(int x, int z, int size, int delay, int move) {
@ -103,7 +121,7 @@ public class Map {
public Location getGameSpawn() {
if(mapSaveEnabled) {
return new Location(
Bukkit.getWorld("hs_" + gameWorldName),
Bukkit.getWorld("hs_" + spawnWorldName),
spawnPosition.getX(),
spawnPosition.getY(),
spawnPosition.getZ()
@ -114,7 +132,10 @@ public class Map {
}
public String getGameSpawnName() {
return "hs_"+gameWorldName;
if(mapSaveEnabled)
return "hs_"+ spawnWorldName;
else
return spawnWorldName;
}
public Location getSpawn() {
@ -122,21 +143,29 @@ public class Map {
}
public String getSpawnName() {
return gameWorldName;
return spawnWorldName;
}
public Location getLobby() {
return lobbyPosition;
}
public String getLobbyName() {
return lobbyWorldName;
}
public Location getSeekerLobby() {
return seekerLobbyPosition;
}
public String getSeekerLobbyName() {
return seekerLobbyWorldName;
}
public Location getGameSeekerLobby() {
if(mapSaveEnabled) {
return new Location(
Bukkit.getWorld("hs_" + gameWorldName),
Bukkit.getWorld("hs_" + getSeekerLobbyName()),
seekerLobbyPosition.getX(),
seekerLobbyPosition.getY(),
seekerLobbyPosition.getZ()
@ -203,19 +232,11 @@ public class Map {
}
public boolean isNotSetup() {
if (spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) return true;
if (lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) return true;
if (exitPosition == null || exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) return true;
if (exitPosition.getWorld() == null) {
Bukkit.getServer().createWorld(new WorldCreator(exitWorld).generator(new VoidGenerator()));
World world = Bukkit.getServer().getWorld(exitWorld);
if(world == null) return true;
}
if (seekerLobbyPosition.getBlockX() == 0 && seekerLobbyPosition.getBlockY() == 0 && seekerLobbyPosition.getBlockZ() == 0) return true;
if (mapSaveEnabled) {
File destination = new File(Main.getInstance().getWorldContainer() + File.separator + spawnPosition.getWorld().getName());
if (!destination.exists()) return true;
}
if (spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0 || !Map.worldExists(spawnWorldName)) return true;
if (lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0 || !Map.worldExists(lobbyWorldName)) return true;
if (exitPosition == null || exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0 || !Map.worldExists(exitWorld) ) return true;
if (seekerLobbyPosition.getBlockX() == 0 && seekerLobbyPosition.getBlockY() == 0 && seekerLobbyPosition.getBlockZ() == 0 || !Map.worldExists(seekerLobbyWorldName)) return true;
if (mapSaveEnabled && !Map.worldExists(getGameSpawnName())) return true;
if(isWorldBorderEnabled() &&
new Vector(spawnPosition.getX(), 0, spawnPosition.getZ()).distance(new Vector(xWorldBorder, 0, zWorldBorder)) > 100) return true;
return xBoundMin == 0 || zBoundMin == 0 || xBoundMax == 0 || zBoundMax == 0;
@ -225,4 +246,9 @@ public class Map {
return spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0;
}
public static boolean worldExists(String worldName) {
File destination = new File(Main.getInstance().getWorldContainer()+File.separator+worldName);
return destination.isDirectory();
}
}

View file

@ -60,7 +60,6 @@ public class Maps {
MAPS.clear();
for(String key : keys) {
System.out.println(key);
MAPS.put(key, parseMap(maps, key));
}
@ -71,8 +70,11 @@ public class Maps {
if(data == null) return null;
Map map = new Map(name);
map.setSpawn(setSpawn(data, "game"));
map.setSpawnName(data.getString("spawns.game.world"));
map.setLobby(setSpawn(data, "lobby"));
map.setLobbyName(data.getString("spawns.lobby.world"));
map.setSeekerLobby(setSpawn(data, "seeker"));
map.setSeekerLobbyName(data.getString("spawns.seeker.world"));
map.setBoundMin(data.getInt("bounds.min.x"), data.getInt("bounds.min.z"));
map.setBoundMax(data.getInt("bounds.max.x"), data.getInt("bounds.max.z"));
map.setWorldBorderData(
@ -100,8 +102,8 @@ public class Maps {
private static Location setSpawn(ConfigurationSection data, String spawn) {
String worldName = data.getString("spawns."+spawn+".world");
if(worldName == null) return new Location(null, 0, 0, 0);
if(!Map.worldExists(worldName)) return new Location(null, 0, 0, 0);
World world = Bukkit.getWorld(worldName);
if(world == null) return new Location(null, 0, 0, 0);
double x = data.getDouble("spawns."+spawn+".x");
double y = data.getDouble("spawns."+spawn+".y");
double z = data.getDouble("spawns."+spawn+".z");
@ -115,9 +117,9 @@ public class Maps {
for(Map map : MAPS.values()) {
ConfigurationSection data = new YamlConfiguration();
saveSpawn(data, map.getSpawn(), "game");
saveSpawn(data, map.getLobby(), "lobby");
saveSpawn(data, map.getSeekerLobby(), "seeker");
saveSpawn(data, map.getSpawn(), "game", map);
saveSpawn(data, map.getLobby(), "lobby", map);
saveSpawn(data, map.getSeekerLobby(), "seeker", map);
data.set("bounds.min.x", map.getBoundsMin().getX());
data.set("bounds.min.z", map.getBoundsMin().getZ());
data.set("bounds.max.x", map.getBoundsMax().getX());
@ -137,15 +139,25 @@ public class Maps {
}
private static void saveSpawn(ConfigurationSection data, Location spawn, String name) {
if(spawn.getWorld() != null) {
data.set("spawns." + name + ".world", spawn.getWorld().getName());
} else {
private static void saveSpawn(ConfigurationSection data, Location spawn, String name, Map map) {
String worldName = getWorldName(name, map);
if(worldName == null || !Map.worldExists(worldName)) {
data.set("spawns." + name + ".world", "world");
} else {
data.set("spawns." + name + ".world", worldName);
}
data.set("spawns." + name + ".x", spawn.getX());
data.set("spawns." + name + ".y", spawn.getY());
data.set("spawns." + name + ".z", spawn.getZ());
}
private static String getWorldName(String name, Map map) {
switch (name) {
case "game": return map.getSpawnName();
case "lobby": return map.getLobbyName();
case "seeker": return map.getSeekerLobbyName();
default: return null;
}
}
}

View file

@ -58,10 +58,6 @@ public class Game {
private int gameTimer;
private boolean hiderLeft;
public Game(Board board) {
this(Maps.getRandomMap(), board);
}
public Game(Map map, Board board) {
this.currentMap = map;

View file

@ -42,7 +42,6 @@ public class DamageHandler implements Listener {
}
// Makes sure that if there was an attacking player, that the event is allowed for the game
if (attacker != null) {
System.out.println(event.getFinalDamage() + " " + player.getDisplayName() + " " + attacker.getDisplayName());
// Cancel if one player is in the game but other isn't
if ((board.contains(player) && !board.contains(attacker)) || (!board.contains(player) && board.contains(attacker))) {
event.setCancelled(true);

View file

@ -1,111 +0,0 @@
/*
* This file is part of Kenshins Hide and Seek
*
* Copyright (c) 2021 Tyler Murphy.
*
* Kenshins Hide and Seek free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* he Free Software Foundation version 3.
*
* Kenshins Hide and Seek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package net.tylermurphy.hideAndSeek.util;
import net.tylermurphy.hideAndSeek.command.*;
import net.tylermurphy.hideAndSeek.command.location.SetExitLocation;
import net.tylermurphy.hideAndSeek.command.location.SetLobbyLocation;
import net.tylermurphy.hideAndSeek.command.location.SetSeekerLobbyLocation;
import net.tylermurphy.hideAndSeek.command.location.SetSpawnLocation;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.permissionsRequired;
import static net.tylermurphy.hideAndSeek.configuration.Localization.LOCAL;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class CommandHandler {
public static final Map<String,ICommand> COMMAND_REGISTER = new LinkedHashMap<>();
private static void registerCommand(ICommand command) {
if (!COMMAND_REGISTER.containsKey(command.getLabel())) {
COMMAND_REGISTER.put(command.getLabel().toLowerCase(), command);
}
}
public static void registerCommands() {
registerCommand(new About());
registerCommand(new Help());
registerCommand(new Setup());
registerCommand(new Start());
registerCommand(new Stop());
registerCommand(new SetSpawnLocation());
registerCommand(new SetLobbyLocation());
registerCommand(new SetSeekerLobbyLocation());
registerCommand(new SetExitLocation());
registerCommand(new SetBorder());
registerCommand(new Reload());
registerCommand(new SaveMap());
registerCommand(new SetBounds());
registerCommand(new Join());
registerCommand(new Leave());
registerCommand(new Top());
registerCommand(new Wins());
registerCommand(new Debug());
registerCommand(new AddMap());
registerCommand(new RemoveMap());
registerCommand(new ListMaps());
registerCommand(new SetMap());
}
public static boolean handleCommand(CommandSender sender, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(errorPrefix + message("COMMAND_PLAYER_ONLY"));
return true;
}
Player player = (Player) sender;
if (args.length < 1 || !COMMAND_REGISTER.containsKey(args[0].toLowerCase()) ) {
if (permissionsRequired && !sender.hasPermission("hideandseek.about")) {
sender.sendMessage(errorPrefix + LOCAL.get(""));
} else {
COMMAND_REGISTER.get("about").execute(player, null);
}
} else {
if (!args[0].equalsIgnoreCase("about") && !args[0].equalsIgnoreCase("help") && SaveMap.runningBackup) {
sender.sendMessage(errorPrefix + message("MAPSAVE_INPROGRESS"));
} else if (permissionsRequired && !sender.hasPermission("hideandseek."+args[0].toLowerCase())) {
sender.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED"));
} else {
try {
ICommand command = COMMAND_REGISTER.get(args[0].toLowerCase());
int parameters = (int) Arrays.stream(command.getUsage().split(" ")).filter(p -> p.startsWith("<") && !p.startsWith("<*")).count();
if(args.length - 1 < parameters) {
sender.sendMessage(errorPrefix + message("ARGUMENT_COUNT"));
return true;
}
command.execute(player,Arrays.copyOfRange(args, 1, args.length));
} catch (Exception e) {
sender.sendMessage(errorPrefix + "An error has occurred.");
e.printStackTrace();
}
}
}
return true;
}
}

View file

@ -1,59 +0,0 @@
/*
* This file is part of Kenshins Hide and Seek
*
* Copyright (c) 2021 Tyler Murphy.
*
* Kenshins Hide and Seek free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* he Free Software Foundation version 3.
*
* Kenshins Hide and Seek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package net.tylermurphy.hideAndSeek.util;
import net.tylermurphy.hideAndSeek.command.ICommand;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
public class TabCompleter {
public static List<String> handleTabComplete(CommandSender sender, String[] args) {
if (args.length == 1) {
return new ArrayList<>(CommandHandler.COMMAND_REGISTER.keySet())
.stream()
.filter(handle -> sender.hasPermission("hideandseek."+handle.toLowerCase()) && handle.toLowerCase().startsWith(args[0].toLowerCase(Locale.ROOT)))
.collect(Collectors.toList());
} else if (args.length > 1) {
if (!CommandHandler.COMMAND_REGISTER.containsKey(args[0].toLowerCase())) {
return new ArrayList<>();
} else {
ICommand command = CommandHandler.COMMAND_REGISTER.get(args[0].toLowerCase());
String[] usage = command.getUsage().split(" ");
List<String> complete;
if (args.length - 2 < usage.length) {
String parameter = usage[args.length-2];
String name = parameter.replace("<", "").replace(">", "");
complete = command.autoComplete(name);
} else {
complete = command.autoComplete(null);
}
if(complete == null) return new ArrayList<>();
else return complete;
}
}
return null;
}
}