summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command/map
diff options
context:
space:
mode:
authortylermurphy534 <tylermurphy534@gmail.com>2022-10-31 23:28:45 -0400
committertylermurphy534 <tylermurphy534@gmail.com>2022-10-31 23:28:45 -0400
commit7530fe5e2dad89cabd694aefc91758a651ca9196 (patch)
tree0fc693e6b33b05a20c85ef0027a4c3638ae1511f /src/main/java/net/tylermurphy/hideAndSeek/command/map
parentfinish beta build of multi map support (diff)
downloadkenshinshideandseek-7530fe5e2dad89cabd694aefc91758a651ca9196.tar.gz
kenshinshideandseek-7530fe5e2dad89cabd694aefc91758a651ca9196.tar.bz2
kenshinshideandseek-7530fe5e2dad89cabd694aefc91758a651ca9196.zip
1.7.0 beta 1
Diffstat (limited to '')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/AddMap.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/AddMap.java)8
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/ListMaps.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/ListMaps.java)7
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/RemoveMap.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/RemoveMap.java)7
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/SaveMap.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java)7
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBorder.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java)15
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBounds.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java)7
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/SetMap.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/SetMap.java)7
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Setup.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java)22
8 files changed, 41 insertions, 39 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/AddMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/AddMap.java
index 086280e..55b4267 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/AddMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/AddMap.java
@@ -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() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/ListMaps.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/ListMaps.java
index 0025de5..79490a7 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/ListMaps.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/ListMaps.java
@@ -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() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/RemoveMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/RemoveMap.java
index b5727c8..216cca9 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/RemoveMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/RemoveMap.java
@@ -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() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/SaveMap.java
index ca2532c..f3eb4d7 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/SaveMap.java
@@ -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() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBorder.java
index 9768030..8362e02 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBorder.java
@@ -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() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBounds.java
index 563116d..92bf5a4 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetBounds.java
@@ -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() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetMap.java
index c2c6a6e..2df5824 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/SetMap.java
@@ -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() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Setup.java
index b222c61..46b41f7 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Setup.java
@@ -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"));