summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command/map
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Send.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/map/SetMap.java)6
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/map/AddMap.java)2
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/Debug.java)2
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java63
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/map/ListMaps.java)5
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/map/RemoveMap.java)2
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/map/SaveMap.java)5
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/map/Setup.java)6
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java43
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBorder.java)6
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBounds.java)4
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/location/SetLobbyLocation.java)8
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSeekerLobbyLocation.java)8
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java)8
14 files changed, 136 insertions, 32 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Send.java
index 2df5824..9978c3c 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Send.java
@@ -1,4 +1,4 @@
-package net.tylermurphy.hideAndSeek.command.map;
+package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
@@ -13,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 extends Command {
+public class Send extends Command {
public void execute(Player sender, String[] args) {
@@ -46,7 +46,7 @@ public class SetMap extends Command {
}
public String getLabel() {
- return "goto";
+ return "send";
}
public String getUsage() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/AddMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java
index 55b4267..03c2a95 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/AddMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java
@@ -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 extends Command {
+public class Add extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Debug.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java
index 2eb0eb9..2ec0525 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Debug.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java
@@ -1,4 +1,4 @@
-package net.tylermurphy.hideAndSeek.command;
+package net.tylermurphy.hideAndSeek.command.map;
import com.cryptomorin.xseries.XMaterial;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java
new file mode 100644
index 0000000..8e74922
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java
@@ -0,0 +1,63 @@
+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.entity.Player;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Config.exitPosition;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class GoTo extends Command {
+
+ public void execute(Player sender, String[] args) {
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ if (map.isNotSetup()) {
+ sender.sendMessage(errorPrefix + message("MAP_NOT_SETUP").addAmount(map.getName()));
+ return;
+ }
+ switch (args[1].toLowerCase()) {
+ case "spawn":
+ sender.teleport(map.getSpawn()); break;
+ case "lobby":
+ sender.teleport(map.getLobby()); break;
+ case "seekerlobby":
+ sender.teleport(map.getSeekerLobby()); break;
+ case "exit":
+ sender.teleport(exitPosition); break;
+ default:
+ sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1].toLowerCase()));
+ }
+ }
+
+ public String getLabel() {
+ return "goto";
+ }
+
+ public String getUsage() {
+ return "<map> <spawn>";
+ }
+
+ public String getDescription() {
+ return "Get the commands for the plugin";
+ }
+
+ public List<String> autoComplete(String parameter) {
+ if(parameter != null && parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ } else if(parameter != null && parameter.equals("spawn")) {
+ return Arrays.asList("spawn","lobby","seekerlobby","exit");
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/ListMaps.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java
index 79490a7..635c011 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/ListMaps.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java
@@ -7,13 +7,12 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.Collection;
-import java.util.List;
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 extends Command {
+public class List extends Command {
public void execute(Player sender, String[] args) {
Collection<Map> maps = Maps.getAllMaps();
@@ -40,7 +39,7 @@ public class ListMaps extends Command {
return "List all maps in the plugin";
}
- public List<String> autoComplete(String parameter) {
+ public java.util.List<String> autoComplete(String parameter) {
return null;
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/RemoveMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java
index 216cca9..45dec99 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/RemoveMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java
@@ -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 RemoveMap extends Command {
+public class Remove extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/SaveMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java
index f3eb4d7..b93250f 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/SaveMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java
@@ -34,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 extends Command {
+public class Save extends Command {
public static boolean runningBackup = false;
@@ -60,7 +60,8 @@ public class SaveMap extends Command {
sender.sendMessage(warningPrefix + message("MAPSAVE_WARNING"));
World world = map.getSpawn().getWorld();
if (world == null) {
- throw new RuntimeException("Unable to get spawn world");
+ sender.sendMessage(warningPrefix + message("MAPSAVE_FAIL_WORLD"));
+ return;
}
world.save();
BukkitRunnable runnable = new BukkitRunnable() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Setup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
index 46b41f7..29442c1 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Setup.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
@@ -19,20 +19,18 @@
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;
-import java.io.File;
import java.util.List;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
-public class Setup extends Command {
+public class Status extends Command {
public void execute(Player sender, String[] args) {
@@ -76,7 +74,7 @@ public class Setup extends Command {
}
public String getLabel() {
- return "setup";
+ return "status";
}
public String getUsage() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java
new file mode 100644
index 0000000..9d47390
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java
@@ -0,0 +1,43 @@
+package net.tylermurphy.hideAndSeek.command.map.blockhunt;
+
+import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
+import net.tylermurphy.hideAndSeek.command.location.Locations;
+import net.tylermurphy.hideAndSeek.command.util.Command;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import org.bukkit.entity.Player;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class Enabled extends Command {
+
+ public void execute(Player sender, String[] args) {
+ LocationUtils.setLocation(sender, Locations.LOBBY, args[0], map -> {
+ map.setLobby(sender.getLocation());
+ });
+ }
+
+ public String getLabel() {
+ return "enabled";
+ }
+
+ public String getUsage() {
+ return "<map> <bool>";
+ }
+
+ public String getDescription() {
+ return "Sets hide and seeks lobby location to current position";
+ }
+
+ public List<String> autoComplete(String parameter) {
+ if(parameter != null && parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ if(parameter != null && parameter.equals("bool")) {
+ return Arrays.asList("true", "false");
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java
index 8362e02..92339b4 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBorder.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java
@@ -17,7 +17,7 @@
*
*/
-package net.tylermurphy.hideAndSeek.command.map;
+package net.tylermurphy.hideAndSeek.command.map.set;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
@@ -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 SetBorder extends Command {
+public class Border extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
@@ -86,7 +86,7 @@ public class SetBorder extends Command {
change
);
Maps.setMap(map.getName(), map);
- sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay));
+ sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay).addAmount(change));
map.getWorldBorder().resetWorldBorder();
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
index 92bf5a4..9896389 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBounds.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
@@ -17,7 +17,7 @@
*
*/
-package net.tylermurphy.hideAndSeek.command.map;
+package net.tylermurphy.hideAndSeek.command.map.set;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.Command;
@@ -32,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 extends Command {
+public class Bounds extends Command {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java
index da41d91..c691787 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetLobbyLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java
@@ -17,18 +17,18 @@
*
*/
-package net.tylermurphy.hideAndSeek.command.location;
+package net.tylermurphy.hideAndSeek.command.map.set;
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.command.location.LocationUtils;
+import net.tylermurphy.hideAndSeek.command.location.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.stream.Collectors;
-public class SetLobbyLocation extends Command {
+public class Lobby extends Command {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.LOBBY, args[0], map -> {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSeekerLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java
index 8a5ebd1..2521f19 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSeekerLobbyLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java
@@ -1,8 +1,8 @@
-package net.tylermurphy.hideAndSeek.command.location;
+package net.tylermurphy.hideAndSeek.command.map.set;
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.command.location.LocationUtils;
+import net.tylermurphy.hideAndSeek.command.location.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import org.bukkit.entity.Player;
@@ -11,7 +11,7 @@ import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
-public class SetSeekerLobbyLocation extends Command {
+public class SeekerLobby extends Command {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.SEEKER, args[0], map -> {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java
index 82f71d1..3e8f77e 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java
@@ -17,11 +17,11 @@
*
*/
-package net.tylermurphy.hideAndSeek.command.location;
+package net.tylermurphy.hideAndSeek.command.map.set;
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.command.location.LocationUtils;
+import net.tylermurphy.hideAndSeek.command.location.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -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 extends Command {
+public class Spawn extends Command {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.GAME, args[0], map -> {