diff --git a/src/main/java/net/tylermurphy/hideAndSeek/Main.java b/src/main/java/net/tylermurphy/hideAndSeek/Main.java
index ad49273..36d92ee 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/Main.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/Main.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek;
import net.tylermurphy.hideAndSeek.command.*;
@@ -204,6 +185,7 @@ public class Main extends JavaPlugin implements Listener {
getServer().getPluginManager().registerEvents(new MovementHandler(), this);
getServer().getPluginManager().registerEvents(new PlayerHandler(), this);
getServer().getPluginManager().registerEvents(new RespawnHandler(), this);
+ getServer().getPluginManager().registerEvents(new WorldInteractHandler(), this);
}
private void updateVersion(){
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java
index 3efddcd..41db5a9 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
index 69387cd..0c01265 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
index cb0c745..109930b 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java
index df2944b..0c2b6b1 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
index 0a57cfc..7da404f 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java
index 74b8490..5184933 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
@@ -59,13 +40,8 @@ public class Start implements ICommand {
} else {
seekerName = args[0];
}
- Player temp = Bukkit.getPlayer(seekerName);
- if (temp == null) {
- sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName));
- return;
- }
- Player seeker = Main.getInstance().getBoard().getPlayer(temp.getUniqueId());
- if (seeker == null) {
+ Player seeker = Bukkit.getPlayer(seekerName);
+ if (seeker == null || !Main.getInstance().getBoard().contains(seeker)) {
sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName));
return;
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
index 4bc23fe..498e30d 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java
index 4ac4aa7..13f3069 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java
index 1ba44ac..fb61fb2 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java
index a612026..03e23a8 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
@@ -53,7 +34,7 @@ public class Save implements ICommand {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
return;
}
- if (map.isSpawnNotSetup()) {
+ if (map.getSpawn().isNotSetup()) {
sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
return;
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
index c7da88a..90615e5 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
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
index 14ae8e0..2567427 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java
@@ -20,6 +20,10 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Enabled implements ICommand {
public void execute(Player sender, String[] args) {
+ if (!Main.getInstance().supports(9)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
+ return;
+ }
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
return;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java
index fbdeecb..fea08ef 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java
@@ -20,6 +20,10 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Add implements ICommand {
public void execute(Player sender, String[] args) {
+ if (!Main.getInstance().supports(9)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
+ return;
+ }
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
return;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java
index 18f1b3c..de783ce 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java
@@ -1,5 +1,6 @@
package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks;
+import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
@@ -17,6 +18,10 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class List implements ICommand {
public void execute(Player sender, String[] args) {
+ if (!Main.getInstance().supports(9)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
+ return;
+ }
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java
index d2afdc1..1c16fdc 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java
@@ -20,6 +20,10 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Remove implements ICommand {
public void execute(Player sender, String[] args) {
+ if (!Main.getInstance().supports(9)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
+ return;
+ }
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
return;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java
index f9e14f8..64bf5d4 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command.map.set;
import net.tylermurphy.hideAndSeek.Main;
@@ -46,7 +27,7 @@ public class Border implements ICommand {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
return;
}
- if (map.isSpawnNotSetup()) {
+ if (map.getSpawn().isNotSetup()) {
sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
return;
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
index 960863b..3d1f036 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command.map.set;
import net.tylermurphy.hideAndSeek.Main;
@@ -24,6 +5,7 @@ import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
+import net.tylermurphy.hideAndSeek.util.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@@ -45,10 +27,14 @@ public class Bounds implements ICommand {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
return;
}
- if (map.isSpawnNotSetup()) {
+ if (map.getSpawn().isNotSetup()) {
sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
return;
}
+ if (map.getSeekerLobby().isNotSetup()) {
+ sender.sendMessage(errorPrefix + message("ERROR_GAME_SEEKER_SPAWN"));
+ return;
+ }
if (!sender.getWorld().getName().equals(map.getSpawnName())) {
sender.sendMessage(errorPrefix + message("BOUNDS_WRONG_WORLD"));
return;
@@ -87,6 +73,20 @@ public class Bounds implements ICommand {
}
map.setBoundMin(bxs, bzs);
map.setBoundMax(bxl, bzl);
+ if(!map.isBoundsNotSetup()) {
+ if(!map.getSpawn().isNotSetup()) {
+ if(map.getSpawn().isNotInBounds(bxs, bxl, bzs, bzl)) {
+ map.setSpawn(Location.getDefault());
+ sender.sendMessage(warningPrefix + message("WARN_SPAWN_RESET"));
+ }
+ }
+ if(!map.getSeekerLobby().isNotSetup()) {
+ if(map.getSeekerLobby().isNotInBounds(bxs, bxl, bzs, bzl)) {
+ map.setSeekerLobby(Location.getDefault());
+ sender.sendMessage(warningPrefix + message("WARN_SEEKER_SPAWN_RESET"));
+ }
+ }
+ }
Maps.setMap(map.getName(), map);
sender.sendMessage(messagePrefix + message("BOUNDS").addAmount(first ? 1 : 2));
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java
index ada76e2..6690ae9 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command.map.set;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java
index 9bc0249..b6c5cf0 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java
@@ -6,24 +6,33 @@ import net.tylermurphy.hideAndSeek.command.location.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.util.Location;
import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
-import java.util.List;
+import java.util.List;;
import java.util.stream.Collectors;
+import static net.tylermurphy.hideAndSeek.configuration.Config.warningPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class SeekerLobby implements ICommand {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.SEEKER, args[0], map -> {
- if(map.isSpawnNotSetup()) {
+ if(map.getSpawn().isNotSetup()) {
throw new RuntimeException(message("GAME_SPAWN_NEEDED").toString());
}
if(!map.getSpawnName().equals(sender.getLocation().getWorld().getName())) {
throw new RuntimeException(message("SEEKER_LOBBY_INVALID").toString());
}
map.setSeekerLobby(Location.from(sender));
+ if(!map.isBoundsNotSetup()) {
+ Vector boundsMin = map.getBoundsMin();
+ Vector boundsMax = map.getBoundsMax();
+ if(map.getSeekerLobby().isNotInBounds(boundsMin.getBlockX(), boundsMax.getBlockX(), boundsMin.getBlockZ(), boundsMax.getBlockZ())) {
+ sender.sendMessage(warningPrefix + message("WARN_MAP_BOUNDS"));
+ }
+ }
});
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java
index b983404..0baf55e 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command.map.set;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
@@ -47,8 +28,16 @@ public class Spawn implements ICommand {
map.setSpawn(Location.from(sender));
+ if(!map.isBoundsNotSetup()) {
+ Vector boundsMin = map.getBoundsMin();
+ Vector boundsMax = map.getBoundsMax();
+ if(map.getSpawn().isNotInBounds(boundsMin.getBlockX(), boundsMax.getBlockX(), boundsMin.getBlockZ(), boundsMax.getBlockZ())) {
+ sender.sendMessage(warningPrefix + message("WARN_MAP_BOUNDS"));
+ }
+ }
+
if(map.getSeekerLobby().getWorld() != null && !map.getSeekerLobby().getWorld().equals(sender.getLocation().getWorld().getName())) {
- sender.sendMessage(message("SEEKER_LOBBY_SPAWN_RESET").toString());
+ sender.sendMessage(warningPrefix + message("SEEKER_LOBBY_SPAWN_RESET"));
map.setSeekerLobby(Location.getDefault());
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java
index b366b9a..0cb307b 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command.util;
import net.tylermurphy.hideAndSeek.command.map.Save;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/util/ICommand.java b/src/main/java/net/tylermurphy/hideAndSeek/command/util/ICommand.java
index 3aa0ca4..1be678c 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/util/ICommand.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/util/ICommand.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.command.util;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java
index dbc9e37..5881d19 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.configuration;
import com.cryptomorin.xseries.XItemStack;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java
index 958d1ca..92fa4ce 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.configuration;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java
index 06dbb99..e5f970b 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.configuration;
import com.cryptomorin.xseries.XItemStack;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java
index 6f3f88b..b9f9b69 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.configuration;
import net.md_5.bungee.api.ChatColor;
@@ -38,7 +19,8 @@ public class Localization {
});
put("de-DE", new String[][]{
{},
- {"TAUNTED"}
+ {"TAUNTED"},
+ {"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"}
});
}};
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java
index 3d8bc0f..b457622 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.configuration;
import org.bukkit.entity.Entity;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Map.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Map.java
index 8c3f8a7..a23a1f7 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Map.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Map.java
@@ -3,6 +3,7 @@ package net.tylermurphy.hideAndSeek.configuration;
import java.util.ArrayList;
import java.util.List;
+import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.events.Border;
import net.tylermurphy.hideAndSeek.world.WorldLoader;
import net.tylermurphy.hideAndSeek.util.Location;
@@ -80,7 +81,11 @@ public class Map {
}
public void setBlockhunt(boolean enabled, List blocks) {
- this.blockhunt = enabled;
+ if (Main.getInstance().supports(9)) {
+ this.blockhunt = enabled;
+ } else {
+ this.blockhunt = false;
+ }
this.blockhuntBlocks = blocks;
}
@@ -226,10 +231,6 @@ public class Map {
return xBoundMin == 0 || zBoundMin == 0 || xBoundMax == 0 || zBoundMax == 0;
}
- public boolean isSpawnNotSetup() {
- return spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0;
- }
-
public boolean isBoundsNotSetup() {
return xBoundMin == 0 || zBoundMin == 0 || xBoundMax == 0 || zBoundMax == 0;
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java
index d2fb40d..dca2de0 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.database;
import com.google.common.io.ByteStreams;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java b/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java
index 8f0ddde..c01f615 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java
@@ -175,10 +175,10 @@ public class GameDataTable {
@NotNull Board board,
@NotNull List uuids,
@NotNull List winners,
- @NotNull Map hider_kills,
- @NotNull Map hider_deaths,
- @NotNull Map seeker_kills,
- @NotNull Map seeker_deaths,
+ @NotNull Map hider_kills,
+ @NotNull Map hider_deaths,
+ @NotNull Map seeker_kills,
+ @NotNull Map seeker_deaths,
@NotNull WinType type
) {
for(UUID uuid : uuids) {
@@ -192,10 +192,10 @@ public class GameDataTable {
info.getSeekerWins() + (winners.contains(uuid) && type == WinType.SEEKER_WIN ? 1 : 0),
info.getHiderGames() + (board.isHider(uuid) || (board.isSeeker(uuid) && !board.getFirstSeeker().getUniqueId().equals(uuid)) ? 1 : 0),
info.getSeekerGames() + (board.getFirstSeeker().getUniqueId().equals(uuid) ? 1 : 0),
- info.getHiderKills() + hider_kills.getOrDefault(uuid.toString(), 0),
- info.getSeekerKills() + seeker_kills.getOrDefault(uuid.toString(), 0),
- info.getHiderDeaths() + hider_deaths.getOrDefault(uuid.toString(), 0),
- info.getSeekerDeaths() + seeker_deaths.getOrDefault(uuid.toString(), 0)
+ info.getHiderKills() + hider_kills.getOrDefault(uuid, 0),
+ info.getSeekerKills() + seeker_kills.getOrDefault(uuid, 0),
+ info.getHiderDeaths() + hider_deaths.getOrDefault(uuid, 0),
+ info.getSeekerDeaths() + seeker_deaths.getOrDefault(uuid, 0)
);
}
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java
index 8c26bc8..2050f33 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.game;
import net.tylermurphy.hideAndSeek.Main;
@@ -38,109 +19,128 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Board {
- private final List Hider = new ArrayList<>(), Seeker = new ArrayList<>(), Spectator = new ArrayList<>();
- private final Map playerList = new HashMap<>();
- private final Map customBoards = new HashMap<>();
- private final Map hider_kills = new HashMap<>(), seeker_kills = new HashMap<>(), hider_deaths = new HashMap<>(), seeker_deaths = new HashMap<>();
+ private enum Type {
+ HIDER,
+ SEEKER,
+ SPECTATOR,
+ }
+
+ private UUID initialSeeker = null;
+ private final Map Players = new HashMap<>();
+ private final Map customBoards = new HashMap<>();
+ private final Map hider_kills = new HashMap<>(), seeker_kills = new HashMap<>(), hider_deaths = new HashMap<>(), seeker_deaths = new HashMap<>();
public boolean contains(Player player) {
- return playerList.containsKey(player.getUniqueId().toString());
+ return Players.containsKey(player.getUniqueId());
}
public boolean isHider(Player player) {
- return Hider.contains(player.getUniqueId().toString());
+ return isHider(player.getUniqueId());
}
public boolean isHider(UUID uuid) {
- return Hider.contains(uuid.toString());
+ if(!Players.containsKey(uuid)) return false;
+ return Players.get(uuid) == Type.HIDER;
}
public boolean isSeeker(Player player) {
- return Seeker.contains(player.getUniqueId().toString());
+ return isSeeker(player.getUniqueId());
}
public boolean isSeeker(UUID uuid) {
- return Seeker.contains(uuid.toString());
+ if(!Players.containsKey(uuid)) return false;
+ return Players.get(uuid) == Type.SEEKER;
}
public boolean isSpectator(Player player) {
- return Spectator.contains(player.getUniqueId().toString());
+ return isSpectator(player.getUniqueId());
+ }
+
+ public boolean isSpectator(UUID uuid) {
+ if(!Players.containsKey(uuid)) return false;
+ return Players.get(uuid) == Type.SPECTATOR;
}
public int sizeHider() {
- return Hider.size();
+ return getHiders().size();
}
public int sizeSeeker() {
- return Seeker.size();
+ return getSeekers().size();
}
public int size() {
- return playerList.values().size();
+ return getPlayers().size();
}
public List getHiders() {
- return Hider.stream().filter(Objects::nonNull).map(playerList::get).filter(Objects::nonNull).collect(Collectors.toList());
+ return Players.keySet().stream()
+ .filter(s -> Players.get(s) == Type.HIDER)
+ .map(Bukkit::getPlayer)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
}
public List getSeekers() {
- return Seeker.stream().filter(Objects::nonNull).map(playerList::get).filter(Objects::nonNull).collect(Collectors.toList());
- }
-
- public Player getFirstSeeker() {
- return playerList.get(Seeker.get(0));
+ return Players.keySet().stream()
+ .filter(s -> Players.get(s) == Type.SEEKER)
+ .map(Bukkit::getPlayer)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
}
public List getSpectators() {
- return Spectator.stream().filter(Objects::nonNull).map(playerList::get).filter(Objects::nonNull).collect(Collectors.toList());
+ return Players.keySet().stream()
+ .filter(s -> Players.get(s) == Type.SPECTATOR)
+ .map(Bukkit::getPlayer)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
}
public List getPlayers() {
- return playerList.values().stream().filter(Objects::nonNull).collect(Collectors.toList());
+ return Players.keySet().stream()
+ .map(Bukkit::getPlayer)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ }
+
+ public Player getFirstSeeker() {
+ if(initialSeeker == null) return null;
+ return Bukkit.getPlayer(initialSeeker);
}
public Player getPlayer(UUID uuid) {
- return playerList.get(uuid.toString());
+ if(!Players.containsKey(uuid)) {
+ return null;
+ }
+ return Bukkit.getPlayer(uuid);
}
public void addHider(Player player) {
- Hider.add(player.getUniqueId().toString());
- Seeker.remove(player.getUniqueId().toString());
- Spectator.remove(player.getUniqueId().toString());
- playerList.put(player.getUniqueId().toString(), player);
+ Players.put(player.getUniqueId(), Type.HIDER);
}
public void addSeeker(Player player) {
- Hider.remove(player.getUniqueId().toString());
- Seeker.add(player.getUniqueId().toString());
- Spectator.remove(player.getUniqueId().toString());
- playerList.put(player.getUniqueId().toString(), player);
+ if(initialSeeker == null) {
+ initialSeeker = player.getUniqueId();
+ }
+ Players.put(player.getUniqueId(), Type.SEEKER);
}
public void addSpectator(Player player) {
- Hider.remove(player.getUniqueId().toString());
- Seeker.remove(player.getUniqueId().toString());
- Spectator.add(player.getUniqueId().toString());
- playerList.put(player.getUniqueId().toString(), player);
+ Players.put(player.getUniqueId(), Type.SPECTATOR);
}
public void remove(Player player) {
- Hider.remove(player.getUniqueId().toString());
- Seeker.remove(player.getUniqueId().toString());
- Spectator.remove(player.getUniqueId().toString());
- playerList.remove(player.getUniqueId().toString());
+ Players.remove(player.getUniqueId());
}
public boolean onSameTeam(Player player1, Player player2) {
- if (Hider.contains(player1.getUniqueId().toString()) && Hider.contains(player2.getUniqueId().toString())) return true;
- else if (Seeker.contains(player1.getUniqueId().toString()) && Seeker.contains(player2.getUniqueId().toString())) return true;
- else return Spectator.contains(player1.getUniqueId().toString()) && Spectator.contains(player2.getUniqueId().toString());
+ return Players.get(player1.getUniqueId()) == Players.get(player2.getUniqueId());
}
public void reload() {
- Hider.clear();
- Seeker.clear();
- Spectator.clear();
+ Players.replaceAll((u, v) -> Type.HIDER);
hider_kills.clear();
seeker_kills.clear();
hider_deaths.clear();
@@ -148,47 +148,38 @@ public class Board {
}
public void addKill(UUID uuid) {
- if (Hider.contains(uuid.toString())) {
- if (hider_kills.containsKey(uuid.toString())) {
- hider_kills.put(uuid.toString(), hider_kills.get(uuid.toString())+1);
- } else {
- hider_kills.put(uuid.toString(), 1);
- }
- } else if (Seeker.contains(uuid.toString())) {
- if (seeker_kills.containsKey(uuid.toString())) {
- seeker_kills.put(uuid.toString(), seeker_kills.get(uuid.toString())+1);
- } else {
- seeker_kills.put(uuid.toString(), 1);
- }
+ if(Players.get(uuid) == Type.HIDER) {
+ int kills = hider_kills.getOrDefault(uuid, 0);
+ hider_kills.put(uuid, kills + 1);
+ } else if(Players.get(uuid) == Type.SEEKER) {
+ int kills = seeker_kills.getOrDefault(uuid, 0);
+ seeker_kills.put(uuid, kills + 1);
}
}
public void addDeath(UUID uuid) {
- if (Hider.contains(uuid.toString())) {
- if (hider_deaths.containsKey(uuid.toString())) {
- hider_deaths.put(uuid.toString(), hider_deaths.get(uuid.toString())+1);
- } else {
- hider_deaths.put(uuid.toString(), 1);
- }
- } else if (Seeker.contains(uuid.toString())) {
- if (seeker_deaths.containsKey(uuid.toString())) {
- seeker_deaths.put(uuid.toString(), seeker_deaths.get(uuid.toString())+1);
- } else {
- seeker_deaths.put(uuid.toString(), 1);
- }
+ if(Players.get(uuid) == Type.HIDER) {
+ int kills = hider_deaths.getOrDefault(uuid, 0);
+ hider_deaths.put(uuid, kills + 1);
+ } else if(Players.get(uuid) == Type.SEEKER) {
+ int kills = seeker_deaths.getOrDefault(uuid, 0);
+ seeker_deaths.put(uuid, kills + 1);
}
}
- public Map getHiderKills() {
+ public Map getHiderKills() {
return new HashMap<>(hider_kills);
}
- public Map getSeekerKills() {
+
+ public Map getSeekerKills() {
return new HashMap<>(seeker_kills);
}
- public Map getHiderDeaths() {
+
+ public Map getHiderDeaths() {
return new HashMap<>(hider_deaths);
}
- public Map getSeekerDeaths() {
+
+ public Map getSeekerDeaths() {
return new HashMap<>(seeker_deaths);
}
@@ -197,7 +188,7 @@ public class Board {
}
private void createLobbyBoard(Player player, boolean recreate) {
- CustomBoard board = customBoards.get(player.getUniqueId().toString());
+ CustomBoard board = customBoards.get(player.getUniqueId());
if (recreate || board == null) {
board = new CustomBoard(player, LOBBY_TITLE);
board.updateTeams();
@@ -228,7 +219,7 @@ public class Board {
i++;
}
board.display();
- customBoards.put(player.getUniqueId().toString(), board);
+ customBoards.put(player.getUniqueId(), board);
}
public String getMapName() {
@@ -242,7 +233,7 @@ public class Board {
}
private void createGameBoard(Player player, boolean recreate) {
- CustomBoard board = customBoards.get(player.getUniqueId().toString());
+ CustomBoard board = customBoards.get(player.getUniqueId());
if (recreate || board == null) {
board = new CustomBoard(player, GAME_TITLE);
board.updateTeams();
@@ -279,7 +270,7 @@ public class Board {
if (!tauntEnabled) continue;
if (taunt == null || status == Status.STARTING) {
board.setLine(String.valueOf(i), line.replace("{TAUNT}", TAUNT_COUNTING.replace("{AMOUNT}", "0")));
- } else if (!tauntLast && Hider.size() == 1) {
+ } else if (!tauntLast && sizeHider() == 1) {
board.setLine(String.valueOf(i), line.replace("{TAUNT}", TAUNT_EXPIRED));
} else if (!taunt.isRunning()) {
board.setLine(String.valueOf(i), line.replace("{TAUNT}", TAUNT_COUNTING.replaceFirst("\\{AMOUNT}", taunt.getDelay() / 60 + "").replaceFirst("\\{AMOUNT}", taunt.getDelay() % 60 + "")));
@@ -306,23 +297,23 @@ public class Board {
i++;
}
board.display();
- customBoards.put(player.getUniqueId().toString(), board);
+ customBoards.put(player.getUniqueId(), board);
}
public void removeBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
assert manager != null;
player.setScoreboard(manager.getMainScoreboard());
- customBoards.remove(player.getUniqueId().toString());
+ customBoards.remove(player.getUniqueId());
}
public void reloadLobbyBoards() {
- for(Player player : playerList.values())
+ for(Player player : getPlayers())
createLobbyBoard(player, false);
}
public void reloadGameBoards() {
- for(Player player : playerList.values())
+ for(Player player : getPlayers())
createGameBoard(player, false);
}
@@ -332,17 +323,19 @@ public class Board {
}
private String getSeekerPercent() {
- if (playerList.values().size() < 2)
+ int size = size();
+ if (size < 2)
return " --";
else
- return " "+(int)(100*(1.0/playerList.size()));
+ return " "+(int)(100*(1.0/size));
}
private String getHiderPercent() {
- if (playerList.size() < 2)
+ int size = size();
+ if (size < 2)
return " --";
else
- return " "+(int)(100-100*(1.0/playerList.size()));
+ return " "+(int)(100-100*(1.0/size));
}
private String getTeam(Player player) {
@@ -353,10 +346,8 @@ public class Board {
}
public void cleanup() {
- playerList.clear();
- Hider.clear();
- Seeker.clear();
- Spectator.clear();
+ Players.clear();;
+ initialSeeker = null;
customBoards.clear();
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/WorldInteractHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/WorldInteractHandler.java
new file mode 100644
index 0000000..10b8e3e
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/WorldInteractHandler.java
@@ -0,0 +1,48 @@
+package net.tylermurphy.hideAndSeek.game.listener;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.game.Board;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.entity.EntityBreakDoorEvent;
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
+
+public class WorldInteractHandler implements Listener {
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onBlockBreak(BlockBreakEvent event) {
+ Player player = event.getPlayer();
+ Board board = Main.getInstance().getBoard();
+ if(board.contains(player)) {
+ event.setCancelled(true);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onHangingEntityBreakByEntity(HangingBreakByEntityEvent event) {
+ if (!(event.getRemover() instanceof Player)) {
+ return;
+ }
+ Player player = (Player) event.getRemover();
+ Board board = Main.getInstance().getBoard();
+ if(board.contains(player)) {
+ event.setCancelled(true);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onBreakDoor(EntityBreakDoorEvent event) {
+ if (!(event.getEntity() instanceof Player)) {
+ return;
+ }
+ Player player = (Player) event.getEntity();
+ Board board = Main.getInstance().getBoard();
+ if(board.contains(player)) {
+ event.setCancelled(true);
+ }
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/util/Status.java b/src/main/java/net/tylermurphy/hideAndSeek/game/util/Status.java
index e630070..44f19b2 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/game/util/Status.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/game/util/Status.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.game.util;
public enum Status {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/util/WinType.java b/src/main/java/net/tylermurphy/hideAndSeek/game/util/WinType.java
index f584d80..24544ba 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/game/util/WinType.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/game/util/WinType.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.game.util;
public enum WinType {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java
index 10fa783..a5060c6 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java
@@ -134,4 +134,12 @@ public class Location {
return destination.isDirectory();
}
+ public boolean isNotSetup() {
+ return getBlockX() == 0 && getBlockY() == 0 && getBlockZ() == 0;
+ }
+
+ public boolean isNotInBounds(int xmin, int xmax, int zmin, int zmax) {
+ return getBlockX() < xmin || getBlockX() > xmax || getBlockZ() < zmin || getBlockZ() > zmax;
+ }
+
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java
index 15ff45f..4f9ad0d 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.world;
import org.bukkit.Location;
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java b/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java
index d14f617..e5913aa 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java
@@ -1,22 +1,3 @@
-/*
- * 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 .
- *
- */
-
package net.tylermurphy.hideAndSeek.world;
import net.tylermurphy.hideAndSeek.Main;
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 389352a..82b9379 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -268,11 +268,8 @@ locale: "en-US"
# playing the game.
blockedCommands: [
"msg",
- "tp",
- "gamemode",
- "kill",
- "give",
- "effect"
+ "reply",
+ "me"
]
# Stop interactions with any block by any user while playing the game.
diff --git a/src/main/resources/lang/localization_de-DE.yml b/src/main/resources/lang/localization_de-DE.yml
index 9789a75..92309ee 100644
--- a/src/main/resources/lang/localization_de-DE.yml
+++ b/src/main/resources/lang/localization_de-DE.yml
@@ -10,6 +10,7 @@ Localization:
COMMAND_PLAYER_ONLY: "Dieser Befehl kann nur als Spieler ausgeführt werden."
COMMAND_NOT_ALLOWED: "Es ist dir nicht gestattet diesen Befehl auszuführen."
COMMAND_ERROR: "Ein unbekannter Fehler ist aufgetreten."
+ COMMAND_INVALID_ARG: "Ungültiges Argument: {AMOUNT}"
GAME_PLAYER_DEATH: "&c{PLAYER}&f ist gestorben."
GAME_PLAYER_FOUND: "&e{PLAYER}&f wurde gefunden und ist nun ein Seeker."
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f wurde von &c{PLAYER}&f gefunden und ist nun ein Seeker."
@@ -17,7 +18,7 @@ Localization:
GAME_GAMEOVER_SEEKERS_QUIT: "All Seeker haben das Spiel verlassen."
GAME_GAMEOVER_HIDERS_QUIT: "All Hider haben das Spiel verlassen."
GAME_GAMEOVER_TIME: "Seekers haben keine Spielzeit mehr. Die Hiders haben gewonnen!"
- GAME_SETUP: "Spiel wurde noch nicht eingerichtet. Führe &c/hs setup&f aus, um die Einrichtungsschritte zu sehen."
+ GAME_SETUP: "Es gibt keine Setup-Karten! Führen Sie /hs map status auf einer Karte aus, um zu sehen, was Sie tun müssen."
GAME_INGAME: "Du bist bereits in der Lobby oder im Spiel."
GAME_NOT_INGAME: "Du bist weder in einer Lobby noch in einem Spiel."
GAME_INPROGRESS: "Es läuft bereits ein Spiel."
@@ -25,6 +26,7 @@ Localization:
GAME_JOIN: "{PLAYER} hat die Hide and Seek Lobby betreten."
GAME_JOIN_SPECTATOR: "Du bist als Beobachter einem laufenden Spiel beigetreten."
GAME_LEAVE: "{PLAYER} hat die Hide and Seek Lobby verlassen."
+ LOBBY_IN_USE: "Die Lobby kann nicht verändert werden, solange die Lobby nicht leer ist."
CONFIG_RELOAD: "Konfiguration neu geladen."
MAPSAVE_INPROGRESS: "Weltkarte wird aktuell gespeichert. Versuche es später nochmal."
MAPSAVE_START: "Starte Speichervorgang der Weltkarte"
@@ -32,6 +34,9 @@ Localization:
MAPSAVE_END: "Speichervorgang abgeschlossen."
MAPSAVE_ERROR: "Aktuelle Weltkarte konnte nicht gefunden werden."
MAPSAVE_DISABLED: "Mapsave ist in config.yml deaktiviert."
+ MAPSAVE_FAIL_WORLD: "Mapsave fehlgeschlagen. Die aktuelle Welt konnte nicht geladen werden."
+ MAPSAVE_INVALID: "Ungültige Welt zum Speichern: {AMOUNT}"
+ MAPSAVE_FAIL_DIR: "Verzeichnis konnte nicht umbenannt werden: {AMOUNT}"
WORLDBORDER_DISABLE: "World Border ausgeschaltet."
WORLDBORDER_INVALID_INPUT: "Ungültiger Wert: {AMOUNT}"
WORLDBORDER_MIN_SIZE: "World Border darf nicht geringer als 100 Blöcke sein."
@@ -39,24 +44,32 @@ Localization:
WORLDBORDER_ENABLE: "Setze World Border zentriert von dieser Position aus. Größe: {AMOUNT}. Verzögerung: {AMOUNT}."
WORLDBORDER_DECREASING: "World Norder schrumpoft 100 Blöcke über die nächsten 30 Sekunden!"
WORLDBORDER_WARN: "Die Weltgrenze wird in den nächsten 30er Jahren schrumpfen!"
+ WORLDBORDER_CHANGE_SIZE: "Die Änderung der Weltgrenze kann nicht 0 oder weniger sein."
TAUNTED: "&c&oOh nein! Du wurdest geärgert!"
TAUNT: "Ein zufälliger Hider wird in den nächsten 30 Sekunden geärgert."
TAUNT_ACTIVATE: "Ärgern wurde aktiviert"
ERROR_GAME_SPAWN: "Bitte erst die Spawn-Position für das Spiel festlegen."
+ ERROR_GAME_SEEKER_SPAWN: "Bitte setze zuerst den Sucher-Spawn-Ort"
+ ERROR_MAP_BOUNDS: "Bitte setzen Sie die Grenzen der Karte vor dem Speichern"
+ WARN_MAP_BOUNDS: "Dieser Ort liegt nicht innerhalb der Kartengrenzen, dies könnte Probleme verursachen"
+ WARN_SPAWN_RESET: "Spiel-Spawn wurde zurückgesetzt, da er nicht innerhalb der Kartengrenzen liegt"
+ WARN_SEEKER_SPAWN_RESET: "Seeker-Spawn zurückgesetzt, da er nicht innerhalb der Kartengrenzen liegt"
SETUP: "&f&lFühre die folgenden Schritte zur Einrichtung aus:"
- SETUP_GAME: "&c&l- &fTeleport-Position für den Spielbeginn festlegen mit /hs setspawn"
- SETUP_LOBBY: "&c&l- &fTeleport-Position für die Lobby festlegen mit /hs setlobby"
- SETUP_SEEKER_LOBBY: "&c&l- &fTeleport-Position für die Lobby Seekern festlegen mit /hs setseekerlobby"
- SETUP_EXIT: "&c&l- &fTeleport-Position für das Spielende festlegen mit /hs setexit"
- SETUP_SAVEMAP: "&c&l- &fHide and Seek Weltkarte speichern mit /hs savemap (nach /hs setspawn)"
+ SETUP_GAME: "&c&l- &fSpielspawn ist nicht gesetzt, /hs map set spawn