summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/About.java2
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Join.java13
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java1
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java4
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java68
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java16
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java79
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java22
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java22
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java26
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java6
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Start.java89
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java4
13 files changed, 165 insertions, 187 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/About.java b/src/main/java/net/tylermurphy/hideAndSeek/command/About.java
index 4b207fb..897a9a0 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/About.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/About.java
@@ -7,7 +7,7 @@ public class About implements ICommand {
public void execute(CommandSender sender, String[] args) {
sender.sendMessage(
- String.format("%s%sHide and Seek %s(1.3.0%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
+ String.format("%s%sHide and Seek %s(1.3.1%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
);
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
index 9e77381..17b8f7a 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
@@ -29,21 +29,28 @@ public class Join implements ICommand {
sender.sendMessage(errorPrefix + message("GAME_INGAME"));
return;
}
-
+
+ join(player);
+ }
+
+ public static void join(Player player){
if(Main.plugin.status.equals("Standby")) {
+ player.getInventory().clear();
Main.plugin.board.addHider(player);
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
else Util.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
player.setGameMode(GameMode.ADVENTURE);
+ Main.plugin.board.createLobbyBoard(player);
Main.plugin.board.reloadLobbyBoards();
} else {
- Main.plugin.board.addSeeker(player);
+ Main.plugin.board.addSpectator(player);
player.sendMessage(messagePrefix + message("GAME_JOIN_SPECTATOR"));
player.setGameMode(GameMode.SPECTATOR);
+ 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/Leave.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
index 73dafbd..8809b5d 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
@@ -36,6 +36,7 @@ public class Leave implements ICommand {
Main.plugin.board.reloadLobbyBoards();
} else {
Main.plugin.board.reloadGameBoards();
+ Main.plugin.board.reloadBoardTeams();
}
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java
index cf580c9..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;
@@ -19,7 +20,8 @@ public class Reload implements ICommand {
return;
}
Config.loadConfig();
- Localization.init();
+ Localization.loadLocalization();
+ Items.loadItems();
sender.sendMessage(messagePrefix + message("CONFIG_RELOAD"));
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java
index a2554d1..2befd73 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java
@@ -2,15 +2,6 @@ package net.tylermurphy.hideAndSeek.command;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable;
@@ -36,66 +27,15 @@ public class SaveMap implements ICommand {
Bukkit.getServer().getWorld(spawnWorld).save();
BukkitRunnable runnable = new BukkitRunnable() {
public void run() {
- File current = new File(Main.root+File.separator+spawnWorld);
- if(current.exists()) {
- File temp_destenation = new File(Main.root+File.separator+"temp_hideandseek_"+spawnWorld);
- File destenation = new File(Main.root+File.separator+"hideandseek_"+spawnWorld);
- copyFileStructure(current, temp_destenation);
- if(destenation.exists()) {
- deleteDirectory(destenation);
- destenation.mkdir();
- }
- temp_destenation.renameTo(destenation);
- sender.sendMessage(messagePrefix + message("MAPSAVE_END"));
- runningBackup = false;
- } else {
- sender.sendMessage(errorPrefix + message("MAPSAVE_ERROR"));
- }
+ sender.sendMessage(
+ Main.plugin.worldLoader.save()
+ );
+ runningBackup = false;
}
};
runnable.runTaskAsynchronously(Main.plugin);
runningBackup = true;
}
-
- private static void copyFileStructure(File source, File target){
- try {
- ArrayList<String> ignore = new ArrayList<>(Arrays.asList("uid.dat", "session.lock"));
- if(!ignore.contains(source.getName())) {
- if(source.isDirectory()) {
- if(!target.exists())
- if (!target.mkdirs())
- throw new IOException("Couldn't create world directory!");
- String files[] = source.list();
- for (String file : files) {
- File srcFile = new File(source, file);
- File destFile = new File(target, file);
- copyFileStructure(srcFile, destFile);
- }
- } else {
- InputStream in = new FileInputStream(source);
- OutputStream out = new FileOutputStream(target);
- byte[] buffer = new byte[1024];
- int length;
- while ((length = in.read(buffer)) > 0)
- out.write(buffer, 0, length);
- in.close();
- out.close();
- }
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private boolean deleteDirectory(File directoryToBeDeleted) {
- File[] allContents = directoryToBeDeleted.listFiles();
- if (allContents != null) {
- for (File file : allContents) {
- deleteDirectory(file);
- }
- }
- return directoryToBeDeleted.delete();
- }
public String getLabel() {
return "saveMap";
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java
index 25e0a87..472396c 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java
@@ -26,9 +26,7 @@ public class SetBorder implements ICommand {
}
if(args.length < 2) {
worldborderEnabled = false;
- Map<String, Object> temp = new HashMap<String,Object>();
- temp.put("enabled", false);
- addToSection("worldBorder",temp);
+ addToConfig("worldBorder.enabled",false);
saveConfig();
sender.sendMessage(messagePrefix + message("WORLDBORDER_DISABLE"));
Worldborder.resetWorldborder(spawnWorld);
@@ -60,13 +58,11 @@ public class SetBorder implements ICommand {
worldborderSize = num;
worldborderDelay = delay;
worldborderEnabled = true;
- Map<String, Object> temp = new HashMap<String,Object>();
- temp.put("x", worldborderPosition.getBlockX());
- temp.put("z", worldborderPosition.getBlockZ());
- temp.put("delay", worldborderDelay);
- temp.put("size", worldborderSize);
- temp.put("enabled", true);
- addToSection("worldBorder",temp);
+ addToConfig("worldBorder.x", worldborderPosition.getBlockX());
+ addToConfig("worldBorder.z", worldborderPosition.getBlockZ());
+ addToConfig("worldBorder.delay", worldborderDelay);
+ addToConfig("worldBorder.size", worldborderSize);
+ addToConfig("worldBorder.enabled", true);
sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay));
saveConfig();
Worldborder.resetWorldborder(spawnWorld);
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java
new file mode 100644
index 0000000..c94a0d1
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java
@@ -0,0 +1,79 @@
+package net.tylermurphy.hideAndSeek.command;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import net.tylermurphy.hideAndSeek.Main;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
+
+public class SetBounds implements ICommand {
+
+ public void execute(CommandSender sender, String[] args) {
+ if(!Main.plugin.status.equals("Standby")) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ if(spawnPosition == null) {
+ sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
+ return;
+ }
+ Player player = (Player) sender;
+ if(!player.getWorld().getName().equals(spawnWorld)){
+ 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();
+ }
+ if(saveMaxZ == 0) {
+ 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").addAmount(first ? 1 : 2));
+ saveConfig();
+ }
+
+ public String getLabel() {
+ return "setBounds";
+ }
+
+ public String getUsage() {
+ return "";
+ }
+
+ public String getDescription() {
+ return "Sets the map bounds for the game.";
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
index e82d0e4..e0b8a5d 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
@@ -15,23 +15,25 @@ 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>();
- temp.put("x", exitPosition.getX());
- temp.put("y", exitPosition.getY());
- temp.put("z", exitPosition.getZ());
- temp.put("world", player.getLocation().getWorld().getName());
- addToSection("spawns.exit",temp);
+ addToConfig("spawns.exit.x", exitPosition.getX());
+ addToConfig("spawns.exit.y", exitPosition.getY());
+ addToConfig("spawns.exit.z", exitPosition.getZ());
+ addToConfig("spawns.exit.world", player.getLocation().getWorld().getName());
saveConfig();
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java
index 31cad53..53ae721 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java
@@ -15,23 +15,25 @@ 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"));
- Map<String, Object> temp = new HashMap<String,Object>();
- temp.put("x", lobbyPosition.getX());
- temp.put("y", lobbyPosition.getY());
- temp.put("z", lobbyPosition.getZ());
- temp.put("world", player.getLocation().getWorld().getName());
- addToSection("spawns.lobby",temp);
+ addToConfig("spawns.lobby.x", lobbyPosition.getX());
+ addToConfig("spawns.lobby.y", lobbyPosition.getY());
+ addToConfig("spawns.lobby.z", lobbyPosition.getZ());
+ addToConfig("spawns.lobby.world", player.getLocation().getWorld().getName());
saveConfig();
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java
index 45ee758..5324ecf 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java
@@ -10,32 +10,36 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import net.tylermurphy.hideAndSeek.Main;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.addToConfig;
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;
}
spawnPosition = newSpawnPosition;
sender.sendMessage(messagePrefix + message("GAME_SPAWN"));
- Map<String, Object> temp = new HashMap<String,Object>();
- temp.put("x", spawnPosition.getX());
- temp.put("y", spawnPosition.getY());
- temp.put("z", spawnPosition.getZ());
- temp.put("world", player.getLocation().getWorld().getName());
- addToSection("spawns.game",temp);
+ addToConfig("spawns.game.x", spawnPosition.getX());
+ addToConfig("spawns.game.y", spawnPosition.getY());
+ addToConfig("spawns.game.z", spawnPosition.getZ());
+ addToConfig("spawns.game.world", player.getLocation().getWorld().getName());
saveConfig();
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java
index 8be0141..f47503a 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java
@@ -28,9 +28,13 @@ public class Setup implements ICommand {
msg = msg + "\n" + message("SETUP_EXIT").toString();
count++;
}
+ if(saveMinX == 0 || saveMinZ == 0 || saveMaxX == 0 || saveMaxZ == 0) {
+ msg = msg + "\n" + message("SETUP_BOUNDS").toString();
+ count++;
+ }
File destenation = new File(Main.root+File.separator+"hideandseek_"+spawnWorld);
if(!destenation.exists()) {
- msg = msg + "\n" + message("SETUP_MAPSAVE").toString();
+ msg = msg + "\n" + message("SETUP_SAVEMAP").toString();
count++;
}
if(count < 1) {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java
index 89cbc09..05565da 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java
@@ -49,9 +49,9 @@ public class Start implements ICommand {
return;
}
if(Bukkit.getServer().getWorld("hideandseek_"+spawnWorld) != null) {
- Util.rollback("hideandseek_"+spawnWorld);
+ Main.plugin.worldLoader.rollback();
} else {
- Util.loadMap("hideandseek_"+spawnWorld);
+ Main.plugin.worldLoader.loadMap();
}
String seekerName;
if(args.length < 1) {
@@ -90,6 +90,9 @@ public class Start implements ICommand {
player.sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "HIDER", ChatColor.WHITE + message("HIDERS_SUBTITLE").toString(), 10, 70, 20);
}
Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
+ for(Player player : Main.plugin.board.getPlayers()){
+ Main.plugin.board.createGameBoard(player);
+ }
Main.plugin.board.reloadGameBoards();
Main.plugin.status = "Starting";
int temp = Main.plugin.gameId;
@@ -106,7 +109,7 @@ public class Start implements ICommand {
Util.broadcastMessage(messagePrefix + message("START"));
Main.plugin.status = "Playing";
for(Player player : Main.plugin.board.getPlayers()) {
- resetPlayer(player);
+ Util.resetPlayer(player);
}
Main.plugin.worldborder = null;
Main.plugin.taunt = null;
@@ -116,86 +119,24 @@ public class Start implements ICommand {
Main.plugin.worldborder = new Worldborder(Main.plugin.gameId);
Main.plugin.worldborder.schedule();
}
-
- Main.plugin.taunt = new Taunt(Main.plugin.gameId);
- Main.plugin.taunt.schedule();
-
- Main.plugin.glow = new Glow(Main.plugin.gameId);
+
+ if(tauntEnabled) {
+ Main.plugin.taunt = new Taunt(Main.plugin.gameId);
+ Main.plugin.taunt.schedule();
+ }
+
+ if (glowEnabled) {
+ Main.plugin.glow = new Glow(Main.plugin.gameId);
+ }
if(gameLength > 0) {
Main.plugin.timeLeft = gameLength;
- for(Player player : Main.plugin.board.getPlayers()) {
- player.setLevel(gameLength);
- }
}
}
}, 20 * 30);
}
- public static void resetPlayer(Player player) {
- player.getInventory().clear();
- for(PotionEffect effect : player.getActivePotionEffects()){
- player.removePotionEffect(effect.getType());
- }
- player.addPotionEffect(new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 1000000, 1, false, false));
- if(Main.plugin.board.isSeeker(player)){
- ItemStack diamondSword = new ItemStack(Material.DIAMOND_SWORD,1);
- diamondSword.addEnchantment(Enchantment.DAMAGE_ALL, 1);
- ItemMeta diamondSwordMeta = diamondSword.getItemMeta();
- diamondSwordMeta.setDisplayName("Seeker Sword");
- diamondSwordMeta.setUnbreakable(true);
- diamondSword.setItemMeta(diamondSwordMeta);
- player.getInventory().addItem(diamondSword);
-
- ItemStack wackyStick = new ItemStack(Material.STICK,1);
- wackyStick.addUnsafeEnchantment(Enchantment.KNOCKBACK, 3);
- ItemMeta wackyStickMeta = wackyStick.getItemMeta();
- wackyStickMeta.setDisplayName("Wacky Stick");
- wackyStick.setItemMeta(wackyStickMeta);
- player.getInventory().addItem(wackyStick);
-
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1000000, 2, false, false));
- player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, 1, false, false));
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 1000000, 1, false, false));
- player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 10, false, false));
- }
- else if(Main.plugin.board.isHider(player)){
- ItemStack stoneSword = new ItemStack(Material.STONE_SWORD,1);
- stoneSword.addEnchantment(Enchantment.DAMAGE_ALL, 2);
- ItemMeta stoneSwordMeta = stoneSword.getItemMeta();
- stoneSwordMeta.setDisplayName("Hider Sword");
- stoneSwordMeta.setUnbreakable(true);
- stoneSword.setItemMeta(stoneSwordMeta);
- player.getInventory().addItem(stoneSword);
-
- ItemStack splashPotion = new ItemStack(Material.SPLASH_POTION,1);
- PotionMeta splashPotionMeta = (PotionMeta) splashPotion.getItemMeta();
- splashPotionMeta.setBasePotionData(new PotionData(PotionType.REGEN));
- splashPotion.setItemMeta(splashPotionMeta);
- player.getInventory().addItem(splashPotion);
-
- ItemStack potion = new ItemStack(Material.POTION,2);
- PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
- potionMeta.setBasePotionData(new PotionData(PotionType.INSTANT_HEAL));
- potion.setItemMeta(potionMeta);
- player.getInventory().addItem(potion);
-
- ItemStack snowball = new ItemStack(Material.SNOWBALL,1);
- ItemMeta snowballMeta = snowball.getItemMeta();
- snowballMeta.setDisplayName("Glow Powerup");
- List<String> snowballLore = new ArrayList<String>();
- snowballLore.add("Throw to make all seekers glow");
- snowballLore.add("Last 30s, all hiders can see it");
- snowballLore.add("Time stacks on multi use");
- snowballMeta.setLore(snowballLore);
- snowball.setItemMeta(snowballMeta);
- player.getInventory().addItem(snowball);
-
- player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 1, false, false));
- }
- }
-
public String getLabel() {
return "start";
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
index 810c071..e4dd16e 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
@@ -45,8 +45,8 @@ public class Stop implements ICommand {
Main.plugin.timeLeft = 0;
Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
for(Player player : Main.plugin.board.getPlayers()) {
+ Main.plugin.board.createLobbyBoard(player);
player.setGameMode(GameMode.ADVENTURE);
- player.setLevel(0);
Main.plugin.board.addHider(player);
player.getInventory().clear();
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
@@ -58,7 +58,7 @@ public class Stop implements ICommand {
Packet.setGlow(player, temp, false);
}
}
- Util.unloadMap("hideandseek_"+spawnWorld);
+ Main.plugin.worldLoader.unloadMap();
Main.plugin.board.reloadLobbyBoards();
}