summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/commands')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/commands/About.java2
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/commands/Reload.java29
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java24
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/commands/SetSpawnLocation.java16
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java2
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/commands/Stop.java4
6 files changed, 60 insertions, 17 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/commands/About.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/About.java
index c500dd6..76cd28b 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/commands/About.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/About.java
@@ -9,7 +9,7 @@ public class About implements ICommand {
public void execute(CommandSender sender, String[] args) {
sender.sendMessage(
- String.format("%s%sHide and Seek %s(1.2.0%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
+ String.format("%s%sHide and Seek %s(1.3.0%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/commands/Reload.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/Reload.java
new file mode 100644
index 0000000..04128c5
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/Reload.java
@@ -0,0 +1,29 @@
+package net.tylermurphy.hideAndSeek.commands;
+
+import org.bukkit.command.CommandSender;
+
+import net.tylermurphy.hideAndSeek.Store;
+import net.tylermurphy.hideAndSeek.util.ICommand;
+
+import static net.tylermurphy.hideAndSeek.Store.*;
+
+public class Reload implements ICommand {
+
+ public void execute(CommandSender sender, String[] args) {
+ Store.loadConfig();
+ sender.sendMessage(messagePrefix + "Reloaded the config");
+ }
+
+ public String getLabel() {
+ return "reload";
+ }
+
+ public String getUsage() {
+ return "";
+ }
+
+ public String getDescription() {
+ return "Reloads the config";
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java
index a485c91..e94c781 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java
@@ -1,5 +1,10 @@
package net.tylermurphy.hideAndSeek.commands;
+import static net.tylermurphy.hideAndSeek.Store.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@@ -7,8 +12,6 @@ import org.bukkit.util.Vector;
import net.tylermurphy.hideAndSeek.util.Functions;
import net.tylermurphy.hideAndSeek.util.ICommand;
-import static net.tylermurphy.hideAndSeek.Store.*;
-
public class SetBorder implements ICommand {
public void execute(CommandSender sender, String[] args) {
@@ -21,8 +24,10 @@ public class SetBorder implements ICommand {
return;
}
if(args.length < 2) {
- getConfig().set("borderEnabled", false);
worldborderEnabled = false;
+ Map<String, Object> temp = new HashMap<String,Object>();
+ temp.put("enabled", false);
+ addToSection("worldBorder",temp);
saveConfig();
sender.sendMessage(messagePrefix + "Disabled worldborder.");
Functions.resetWorldborder();
@@ -53,12 +58,15 @@ public class SetBorder implements ICommand {
worldborderPosition = newWorldborderPosition;
worldborderSize = num;
worldborderDelay = delay;
- sender.sendMessage(messagePrefix + "Set border center to current location, size to "+num+", and delay to "+delay);
- getConfig().set("borderPosition", newWorldborderPosition);
- getConfig().set("borderSize", num);
- getConfig().set("borderDelay", delay);
- getConfig().set("borderEnabled", false);
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);
+ sender.sendMessage(messagePrefix + "Set border center to current location, size to "+num+", and delay to "+delay);
saveConfig();
Functions.resetWorldborder();
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/commands/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/SetSpawnLocation.java
index 48a8d60..89b6baf 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/commands/SetSpawnLocation.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/SetSpawnLocation.java
@@ -1,13 +1,16 @@
package net.tylermurphy.hideAndSeek.commands;
+import static net.tylermurphy.hideAndSeek.Store.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import net.tylermurphy.hideAndSeek.util.ICommand;
-import static net.tylermurphy.hideAndSeek.Store.*;
-
public class SetSpawnLocation implements ICommand {
public void execute(CommandSender sender, String[] args) {
@@ -23,10 +26,13 @@ public class SetSpawnLocation implements ICommand {
spawnPosition = newSpawnPosition;
status = "Standby";
sender.sendMessage(messagePrefix + "Set spawn position to current location");
- getConfig().set("spawnPosition", newSpawnPosition);
+ 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("spawn",temp);
saveConfig();
-// Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("setworldspawn %s %s %s", player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
-// Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("spawnpoint @a %s %s %s", player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
}
public String getLabel() {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java
index 45797b8..58d6143 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java
@@ -52,7 +52,7 @@ public class Start implements ICommand {
for(Player player : playerList.values()) {
player.getInventory().clear();
player.setGameMode(GameMode.ADVENTURE);
- player.teleport(new Location(player.getWorld(), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
+ player.teleport(new Location(Bukkit.getWorld(spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
for(PotionEffect effect : player.getActivePotionEffects()){
player.removePotionEffect(effect.getType());
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/commands/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/Stop.java
index 1c31ccd..e55675e 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/commands/Stop.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/Stop.java
@@ -17,7 +17,7 @@ public class Stop implements ICommand {
public void execute(CommandSender sender, String[] args) {
if(status.equals("Starting") || status.equals("Playing")) {
- Bukkit.broadcastMessage(messagePrefix + "Game has been force stopped.");
+ Bukkit.broadcastMessage(abortPrefix + "Game has been force stopped.");
onStop();
} else {
@@ -38,7 +38,7 @@ public class Stop implements ICommand {
player.setGameMode(GameMode.ADVENTURE);
Hider.addEntry(player.getName());
player.getInventory().clear();
- player.teleport(new Location(player.getWorld(), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
+ player.teleport(new Location(Bukkit.getWorld(spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
for(PotionEffect effect : player.getActivePotionEffects()){
player.removePotionEffect(effect.getType());
}