summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2021-10-31 11:25:27 -0400
committerTyler Murphy <tylermurphy534@gmail.com>2021-10-31 11:25:27 -0400
commit2a526291526811841d02ff813d9b3a7752570b43 (patch)
tree5bbac1fc857d4a87446470f1db5356ec89b64536 /src/main/java/net/tylermurphy/hideAndSeek/command
parent1.3.1 build 3 (diff)
downloadkenshinshideandseek-2a526291526811841d02ff813d9b3a7752570b43.tar.gz
kenshinshideandseek-2a526291526811841d02ff813d9b3a7752570b43.tar.bz2
kenshinshideandseek-2a526291526811841d02ff813d9b3a7752570b43.zip
1.3.1 build 4
Diffstat (limited to '')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Join.java6
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java2
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java14
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java13
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java12
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java14
6 files changed, 45 insertions, 16 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
index b3691bf..17b8f7a 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
@@ -30,6 +30,10 @@ public class Join implements ICommand {
return;
}
+ join(player);
+ }
+
+ public static void join(Player player){
if(Main.plugin.status.equals("Standby")) {
player.getInventory().clear();
Main.plugin.board.addHider(player);
@@ -46,7 +50,7 @@ public class Join implements ICommand {
Main.plugin.board.createGameBoard(player);
player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
}
-
+
player.setFoodLevel(20);
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue());
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java
index 2c7ba04..971cd13 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java
@@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.command;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import net.tylermurphy.hideAndSeek.configuration.Items;
import org.bukkit.command.CommandSender;
import net.tylermurphy.hideAndSeek.Main;
@@ -20,6 +21,7 @@ public class Reload implements ICommand {
}
Config.loadConfig();
Localization.loadLocalization();
+ Items.loadItems();
sender.sendMessage(messagePrefix + message("CONFIG_RELOAD"));
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java
index 210f7fe..c94a0d1 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java
@@ -24,15 +24,25 @@ public class SetBounds implements ICommand {
sender.sendMessage(errorPrefix + message("BOUNDS_WRONG_WORLD"));
return;
}
+ if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0){
+ sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
+ return;
+ }
+ boolean first = true;
+ if(saveMinX != 0 && saveMinZ != 0 && saveMaxX != 0 && saveMaxZ != 0) {
+ saveMinX = 0; saveMinZ= 0; saveMaxX = 0; saveMaxZ = 0;
+ }
if(saveMaxX == 0) {
addToConfig("bounds.max.x", player.getLocation().getBlockX());
saveMaxX = player.getLocation().getBlockX();
} else if(saveMaxX < player.getLocation().getBlockX()) {
+ first = false;
addToConfig("bounds.max.x", player.getLocation().getBlockX());
addToConfig("bounds.min.x", saveMaxX);
saveMinX = saveMaxX;
saveMaxX = player.getLocation().getBlockX();
} else {
+ first = false;
addToConfig("bounds.min.x", player.getLocation().getBlockX());
saveMinX = player.getLocation().getBlockX();
}
@@ -40,15 +50,17 @@ public class SetBounds implements ICommand {
addToConfig("bounds.max.z", player.getLocation().getBlockZ());
saveMaxZ = player.getLocation().getBlockZ();
} else if(saveMaxZ < player.getLocation().getBlockZ()) {
+ first = false;
addToConfig("bounds.max.z", player.getLocation().getBlockZ());
addToConfig("bounds.min.z", saveMaxZ);
saveMinZ = saveMaxZ;
saveMaxZ = player.getLocation().getBlockZ();
} else {
+ first = false;
addToConfig("bounds.min.z", player.getLocation().getBlockZ());
saveMinZ = player.getLocation().getBlockZ();
}
- sender.sendMessage(messagePrefix + message("BOUNDS"));
+ sender.sendMessage(messagePrefix + message("BOUNDS").addAmount(first ? 1 : 2));
saveConfig();
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
index c9d2fae..e0b8a5d 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
@@ -15,18 +15,21 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
public class SetExitLocation implements ICommand {
public void execute(CommandSender sender, String[] args) {
+ if(!Main.plugin.status.equals("Standby")) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
Vector newExitPosition = new Vector();
Player player = (Player) sender;
+ if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){
+ sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
+ return;
+ }
newExitPosition.setX(player.getLocation().getBlockX());
newExitPosition.setY(player.getLocation().getBlockY());
newExitPosition.setZ(player.getLocation().getBlockZ());
- if(!Main.plugin.status.equals("Standby")) {
- sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
- return;
- }
exitPosition = newExitPosition;
sender.sendMessage(messagePrefix + message("EXIT_SPAWN"));
- Map<String, Object> temp = new HashMap<String,Object>();
addToConfig("spawns.exit.x", exitPosition.getX());
addToConfig("spawns.exit.y", exitPosition.getY());
addToConfig("spawns.exit.z", exitPosition.getZ());
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java
index a8a1887..53ae721 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java
@@ -15,15 +15,19 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
public class SetLobbyLocation implements ICommand {
public void execute(CommandSender sender, String[] args) {
+ if(!Main.plugin.status.equals("Standby")) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
Vector newLobbyPosition = new Vector();
Player player = (Player) sender;
+ if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){
+ sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
+ return;
+ }
newLobbyPosition.setX(player.getLocation().getBlockX());
newLobbyPosition.setY(player.getLocation().getBlockY());
newLobbyPosition.setZ(player.getLocation().getBlockZ());
- if(!Main.plugin.status.equals("Standby")) {
- sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
- return;
- }
lobbyPosition = newLobbyPosition;
sender.sendMessage(messagePrefix + message("LOBBY_SPAWN"));
addToConfig("spawns.lobby.x", lobbyPosition.getX());
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java
index d634968..5324ecf 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java
@@ -17,16 +17,20 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
public class SetSpawnLocation implements ICommand {
public void execute(CommandSender sender, String[] args) {
+ if(!Main.plugin.status.equals("Standby")) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
Vector newSpawnPosition = new Vector();
Player player = (Player) sender;
+ if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){
+ sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
+ return;
+ }
newSpawnPosition.setX(player.getLocation().getBlockX());
newSpawnPosition.setY(player.getLocation().getBlockY());
newSpawnPosition.setZ(player.getLocation().getBlockZ());
- if(!Main.plugin.status.equals("Standby")) {
- sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
- return;
- }
- if(worldborderEnabled && spawnPosition.distance(worldborderPosition) > 100) {
+ if(worldborderEnabled && newSpawnPosition.distance(worldborderPosition) > 100) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
return;
}