diff --git a/.classpath b/.classpath
index b189d2c..5edfce4 100644
--- a/.classpath
+++ b/.classpath
@@ -2,7 +2,7 @@
-
+
diff --git a/bin/me/Travja/HungerArena/ChatListener.class b/bin/me/Travja/HungerArena/ChatListener.class
index 5018e5d..97f0822 100644
Binary files a/bin/me/Travja/HungerArena/ChatListener.class and b/bin/me/Travja/HungerArena/ChatListener.class differ
diff --git a/bin/me/Travja/HungerArena/CommandBlock.class b/bin/me/Travja/HungerArena/CommandBlock.class
index ab38f0a..d8963f9 100644
Binary files a/bin/me/Travja/HungerArena/CommandBlock.class and b/bin/me/Travja/HungerArena/CommandBlock.class differ
diff --git a/bin/me/Travja/HungerArena/DeathListener.class b/bin/me/Travja/HungerArena/DeathListener.class
index 3cb78b6..00650fa 100644
Binary files a/bin/me/Travja/HungerArena/DeathListener.class and b/bin/me/Travja/HungerArena/DeathListener.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$1.class b/bin/me/Travja/HungerArena/HaCommands$1.class
index d9e08d9..8317d0c 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$1.class and b/bin/me/Travja/HungerArena/HaCommands$1.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$10.class b/bin/me/Travja/HungerArena/HaCommands$10.class
index 30bdf5b..3958ea4 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$10.class and b/bin/me/Travja/HungerArena/HaCommands$10.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$11.class b/bin/me/Travja/HungerArena/HaCommands$11.class
index 56760ee..eb5544c 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$11.class and b/bin/me/Travja/HungerArena/HaCommands$11.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$12.class b/bin/me/Travja/HungerArena/HaCommands$12.class
new file mode 100644
index 0000000..35f1ab7
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$12.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$13.class b/bin/me/Travja/HungerArena/HaCommands$13.class
new file mode 100644
index 0000000..31e7406
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$13.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$14.class b/bin/me/Travja/HungerArena/HaCommands$14.class
new file mode 100644
index 0000000..c043b96
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$14.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$15.class b/bin/me/Travja/HungerArena/HaCommands$15.class
new file mode 100644
index 0000000..f6fd5c0
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$15.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$16.class b/bin/me/Travja/HungerArena/HaCommands$16.class
new file mode 100644
index 0000000..7120c09
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$16.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$17.class b/bin/me/Travja/HungerArena/HaCommands$17.class
new file mode 100644
index 0000000..a0f6ed4
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$17.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$18.class b/bin/me/Travja/HungerArena/HaCommands$18.class
new file mode 100644
index 0000000..4853cc9
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$18.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$19.class b/bin/me/Travja/HungerArena/HaCommands$19.class
new file mode 100644
index 0000000..4edd1cb
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$19.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$2.class b/bin/me/Travja/HungerArena/HaCommands$2.class
index ffedf9d..cda7bf4 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$2.class and b/bin/me/Travja/HungerArena/HaCommands$2.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$20.class b/bin/me/Travja/HungerArena/HaCommands$20.class
new file mode 100644
index 0000000..436ac17
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$20.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$21.class b/bin/me/Travja/HungerArena/HaCommands$21.class
new file mode 100644
index 0000000..9315686
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$21.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$22.class b/bin/me/Travja/HungerArena/HaCommands$22.class
new file mode 100644
index 0000000..d733656
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$22.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$23.class b/bin/me/Travja/HungerArena/HaCommands$23.class
new file mode 100644
index 0000000..2138bed
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$23.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$24.class b/bin/me/Travja/HungerArena/HaCommands$24.class
new file mode 100644
index 0000000..36cac6b
Binary files /dev/null and b/bin/me/Travja/HungerArena/HaCommands$24.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$3.class b/bin/me/Travja/HungerArena/HaCommands$3.class
index f62fae6..1a0ebac 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$3.class and b/bin/me/Travja/HungerArena/HaCommands$3.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$4.class b/bin/me/Travja/HungerArena/HaCommands$4.class
index 00524aa..e723ef7 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$4.class and b/bin/me/Travja/HungerArena/HaCommands$4.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$5.class b/bin/me/Travja/HungerArena/HaCommands$5.class
index 0f1a905..d0b42b9 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$5.class and b/bin/me/Travja/HungerArena/HaCommands$5.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$6.class b/bin/me/Travja/HungerArena/HaCommands$6.class
index 65db36d..fd4fdb0 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$6.class and b/bin/me/Travja/HungerArena/HaCommands$6.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$7.class b/bin/me/Travja/HungerArena/HaCommands$7.class
index ce5fdf9..b06a2d2 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$7.class and b/bin/me/Travja/HungerArena/HaCommands$7.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$8.class b/bin/me/Travja/HungerArena/HaCommands$8.class
index 5b99371..e1dc9da 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$8.class and b/bin/me/Travja/HungerArena/HaCommands$8.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands$9.class b/bin/me/Travja/HungerArena/HaCommands$9.class
index 9847abe..00ae019 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands$9.class and b/bin/me/Travja/HungerArena/HaCommands$9.class differ
diff --git a/bin/me/Travja/HungerArena/HaCommands.class b/bin/me/Travja/HungerArena/HaCommands.class
index bd9a409..e04a560 100644
Binary files a/bin/me/Travja/HungerArena/HaCommands.class and b/bin/me/Travja/HungerArena/HaCommands.class differ
diff --git a/bin/me/Travja/HungerArena/Signs.class b/bin/me/Travja/HungerArena/Signs.class
index bace77e..5bed806 100644
Binary files a/bin/me/Travja/HungerArena/Signs.class and b/bin/me/Travja/HungerArena/Signs.class differ
diff --git a/bin/me/Travja/HungerArena/SponsorCommands.class b/bin/me/Travja/HungerArena/SponsorCommands.class
index 4de55f5..af99bd4 100644
Binary files a/bin/me/Travja/HungerArena/SponsorCommands.class and b/bin/me/Travja/HungerArena/SponsorCommands.class differ
diff --git a/config.yml b/config.yml
index 76b1fa3..facbf97 100644
--- a/config.yml
+++ b/config.yml
@@ -1,7 +1,15 @@
# default config.yml
+# Message to display when the games start
Start_Message: '&bLet The Games Begin!'
+# If the games should automatically restart at the end
Auto_Restart: 'false'
+# If it should automatically start the countdown on warping
+Auto_Start: 'false'
+# If tributes need to type /ha confirm to join
+Need_Confirm: 'true'
+# Not yet implemented
iConomy_Support: 'false'
+# What the reward for winning is
Reward:
ID: 264
Amount: 10
@@ -46,4 +54,5 @@ Tribute_twentyone_spawn: 100,100,100
Tribute_twentytwo_spawn: 100,100,100
Tribute_twentythree_spawn: 100,100,100
Tribute_twentyfour_spawn: 100,100,100
-Spawn_set: false
\ No newline at end of file
+# If /ha setspawn has been run
+Spawn_set: 'false'
\ No newline at end of file
diff --git a/src/me/Travja/HungerArena/ChatListener.java b/src/me/Travja/HungerArena/ChatListener.java
index 9fa6d34..c7b839a 100644
--- a/src/me/Travja/HungerArena/ChatListener.java
+++ b/src/me/Travja/HungerArena/ChatListener.java
@@ -24,12 +24,12 @@ public class ChatListener implements Listener {
List near = p.getNearbyEntities(radius, radius, radius);
event.setCancelled(true);
if(!(near.size()== 0)){
- for(Entity e:near){
- if(e instanceof Player){
- p.sendMessage(msg);
- ((Player) e).sendMessage(msg);
+ p.sendMessage(msg);
+ for(Entity e:near){
+ if(e instanceof Player){
+ ((Player) e).sendMessage(msg);
+ }
}
- }
}else if(near.size()== 0){
p.sendMessage(msg);
p.sendMessage(ChatColor.YELLOW + "No one near!");
@@ -42,6 +42,7 @@ public class ChatListener implements Listener {
}
}
}else{
+ event.setCancelled(true);
plugin.getServer().broadcastMessage(msg);
}
}
diff --git a/src/me/Travja/HungerArena/CommandBlock.java b/src/me/Travja/HungerArena/CommandBlock.java
index 96d162d..857a975 100644
--- a/src/me/Travja/HungerArena/CommandBlock.java
+++ b/src/me/Travja/HungerArena/CommandBlock.java
@@ -16,7 +16,7 @@ public class CommandBlock implements Listener {
public void CatchCommand(PlayerCommandPreprocessEvent event){
String cmd = event.getMessage();
Player p = event.getPlayer();
- if(!cmd.contains("/ha") && plugin.Playing.contains(p)){
+ if(!cmd.contains("/ha") && plugin.Playing.contains(p) && plugin.canjoin== true){
event.setCancelled(true);
p.sendMessage(ChatColor.RED + "You are only allowed to use /ha commands!");
}
diff --git a/src/me/Travja/HungerArena/DeathListener.java b/src/me/Travja/HungerArena/DeathListener.java
index 47edd18..3194a57 100644
--- a/src/me/Travja/HungerArena/DeathListener.java
+++ b/src/me/Travja/HungerArena/DeathListener.java
@@ -1,7 +1,6 @@
package me.Travja.HungerArena;
import org.bukkit.ChatColor;
-import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
@@ -24,7 +23,7 @@ public class DeathListener implements Listener{
Player p = event.getPlayer();
if(plugin.Dead.contains(p)){
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
- World spawnw = p.getWorld();
+ World spawnw = plugin.getServer().getWorld(Spawncoords[3]);
double spawnx = Double.parseDouble(Spawncoords[0]);
double spawny = Double.parseDouble(Spawncoords[1]);
double spawnz = Double.parseDouble(Spawncoords[2]);
@@ -37,9 +36,20 @@ public class DeathListener implements Listener{
Player p = event.getEntity();
Server s = p.getServer();
String pname = p.getName();
+ String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
+ World spawnw = plugin.getServer().getWorld(Spawncoords[3]);
+ double spawnx = Double.parseDouble(Spawncoords[0]);
+ double spawny = Double.parseDouble(Spawncoords[1]);
+ double spawnz = Double.parseDouble(Spawncoords[2]);
+ Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
if(plugin.Playing.contains(p)){
if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){
- p.getWorld().playEffect(p.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0, 300);
+ double y = p.getLocation().getY();
+ double newy = y+200;
+ double x = p.getLocation().getX();
+ double z = p.getLocation().getZ();
+ Location strike = new Location(p.getWorld(), x, newy, z);
+ p.getWorld().strikeLightning(strike);
}
plugin.Dead.add(p);
plugin.Playing.remove(p);
@@ -56,21 +66,23 @@ public class DeathListener implements Listener{
String winnername = winner.getName();
s.broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
winner.getInventory().clear();
+ winner.teleport(Spawn);
winner.getInventory().setBoots(null);
winner.getInventory().setChestplate(null);
winner.getInventory().setHelmet(null);
winner.getInventory().setLeggings(null);
winner.getInventory().addItem(plugin.Reward);
}
+ plugin.Playing.clear();
for(Player spectator:plugin.Watching){
spectator.setAllowFlight(false);
+ spectator.teleport(Spawn);
for(Player online:plugin.getServer().getOnlinePlayers()){
online.showPlayer(spectator);
}
}
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
plugin.Dead.clear();
- plugin.Playing.clear();
plugin.Quit.clear();
plugin.Watching.clear();
plugin.Frozen.clear();
@@ -90,21 +102,23 @@ public class DeathListener implements Listener{
String winnername = winner.getName();
s.broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
winner.getInventory().clear();
+ winner.teleport(Spawn);
winner.getInventory().setBoots(null);
winner.getInventory().setChestplate(null);
winner.getInventory().setHelmet(null);
winner.getInventory().setLeggings(null);
winner.getInventory().addItem(plugin.Reward);
}
+ plugin.Playing.clear();
for(Player spectator:plugin.Watching){
spectator.setAllowFlight(false);
+ spectator.teleport(Spawn);
for(Player online:plugin.getServer().getOnlinePlayers()){
online.showPlayer(spectator);
}
}
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
plugin.Dead.clear();
- plugin.Playing.clear();
plugin.Quit.clear();
plugin.Watching.clear();
plugin.Frozen.clear();
@@ -121,21 +135,23 @@ public class DeathListener implements Listener{
String winnername = winner.getName();
s.broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
winner.getInventory().clear();
+ winner.teleport(Spawn);
winner.getInventory().setBoots(null);
winner.getInventory().setChestplate(null);
winner.getInventory().setHelmet(null);
winner.getInventory().setLeggings(null);
winner.getInventory().addItem(plugin.Reward);
}
+ plugin.Playing.clear();
for(Player spectator:plugin.Watching){
spectator.setAllowFlight(false);
+ spectator.teleport(Spawn);
for(Player online:plugin.getServer().getOnlinePlayers()){
online.showPlayer(spectator);
}
}
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
plugin.Dead.clear();
- plugin.Playing.clear();
plugin.Quit.clear();
plugin.Watching.clear();
plugin.Frozen.clear();
diff --git a/src/me/Travja/HungerArena/HaCommands.java b/src/me/Travja/HungerArena/HaCommands.java
index e8d6684..0f97cb1 100644
--- a/src/me/Travja/HungerArena/HaCommands.java
+++ b/src/me/Travja/HungerArena/HaCommands.java
@@ -23,35 +23,745 @@ public class HaCommands implements CommandExecutor {
@SuppressWarnings("unchecked")
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
- Player p = (Player) sender;
- String pname = p.getName();
- ChatColor c = ChatColor.AQUA;
- if(cmd.getName().equalsIgnoreCase("Ha")){
- if(args.length== 0){
- sender.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja!");
- return false;
+ if(sender instanceof Player){
+ Player p = (Player) sender;
+ String pname = p.getName();
+ ChatColor c = ChatColor.AQUA;
+ if(cmd.getName().equalsIgnoreCase("Ha")){
+ if(args.length== 0){
+ p.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja!");
+ return false;
+ }
+ if(args[0].equalsIgnoreCase("Help")){
+ p.sendMessage(ChatColor.GREEN + "----HungerArena Help----");
+ p.sendMessage(c + "/ha - Displays author message!");
+ sender.sendMessage(c + "/ha help - Displays this screen!");
+ sender.sendMessage(c + "/ha join - Makes you join the game!");
+ sender.sendMessage(c + "/ha leave - Makes you leave the game!");
+ sender.sendMessage(c + "/ha watch - Lets you watch the tributes!");
+ sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!");
+ sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!");
+ sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!");
+ sender.sendMessage(c + "/ha restart - Makes it so dead tributes can join again!");
+ sender.sendMessage(c + "/ha warpall - Warps all tribute into position!");
+ sender.sendMessage(c + "/ha reload - Reloads the config!");
+ sender.sendMessage(c + "/ha start - Unfreezes tributes allowing them to fight!");
+ sender.sendMessage(c + "/ha list - Shows a list of players in the game and their health!");
+ sender.sendMessage(c + "/startpoint [1,2,3,4,etc] - Sets the starting points of tributes!");
+ sender.sendMessage(ChatColor.GREEN + "----------------------");
+ return false;
+ }
+ if(args[0].equalsIgnoreCase("List")){
+ if(p.hasPermission("HungerArena.GameMaker") || sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.AQUA + "-----People Playing-----");
+ for(Player players:plugin.Playing){
+ sender.sendMessage(ChatColor.GREEN + players.getDisplayName() + " Life: " + players.getHealth() + "/20");
+ }
+ if(plugin.Playing.size()== 0){
+ sender.sendMessage(ChatColor.GRAY + "No one is playing!");
+ }
+ sender.sendMessage(ChatColor.AQUA + "----------------------");
+ }else{
+ sender.sendMessage(ChatColor.RED + "You don't have permission!");
+ }
+ }
+ if(args[0].equalsIgnoreCase("SetSpawn")){
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
+ }else if(p.hasPermission("HungerArena.SetSpawn")){
+ double x = p.getLocation().getX();
+ double y = p.getLocation().getY();
+ double z = p.getLocation().getZ();
+ String w = p.getWorld().getName();
+ plugin.config.set("Spawn_coords", x + "," + y + "," + z + "," + w);
+ plugin.config.set("Spawns_set", "true");
+ plugin.saveConfig();
+ p.sendMessage(ChatColor.AQUA + "You have set the spawn for dead tributes!");
+ }else{
+ p.sendMessage(ChatColor.RED + "You don't have permission!");
+ }
+ }
+ String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
+ double spawnx = Double.parseDouble(Spawncoords[0]);
+ double spawny = Double.parseDouble(Spawncoords[1]);
+ double spawnz = Double.parseDouble(Spawncoords[2]);
+ String spawnworld = Spawncoords[3];
+ World spawnw = plugin.getServer().getWorld(spawnworld);
+ Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
+ if(args[0].equalsIgnoreCase("Join")){
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
+ }else if(p.hasPermission("HungerArena.Join")){
+ if(plugin.Playing.contains(p)){
+ p.sendMessage(ChatColor.RED + "You are already playing!");
+ }else if(plugin.Dead.contains(p) || plugin.Quit.contains(p)){
+ p.sendMessage(ChatColor.RED + "You DIED/QUIT! You can't join again!");
+ }else if(plugin.Playing.size()== 24){
+ p.sendMessage(ChatColor.RED + "There are already 24 Tributes!");
+ }else if(plugin.canjoin== true){
+ p.sendMessage(ChatColor.RED + "The game is in progress!");
+ }else if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){
+ p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!");
+ }else if(plugin.NeedConfirm.contains(p)){
+ p.sendMessage(ChatColor.RED + "You need to do /ha confirm");
+ }else if(plugin.config.getString("Need_Confirm").equalsIgnoreCase("true")){
+ plugin.NeedConfirm.add(p);
+ p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede");
+ }else{
+ plugin.Playing.add(p);
+ p.getInventory().clear();
+ p.getInventory().setBoots(null);
+ p.getInventory().setChestplate(null);
+ p.getInventory().setHelmet(null);
+ p.getInventory().setLeggings(null);
+ plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined the Game!");
+ if(plugin.Playing.size()== 24){
+ p.performCommand("ha warpall");
+ }
+ }
+ }else{
+ p.sendMessage(ChatColor.RED + "You don't have permission!");
+ }
+ }
+ if(args[0].equalsIgnoreCase("Confirm")){
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
+ }else if(plugin.NeedConfirm.contains(p)){
+ plugin.Playing.add(p);
+ plugin.NeedConfirm.remove(p);
+ p.getInventory().clear();
+ p.getInventory().setBoots(null);
+ p.getInventory().setChestplate(null);
+ p.getInventory().setHelmet(null);
+ p.getInventory().setLeggings(null);
+ plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined the Game!");
+ if(plugin.Playing.size()== 24){
+ p.performCommand("ha warpall");
+ }
+ }
+ }
+ if(args[0].equalsIgnoreCase("Ready")){
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
+ }else if(plugin.Playing.contains(p)){
+ plugin.Ready.add(p);
+ p.sendMessage(ChatColor.AQUA + "You have marked yourself as READY!");
+ if(plugin.Playing.size()== plugin.Ready.size()){
+ Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha warpall");
+ }
+ }else if(!plugin.Playing.contains(p)){
+ p.sendMessage(ChatColor.RED + "You aren't playing!");
+ }
+ }
+ if(args[0].equalsIgnoreCase("Leave")){
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
+ }else if(!plugin.Playing.contains(p)){
+ p.sendMessage(ChatColor.RED + "You aren't playing!");
+ }else{
+ plugin.Playing.remove(p);
+ plugin.Quit.add(p);
+ p.sendMessage(ChatColor.AQUA + "You have left the game!");
+ p.getServer().broadcastMessage(ChatColor.RED + pname + " Quit!");
+ p.getInventory().clear();
+ p.getInventory().setBoots(null);
+ p.getInventory().setChestplate(null);
+ p.getInventory().setHelmet(null);
+ p.getInventory().setLeggings(null);
+ p.teleport(Spawn);
+ if(plugin.Frozen.contains(p)){
+ plugin.Frozen.remove(p);
+ }
+ if(plugin.Playing.size()== 1 && plugin.canjoin== true){
+ for(Player winner:plugin.Playing){
+ String winnername = winner.getName();
+ p.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
+ winner.getInventory().clear();
+ winner.getInventory().addItem(plugin.Reward);
+ }
+ for(Player spectator:plugin.Watching){
+ spectator.setAllowFlight(false);
+ }
+ plugin.canjoin= false;
+ plugin.Watching.clear();
+ }
+ }
+ }
+ if(args[0].equalsIgnoreCase("Watch")){
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
+ }else if(sender.hasPermission("HungerArena.Watch")){
+ if(!plugin.Watching.contains(p) && !plugin.Playing.contains(p) && plugin.canjoin== true){
+ plugin.Watching.add(p);
+ for(Player online:plugin.getServer().getOnlinePlayers()){
+ online.hidePlayer(p);
+ }
+ p.setAllowFlight(true);
+ p.sendMessage(ChatColor.AQUA + "You can now spectate!");
+ }else if(plugin.canjoin == false){
+ p.sendMessage(ChatColor.RED + "The game isn't in progress!");
+ }else if(plugin.Playing.contains(p)){
+ p.sendMessage(ChatColor.RED + "You can't watch while you're playing!");
+ }else if(plugin.Watching.contains(p)){
+ plugin.Watching.remove(p);
+ for(Player online:plugin.getServer().getOnlinePlayers()){
+ online.showPlayer(p);
+ }
+ p.teleport(Spawn);
+ p.setAllowFlight(false);
+ sender.sendMessage(ChatColor.AQUA + "You are not spectating anymore");
+ }
+ }else{
+ sender.sendMessage(ChatColor.RED + "You don't have permission!");
+ }
+ }
+ if(args[0].equalsIgnoreCase("Kick")){
+ Player target = plugin.getServer().getPlayer(args[1]);
+ if(sender.hasPermission("HungerArena.Kick") || sender instanceof ConsoleCommandSender){
+ if(plugin.Playing.contains(target)){
+ if(p.isOnline()){
+ plugin.Playing.remove(target);
+ plugin.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from the game!");
+ target.teleport(Spawn);
+ target.getInventory().clear();
+ target.getInventory().setBoots(null);
+ target.getInventory().setChestplate(null);
+ target.getInventory().setHelmet(null);
+ target.getInventory().setLeggings(null);
+ plugin.Quit.add(target);
+ if(plugin.Playing.size()== 1 && plugin.canjoin== true){
+ for(Player winner:plugin.Playing){
+ String winnername = winner.getName();
+ sender.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
+ winner.getInventory().clear();
+ winner.getInventory().addItem(plugin.Reward);
+ }
+ for(Player spectator:plugin.Watching){
+ spectator.setAllowFlight(false);
+ }
+ plugin.canjoin= false;
+ plugin.Watching.clear();
+ }else{
+ plugin.Playing.remove(target);
+ plugin.Quit.add(target);
+ }
+ }
+ }else{
+ sender.sendMessage(ChatColor.RED + "That player isn't in the game!");
+ }
+ }else{
+ sender.sendMessage(ChatColor.RED + "You don't have permission!");
+ }
+ }
+ if(args[0].equalsIgnoreCase("Refill")){
+ int list056;
+ list056 = 0;
+ int limit = plugin.getConfig().getStringList("StorageXYZ").size();
+ while(limit > list056){
+ String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056);
+ int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X");
+ int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y");
+ int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z");
+ String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W");
+ Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz);
+ plugin.exists = false;
+ if(blockatlocation.getState() instanceof Chest){
+ plugin.exists = true;
+ Chest chest = (Chest) blockatlocation.getState();
+ chest.getInventory().clear();
+ ItemStack[] itemsinchest = null;
+ Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage");
+ if(o instanceof ItemStack[]){
+ itemsinchest = (ItemStack[]) o;
+ }else if(o instanceof List){
+ itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]);
+ }
+ list056 = list056+1;
+ chest.getInventory().setContents(itemsinchest);
+ }
+ }
+ if(limit== list056){
+ sender.sendMessage(ChatColor.GREEN + "All chests refilled!");
+ }
+ }
+ if(args[0].equalsIgnoreCase("Restart")){
+ if(sender.hasPermission("HungerArena.Restart") || sender instanceof ConsoleCommandSender){
+ for(Player spectator:plugin.Watching){
+ spectator.setAllowFlight(false);
+ for(Player online:plugin.getServer().getOnlinePlayers()){
+ online.showPlayer(spectator);
+ }
+ }
+ plugin.Dead.clear();
+ plugin.Playing.clear();
+ plugin.Quit.clear();
+ plugin.Watching.clear();
+ plugin.Frozen.clear();
+ plugin.canjoin = false;
+ sender.sendMessage(ChatColor.AQUA + "The games have been reset!");
+ }else{
+ sender.sendMessage(ChatColor.RED + "You don't have permission!");
+ }
+ }
+ if(args[0].equalsIgnoreCase("Reload")){
+ plugin.reloadConfig();
+ sender.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!");
+ }
+ if(args[0].equalsIgnoreCase("WarpAll")){
+ if(sender.hasPermission("HungerArena.Warpall") || sender instanceof ConsoleCommandSender){
+ if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){
+ sender.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!");
+ }else{
+ if(plugin.Playing.size()== 1){
+ sender.sendMessage(ChatColor.RED + "There are not enough players!");
+ }
+ if(plugin.Playing.size()>= 2){
+ plugin.config.getString("Tribute_one_spawn");
+ String[] onecoords = plugin.config.getString("Tribute_one_spawn").split(",");
+ Player Tribute_one = plugin.Playing.get(0);
+ double x = Double.parseDouble(onecoords[0]);
+ double y = Double.parseDouble(onecoords[1]);
+ double z = Double.parseDouble(onecoords[2]);
+ String world = onecoords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location oneloc = new Location(w, x, y, z);
+ Tribute_one.teleport(oneloc);
+ plugin.Frozen.add(Tribute_one);
+ Tribute_one.setFoodLevel(20);
+ plugin.config.getString("Tribute_two_spawn");
+ String[] twocoords = plugin.config.getString("Tribute_two_spawn").split(",");
+ Player Tribute_two = plugin.Playing.get(1);
+ double twox = Double.parseDouble(twocoords[0]);
+ double twoy = Double.parseDouble(twocoords[1]);
+ double twoz = Double.parseDouble(twocoords[2]);
+ String twoworld = twocoords[3];
+ World twow = plugin.getServer().getWorld(twoworld);
+ Location twoloc = new Location(twow, twox, twoy, twoz);
+ Tribute_two.teleport(twoloc);
+ plugin.Frozen.add(Tribute_two);
+ Tribute_two.setFoodLevel(20);
+ p.getWorld().setTime(0);
+ }
+ if(plugin.Playing.size()>= 3){
+ plugin.config.getString("Tribute_three_spawn");
+ String[] coords = plugin.config.getString("Tribute_three_spawn").split(",");
+ Player Tribute_three = plugin.Playing.get(2);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_three.teleport(loc);
+ plugin.Frozen.add(Tribute_three);
+ Tribute_three.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 4){
+ plugin.config.getString("Tribute_four_spawn");
+ String[] coords = plugin.config.getString("Tribute_four_spawn").split(",");
+ Player Tribute_four = plugin.Playing.get(3);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_four.teleport(loc);
+ plugin.Frozen.add(Tribute_four);
+ Tribute_four.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 5){
+ plugin.config.getString("Tribute_five_spawn");
+ String[] coords = plugin.config.getString("Tribute_five_spawn").split(",");
+ Player Tribute_five = plugin.Playing.get(4);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_five.teleport(loc);
+ plugin.Frozen.add(Tribute_five);
+ Tribute_five.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 6){
+ plugin.config.getString("Tribute_six_spawn");
+ String[] coords = plugin.config.getString("Tribute_six_spawn").split(",");
+ Player Tribute_six = plugin.Playing.get(5);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_six.teleport(loc);
+ plugin.Frozen.add(Tribute_six);
+ Tribute_six.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 7){
+ plugin.config.getString("Tribute_seven_spawn");
+ String[] coords = plugin.config.getString("Tribute_seven_spawn").split(",");
+ Player Tribute_seven = plugin.Playing.get(6);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_seven.teleport(loc);
+ plugin.Frozen.add(Tribute_seven);
+ Tribute_seven.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 8){
+ plugin.config.getString("Tribute_eight_spawn");
+ String[] coords = plugin.config.getString("Tribute_eight_spawn").split(",");
+ Player Tribute_eight = plugin.Playing.get(7);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_eight.teleport(loc);
+ plugin.Frozen.add(Tribute_eight);
+ Tribute_eight.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 9){
+ plugin.config.getString("Tribute_nine_spawn");
+ String[] coords = plugin.config.getString("Tribute_nine_spawn").split(",");
+ Player Tribute_nine = plugin.Playing.get(8);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_nine.teleport(loc);
+ plugin.Frozen.add(Tribute_nine);
+ Tribute_nine.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 10){
+ plugin.config.getString("Tribute_ten_spawn");
+ String[] coords = plugin.config.getString("Tribute_ten_spawn").split(",");
+ Player Tribute_ten = plugin.Playing.get(9);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_ten.teleport(loc);
+ plugin.Frozen.add(Tribute_ten);
+ Tribute_ten.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 11){
+ plugin.config.getString("Tribute_eleven_spawn");
+ String[] coords = plugin.config.getString("Tribute_eleven_spawn").split(",");
+ Player Tribute_eleven = plugin.Playing.get(10);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_eleven.teleport(loc);
+ plugin.Frozen.add(Tribute_eleven);
+ Tribute_eleven.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 12){
+ plugin.config.getString("Tribute_twelve_spawn");
+ String[] coords = plugin.config.getString("Tribute_twelve_spawn").split(",");
+ Player Tribute_twelve = plugin.Playing.get(11);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twelve.teleport(loc);
+ plugin.Frozen.add(Tribute_twelve);
+ Tribute_twelve.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 13){
+ plugin.config.getString("Tribute_thirteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_thirteen_spawn").split(",");
+ Player Tribute_thirteen = plugin.Playing.get(12);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_thirteen.teleport(loc);
+ plugin.Frozen.add(Tribute_thirteen);
+ Tribute_thirteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 14){
+ plugin.config.getString("Tribute_fourteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_fourteen_spawn").split(",");
+ Player Tribute_fourteen = plugin.Playing.get(13);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_fourteen.teleport(loc);
+ plugin.Frozen.add(Tribute_fourteen);
+ Tribute_fourteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 15){
+ plugin.config.getString("Tribute_fifteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_fifteen_spawn").split(",");
+ Player Tribute_fifteen = plugin.Playing.get(14);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_fifteen.teleport(loc);
+ plugin.Frozen.add(Tribute_fifteen);
+ Tribute_fifteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 16){
+ plugin.config.getString("Tribute_sixteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_sixteen_spawn").split(",");
+ Player Tribute_sixteen = plugin.Playing.get(15);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_sixteen.teleport(loc);
+ plugin.Frozen.add(Tribute_sixteen);
+ Tribute_sixteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 17){
+ plugin.config.getString("Tribute_seventeen_spawn");
+ String[] coords = plugin.config.getString("Tribute_seventeen_spawn").split(",");
+ Player Tribute_seventeen = plugin.Playing.get(16);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_seventeen.teleport(loc);
+ plugin.Frozen.add(Tribute_seventeen);
+ Tribute_seventeen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 18){
+ plugin.config.getString("Tribute_eighteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_eighteen_spawn").split(",");
+ Player Tribute_eighteen = plugin.Playing.get(17);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_eighteen.teleport(loc);
+ plugin.Frozen.add(Tribute_eighteen);
+ Tribute_eighteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 19){
+ plugin.config.getString("Tribute_nineteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_nineteen_spawn").split(",");
+ Player Tribute_nineteen = plugin.Playing.get(18);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_nineteen.teleport(loc);
+ plugin.Frozen.add(Tribute_nineteen);
+ Tribute_nineteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 20){
+ plugin.config.getString("Tribute_twenty_spawn");
+ String[] coords = plugin.config.getString("Tribute_twenty_spawn").split(",");
+ Player Tribute_twenty = plugin.Playing.get(19);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twenty.teleport(loc);
+ plugin.Frozen.add(Tribute_twenty);
+ Tribute_twenty.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 21){
+ plugin.config.getString("Tribute_twentyone_spawn");
+ String[] coords = plugin.config.getString("Tribute_twentyone_spawn").split(",");
+ Player Tribute_twentyone = plugin.Playing.get(20);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twentyone.teleport(loc);
+ plugin.Frozen.add(Tribute_twentyone);
+ Tribute_twentyone.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 22){
+ plugin.config.getString("Tribute_twentytwo_spawn");
+ String[] coords = plugin.config.getString("Tribute_twentytwo_spawn").split(",");
+ Player Tribute_twentytwo = plugin.Playing.get(21);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twentytwo.teleport(loc);
+ plugin.Frozen.add(Tribute_twentytwo);
+ Tribute_twentytwo.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 23){
+ plugin.config.getString("Tribute_twentythree_spawn");
+ String[] coords = plugin.config.getString("Tribute_twentythree_spawn").split(",");
+ Player Tribute_twentythree = plugin.Playing.get(22);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twentythree.teleport(loc);
+ plugin.Frozen.add(Tribute_twentythree);
+ Tribute_twentythree.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 24){
+ plugin.config.getString("Tribute_twentyfour_spawn");
+ String[] coords = plugin.config.getString("Tribute_twentyfour_spawn").split(",");
+ Player Tribute_twentyfour = plugin.Playing.get(23);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twentyfour.teleport(loc);
+ plugin.Frozen.add(Tribute_twentyfour);
+ Tribute_twentyfour.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 2){
+ if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start");
+ }
+ }, 20L);
+ }
+ }
+ }
+ }
+ }
}
- if(args[0].equalsIgnoreCase("Help")){
- sender.sendMessage(ChatColor.GREEN + "----HungerArena Help----");
- sender.sendMessage(c + "/ha - Displays author message!");
- sender.sendMessage(c + "/ha help - Displays this screen!");
- sender.sendMessage(c + "/ha join - Makes you join the game!");
- sender.sendMessage(c + "/ha leave - Makes you leave the game!");
- sender.sendMessage(c + "/ha watch - Lets you watch the tributes!");
- sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!");
- sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!");
- sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!");
- sender.sendMessage(c + "/ha restart - Makes it so dead tributes can join again!");
- sender.sendMessage(c + "/ha warpall - Warps all tribute into position!");
- sender.sendMessage(c + "/ha reload - Reloads the config!");
- sender.sendMessage(c + "/ha start - Unfreezes tributes allowing them to fight!");
- sender.sendMessage(c + "/ha list - Shows a list of players in the game and their health!");
- sender.sendMessage(c + "/startpoint [1,2,3,4,etc] - Sets the starting points of tributes!");
- sender.sendMessage(ChatColor.GREEN + "----------------------");
- return false;
+ if(args[0].equalsIgnoreCase("Start")){
+ String begin = plugin.config.getString("Start_Message");
+ begin = begin.replaceAll("(&([a-f0-9]))", "\u00A7$2");
+ final String msg = begin;
+ if(p.hasPermission("HungerArena.Start")){
+ if(plugin.config.getString("Countdown").equalsIgnoreCase("true")){
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("10");
+ }
+ }, 20L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("9");
+ }
+ }, 40L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("8");
+ }
+ }, 60L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("7");
+ }
+ }, 80L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("6");
+ }
+ }, 100L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("5");
+ }
+ }, 120L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("4");
+ }
+ }, 140L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("3");
+ }
+ }, 160L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("2");
+ }
+ }, 180L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("1");
+ }
+ }, 200L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.Frozen.clear();
+ plugin.getServer().broadcastMessage(msg);
+ plugin.canjoin = true;
+ }
+ }, 220L);
+ }else{
+ plugin.Frozen.clear();
+ p.getServer().broadcastMessage(ChatColor.AQUA + "Let the Games Begin!!");
+ plugin.canjoin = true;
+ }
+ }else{
+ p.sendMessage(ChatColor.RED + "You don't have permission!");
+ }
}
- if(args[0].equalsIgnoreCase("List")){
- if(sender instanceof ConsoleCommandSender){
+ }else if(sender instanceof ConsoleCommandSender){
+ if(cmd.getName().equalsIgnoreCase("Ha")){
+ if(args.length== 0){
+ sender.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja!");
+ return false;
+ }
+ if(args[0].equalsIgnoreCase("Help")){
+ ChatColor c = ChatColor.AQUA;
+ sender.sendMessage(ChatColor.GREEN + "----HungerArena Help----");
+ sender.sendMessage(c + "/ha - Displays author message!");
+ sender.sendMessage(c + "/ha help - Displays this screen!");
+ sender.sendMessage(c + "/ha join - Makes you join the game!");
+ sender.sendMessage(c + "/ha leave - Makes you leave the game!");
+ sender.sendMessage(c + "/ha watch - Lets you watch the tributes!");
+ sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!");
+ sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!");
+ sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!");
+ sender.sendMessage(c + "/ha restart - Makes it so dead tributes can join again!");
+ sender.sendMessage(c + "/ha warpall - Warps all tribute into position!");
+ sender.sendMessage(c + "/ha reload - Reloads the config!");
+ sender.sendMessage(c + "/ha start - Unfreezes tributes allowing them to fight!");
+ sender.sendMessage(c + "/ha list - Shows a list of players in the game and their health!");
+ sender.sendMessage(c + "/startpoint [1,2,3,4,etc] - Sets the starting points of tributes!");
+ sender.sendMessage(ChatColor.GREEN + "----------------------");
+ return false;
+ }
+ if(args[0].equalsIgnoreCase("List")){
sender.sendMessage(ChatColor.AQUA + "-----People Playing-----");
for(Player players:plugin.Playing){
sender.sendMessage(ChatColor.GREEN + players.getDisplayName() + " Life: " + players.getHealth() + "/20");
@@ -61,31 +771,10 @@ public class HaCommands implements CommandExecutor {
}
sender.sendMessage(ChatColor.AQUA + "----------------------");
}
- if(p.hasPermission("HungerArena.GameMaker")){
- p.sendMessage(ChatColor.AQUA + "-----People Playing-----");
- for(Player players:plugin.Playing){
- p.sendMessage(ChatColor.GREEN + players.getDisplayName() + " Life: " + players.getHealth() + "/20");
- }
- if(plugin.Playing.size()== 0){
- p.sendMessage(ChatColor.GRAY + "No one is playing!");
- }
- p.sendMessage(ChatColor.AQUA + "----------------------");
- }else{
- p.sendMessage(ChatColor.RED + "You don't have permission!");
- }
}
if(args[0].equalsIgnoreCase("SetSpawn")){
- if(p.hasPermission("HungerArena.SetSpawn")){
- double x = p.getLocation().getX();
- double y = p.getLocation().getY();
- double z = p.getLocation().getZ();
- String w = p.getWorld().getName();
- plugin.config.set("Spawn_coords", x + "," + y + "," + z + "," + w);
- plugin.config.set("Spawns_set", "true");
- plugin.saveConfig();
- p.sendMessage(ChatColor.AQUA + "You have set the spawn for dead tributes!");
- }else{
- p.sendMessage(ChatColor.RED + "You don't have permission!");
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
}
}
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
@@ -96,147 +785,62 @@ public class HaCommands implements CommandExecutor {
World spawnw = plugin.getServer().getWorld(spawnworld);
Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
if(args[0].equalsIgnoreCase("Join")){
- if(p.hasPermission("HungerArena.Join")){
- if(plugin.Playing.contains(p)){
- p.sendMessage(ChatColor.RED + "You are already playing!");
- }else if(plugin.Dead.contains(p) || plugin.Quit.contains(p)){
- p.sendMessage(ChatColor.RED + "You DIED/QUIT! You can't join again!");
- }else if(plugin.Playing.size()== 24){
- p.sendMessage(ChatColor.RED + "There are already 24 Tributes!");
- }else if(plugin.canjoin== true){
- p.sendMessage(ChatColor.RED + "The game is in progress!");
- }else if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){
- p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!");
- }else if(plugin.NeedConfirm.contains(p)){
- p.sendMessage(ChatColor.RED + "You need to do /ha confirm");
- }else{
- plugin.NeedConfirm.add(p);
- p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede");
- }
- }else{
- p.sendMessage(ChatColor.RED + "You don't have permission!");
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
}
}
if(args[0].equalsIgnoreCase("Confirm")){
- if(plugin.NeedConfirm.contains(p)){
- plugin.Playing.add(p);
- plugin.NeedConfirm.remove(p);
- p.getInventory().clear();
- p.getInventory().setBoots(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setHelmet(null);
- p.getInventory().setLeggings(null);
- plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined the Game!");
- if(plugin.Playing.size()== 24){
- p.performCommand("ha warpall");
- }
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
}
}
if(args[0].equalsIgnoreCase("Ready")){
- if(plugin.Playing.contains(p)){
- plugin.Ready.add(p);
- p.sendMessage(ChatColor.AQUA + "You have marked yourself as READY!");
- if(plugin.Playing.size()== plugin.Ready.size()){
- p.performCommand("Ha Warpall");
- }
- }else if(!plugin.Playing.contains(p)){
- p.sendMessage(ChatColor.RED + "You aren't playing!");
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
}
}
if(args[0].equalsIgnoreCase("Leave")){
- if(!plugin.Playing.contains(p)){
- p.sendMessage(ChatColor.RED + "You aren't playing!");
- }else{
- plugin.Playing.remove(p);
- plugin.Quit.add(p);
- p.sendMessage(ChatColor.AQUA + "You have left the game!");
- p.getServer().broadcastMessage(ChatColor.RED + pname + " Quit!");
- p.getInventory().clear();
- p.getInventory().setBoots(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setHelmet(null);
- p.getInventory().setLeggings(null);
- p.teleport(Spawn);
- if(plugin.Frozen.contains(p)){
- plugin.Frozen.remove(p);
- }
- if(plugin.Playing.size()== 1 && plugin.canjoin== true){
- for(Player winner:plugin.Playing){
- String winnername = winner.getName();
- p.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
- winner.getInventory().clear();
- winner.getInventory().addItem(plugin.Reward);
- }
- for(Player spectator:plugin.Watching){
- spectator.setAllowFlight(false);
- }
- plugin.canjoin= false;
- plugin.Watching.clear();
- }
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
}
}
if(args[0].equalsIgnoreCase("Watch")){
- if(p.hasPermission("HungerArena.Watch")){
- if(!plugin.Watching.contains(p) && !plugin.Playing.contains(p) && plugin.canjoin== true){
- plugin.Watching.add(p);
- for(Player online:plugin.getServer().getOnlinePlayers()){
- online.hidePlayer(p);
- }
- p.setAllowFlight(true);
- p.sendMessage(ChatColor.AQUA + "You can now spectate!");
- }else if(plugin.canjoin == false){
- p.sendMessage(ChatColor.RED + "The game isn't in progress!");
- }else if(plugin.Playing.contains(p)){
- p.sendMessage(ChatColor.RED + "You can't watch while you're playing!");
- }else if(plugin.Watching.contains(p)){
- plugin.Watching.remove(p);
- for(Player online:plugin.getServer().getOnlinePlayers()){
- online.showPlayer(p);
- }
- p.teleport(Spawn);
- p.setAllowFlight(false);
- p.sendMessage(ChatColor.AQUA + "You are not spectating anymore");
- }
- }else{
- p.sendMessage(ChatColor.RED + "You don't have permission!");
+ if(sender instanceof ConsoleCommandSender){
+ sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
}
}
if(args[0].equalsIgnoreCase("Kick")){
Player target = plugin.getServer().getPlayer(args[1]);
- if(p.hasPermission("HungerArena.Kick")){
- if(plugin.Playing.contains(target)){
- if(p.isOnline()){
- plugin.Playing.remove(target);
- plugin.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from the game!");
- target.teleport(Spawn);
- target.getInventory().clear();
- target.getInventory().setBoots(null);
- target.getInventory().setChestplate(null);
- target.getInventory().setHelmet(null);
- target.getInventory().setLeggings(null);
- plugin.Quit.add(target);
- if(plugin.Playing.size()== 1 && plugin.canjoin== true){
- for(Player winner:plugin.Playing){
- String winnername = winner.getName();
- p.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
- winner.getInventory().clear();
- winner.getInventory().addItem(plugin.Reward);
- }
- for(Player spectator:plugin.Watching){
- spectator.setAllowFlight(false);
- }
- plugin.canjoin= false;
- plugin.Watching.clear();
- }else{
- plugin.Playing.remove(target);
- plugin.Quit.add(target);
+ if(plugin.Playing.contains(target)){
+ if(target.isOnline()){
+ plugin.Playing.remove(target);
+ plugin.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from the game!");
+ target.teleport(Spawn);
+ target.getInventory().clear();
+ target.getInventory().setBoots(null);
+ target.getInventory().setChestplate(null);
+ target.getInventory().setHelmet(null);
+ target.getInventory().setLeggings(null);
+ plugin.Quit.add(target);
+ if(plugin.Playing.size()== 1 && plugin.canjoin== true){
+ for(Player winner:plugin.Playing){
+ String winnername = winner.getName();
+ sender.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
+ winner.getInventory().clear();
+ winner.getInventory().addItem(plugin.Reward);
}
+ for(Player spectator:plugin.Watching){
+ spectator.setAllowFlight(false);
+ }
+ plugin.canjoin= false;
+ plugin.Watching.clear();
+ }else{
+ plugin.Playing.remove(target);
+ plugin.Quit.add(target);
}
- }else{
- p.sendMessage(ChatColor.RED + "That player isn't in the game!");
}
}else{
- p.sendMessage(ChatColor.RED + "You don't have permission!");
+ sender.sendMessage(ChatColor.RED + "That player isn't in the game!");
}
}
if(args[0].equalsIgnoreCase("Refill")){
@@ -267,375 +871,378 @@ public class HaCommands implements CommandExecutor {
}
}
if(limit== list056){
- p.sendMessage(ChatColor.GREEN + "All chests refilled!");
+ sender.sendMessage(ChatColor.GREEN + "All chests refilled!");
}
}
if(args[0].equalsIgnoreCase("Restart")){
- if(p.hasPermission("HungerArena.Restart")){
- for(Player spectator:plugin.Watching){
- spectator.setAllowFlight(false);
- for(Player online:plugin.getServer().getOnlinePlayers()){
- online.showPlayer(spectator);
- }
+ for(Player spectator:plugin.Watching){
+ spectator.setAllowFlight(false);
+ for(Player online:plugin.getServer().getOnlinePlayers()){
+ online.showPlayer(spectator);
}
- plugin.Dead.clear();
- plugin.Playing.clear();
- plugin.Quit.clear();
- plugin.Watching.clear();
- plugin.Frozen.clear();
- plugin.canjoin = false;
- p.sendMessage(ChatColor.AQUA + "The games have been reset!");
- }else{
- p.sendMessage(ChatColor.RED + "You don't have permission!");
}
+ plugin.Dead.clear();
+ plugin.Playing.clear();
+ plugin.Quit.clear();
+ plugin.Watching.clear();
+ plugin.Frozen.clear();
+ plugin.canjoin = false;
+ sender.sendMessage(ChatColor.AQUA + "The games have been reset!");
}
- if(args[0].equalsIgnoreCase("Reload")){
- plugin.reloadConfig();
- p.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!");
- }
- if(args[0].equalsIgnoreCase("WarpAll")){
- if(p.hasPermission("HungerArena.Warpall")){
- if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){
- p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!");
- }else{
- if(plugin.Playing.size()== 1){
- p.sendMessage(ChatColor.RED + "There are not enough players!");
- }
- if(plugin.Playing.size()>= 2){
- plugin.config.getString("Tribute_one_spawn");
- String[] onecoords = plugin.config.getString("Tribute_one_spawn").split(",");
- Player Tribute_one = plugin.Playing.get(0);
- double x = Double.parseDouble(onecoords[0]);
- double y = Double.parseDouble(onecoords[1]);
- double z = Double.parseDouble(onecoords[2]);
- String world = onecoords[3];
- World w = plugin.getServer().getWorld(world);
- Location oneloc = new Location(w, x, y, z);
- Tribute_one.teleport(oneloc);
- plugin.Frozen.add(Tribute_one);
- Tribute_one.setFoodLevel(20);
- plugin.config.getString("Tribute_two_spawn");
- String[] twocoords = plugin.config.getString("Tribute_two_spawn").split(",");
- Player Tribute_two = plugin.Playing.get(1);
- double twox = Double.parseDouble(twocoords[0]);
- double twoy = Double.parseDouble(twocoords[1]);
- double twoz = Double.parseDouble(twocoords[2]);
- String twoworld = twocoords[3];
- World twow = plugin.getServer().getWorld(twoworld);
- Location twoloc = new Location(twow, twox, twoy, twoz);
- Tribute_two.teleport(twoloc);
- plugin.Frozen.add(Tribute_two);
- Tribute_two.setFoodLevel(20);
- p.getWorld().setTime(0);
- }
- if(plugin.Playing.size()>= 3){
- plugin.config.getString("Tribute_three_spawn");
- String[] coords = plugin.config.getString("Tribute_three_spawn").split(",");
- Player Tribute_three = plugin.Playing.get(2);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_three.teleport(loc);
- plugin.Frozen.add(Tribute_three);
- Tribute_three.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 4){
- plugin.config.getString("Tribute_four_spawn");
- String[] coords = plugin.config.getString("Tribute_four_spawn").split(",");
- Player Tribute_four = plugin.Playing.get(3);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_four.teleport(loc);
- plugin.Frozen.add(Tribute_four);
- Tribute_four.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 5){
- plugin.config.getString("Tribute_five_spawn");
- String[] coords = plugin.config.getString("Tribute_five_spawn").split(",");
- Player Tribute_five = plugin.Playing.get(4);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_five.teleport(loc);
- plugin.Frozen.add(Tribute_five);
- Tribute_five.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 6){
- plugin.config.getString("Tribute_six_spawn");
- String[] coords = plugin.config.getString("Tribute_six_spawn").split(",");
- Player Tribute_six = plugin.Playing.get(5);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_six.teleport(loc);
- plugin.Frozen.add(Tribute_six);
- Tribute_six.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 7){
- plugin.config.getString("Tribute_seven_spawn");
- String[] coords = plugin.config.getString("Tribute_seven_spawn").split(",");
- Player Tribute_seven = plugin.Playing.get(6);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_seven.teleport(loc);
- plugin.Frozen.add(Tribute_seven);
- Tribute_seven.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 8){
- plugin.config.getString("Tribute_eight_spawn");
- String[] coords = plugin.config.getString("Tribute_eight_spawn").split(",");
- Player Tribute_eight = plugin.Playing.get(7);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_eight.teleport(loc);
- plugin.Frozen.add(Tribute_eight);
- Tribute_eight.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 9){
- plugin.config.getString("Tribute_nine_spawn");
- String[] coords = plugin.config.getString("Tribute_nine_spawn").split(",");
- Player Tribute_nine = plugin.Playing.get(8);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_nine.teleport(loc);
- plugin.Frozen.add(Tribute_nine);
- Tribute_nine.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 10){
- plugin.config.getString("Tribute_ten_spawn");
- String[] coords = plugin.config.getString("Tribute_ten_spawn").split(",");
- Player Tribute_ten = plugin.Playing.get(9);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_ten.teleport(loc);
- plugin.Frozen.add(Tribute_ten);
- Tribute_ten.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 11){
- plugin.config.getString("Tribute_eleven_spawn");
- String[] coords = plugin.config.getString("Tribute_eleven_spawn").split(",");
- Player Tribute_eleven = plugin.Playing.get(10);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_eleven.teleport(loc);
- plugin.Frozen.add(Tribute_eleven);
- Tribute_eleven.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 12){
- plugin.config.getString("Tribute_twelve_spawn");
- String[] coords = plugin.config.getString("Tribute_twelve_spawn").split(",");
- Player Tribute_twelve = plugin.Playing.get(11);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_twelve.teleport(loc);
- plugin.Frozen.add(Tribute_twelve);
- Tribute_twelve.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 13){
- plugin.config.getString("Tribute_thirteen_spawn");
- String[] coords = plugin.config.getString("Tribute_thirteen_spawn").split(",");
- Player Tribute_thirteen = plugin.Playing.get(12);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_thirteen.teleport(loc);
- plugin.Frozen.add(Tribute_thirteen);
- Tribute_thirteen.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 14){
- plugin.config.getString("Tribute_fourteen_spawn");
- String[] coords = plugin.config.getString("Tribute_fourteen_spawn").split(",");
- Player Tribute_fourteen = plugin.Playing.get(13);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_fourteen.teleport(loc);
- plugin.Frozen.add(Tribute_fourteen);
- Tribute_fourteen.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 15){
- plugin.config.getString("Tribute_fifteen_spawn");
- String[] coords = plugin.config.getString("Tribute_fifteen_spawn").split(",");
- Player Tribute_fifteen = plugin.Playing.get(14);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_fifteen.teleport(loc);
- plugin.Frozen.add(Tribute_fifteen);
- Tribute_fifteen.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 16){
- plugin.config.getString("Tribute_sixteen_spawn");
- String[] coords = plugin.config.getString("Tribute_sixteen_spawn").split(",");
- Player Tribute_sixteen = plugin.Playing.get(15);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_sixteen.teleport(loc);
- plugin.Frozen.add(Tribute_sixteen);
- Tribute_sixteen.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 17){
- plugin.config.getString("Tribute_seventeen_spawn");
- String[] coords = plugin.config.getString("Tribute_seventeen_spawn").split(",");
- Player Tribute_seventeen = plugin.Playing.get(16);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_seventeen.teleport(loc);
- plugin.Frozen.add(Tribute_seventeen);
- Tribute_seventeen.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 18){
- plugin.config.getString("Tribute_eighteen_spawn");
- String[] coords = plugin.config.getString("Tribute_eighteen_spawn").split(",");
- Player Tribute_eighteen = plugin.Playing.get(17);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_eighteen.teleport(loc);
- plugin.Frozen.add(Tribute_eighteen);
- Tribute_eighteen.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 19){
- plugin.config.getString("Tribute_nineteen_spawn");
- String[] coords = plugin.config.getString("Tribute_nineteen_spawn").split(",");
- Player Tribute_nineteen = plugin.Playing.get(18);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_nineteen.teleport(loc);
- plugin.Frozen.add(Tribute_nineteen);
- Tribute_nineteen.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 20){
- plugin.config.getString("Tribute_twenty_spawn");
- String[] coords = plugin.config.getString("Tribute_twenty_spawn").split(",");
- Player Tribute_twenty = plugin.Playing.get(19);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_twenty.teleport(loc);
- plugin.Frozen.add(Tribute_twenty);
- Tribute_twenty.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 21){
- plugin.config.getString("Tribute_twentyone_spawn");
- String[] coords = plugin.config.getString("Tribute_twentyone_spawn").split(",");
- Player Tribute_twentyone = plugin.Playing.get(20);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_twentyone.teleport(loc);
- plugin.Frozen.add(Tribute_twentyone);
- Tribute_twentyone.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 22){
- plugin.config.getString("Tribute_twentytwo_spawn");
- String[] coords = plugin.config.getString("Tribute_twentytwo_spawn").split(",");
- Player Tribute_twentytwo = plugin.Playing.get(21);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_twentytwo.teleport(loc);
- plugin.Frozen.add(Tribute_twentytwo);
- Tribute_twentytwo.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 23){
- plugin.config.getString("Tribute_twentythree_spawn");
- String[] coords = plugin.config.getString("Tribute_twentythree_spawn").split(",");
- Player Tribute_twentythree = plugin.Playing.get(22);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_twentythree.teleport(loc);
- plugin.Frozen.add(Tribute_twentythree);
- Tribute_twentythree.setFoodLevel(20);
- }
- if(plugin.Playing.size()>= 24){
- plugin.config.getString("Tribute_twentyfour_spawn");
- String[] coords = plugin.config.getString("Tribute_twentyfour_spawn").split(",");
- Player Tribute_twentyfour = plugin.Playing.get(23);
- double x = Double.parseDouble(coords[0]);
- double y = Double.parseDouble(coords[1]);
- double z = Double.parseDouble(coords[2]);
- String world = coords[3];
- World w = plugin.getServer().getWorld(world);
- Location loc = new Location(w, x, y, z);
- Tribute_twentyfour.teleport(loc);
- plugin.Frozen.add(Tribute_twentyfour);
- Tribute_twentyfour.setFoodLevel(20);
- }
+ }
+ if(args[0].equalsIgnoreCase("Reload")){
+ plugin.reloadConfig();
+ sender.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!");
+ }
+ if(args[0].equalsIgnoreCase("WarpAll")){
+ if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){
+ sender.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!");
+ }else{
+ if(plugin.Playing.size()<= 1){
+ sender.sendMessage(ChatColor.RED + "There are not enough players!");
+ }
+ if(plugin.Playing.size()>= 2){
+ plugin.config.getString("Tribute_one_spawn");
+ String[] onecoords = plugin.config.getString("Tribute_one_spawn").split(",");
+ Player Tribute_one = plugin.Playing.get(0);
+ double x = Double.parseDouble(onecoords[0]);
+ double y = Double.parseDouble(onecoords[1]);
+ double z = Double.parseDouble(onecoords[2]);
+ String world = onecoords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location oneloc = new Location(w, x, y, z);
+ Tribute_one.teleport(oneloc);
+ plugin.Frozen.add(Tribute_one);
+ Tribute_one.setFoodLevel(20);
+ plugin.config.getString("Tribute_two_spawn");
+ String[] twocoords = plugin.config.getString("Tribute_two_spawn").split(",");
+ Player Tribute_two = plugin.Playing.get(1);
+ double twox = Double.parseDouble(twocoords[0]);
+ double twoy = Double.parseDouble(twocoords[1]);
+ double twoz = Double.parseDouble(twocoords[2]);
+ String twoworld = twocoords[3];
+ World twow = plugin.getServer().getWorld(twoworld);
+ Location twoloc = new Location(twow, twox, twoy, twoz);
+ Tribute_two.teleport(twoloc);
+ plugin.Frozen.add(Tribute_two);
+ Tribute_two.setFoodLevel(20);
+ Tribute_one.getWorld().setTime(0);
+ }
+ if(plugin.Playing.size()>= 3){
+ plugin.config.getString("Tribute_three_spawn");
+ String[] coords = plugin.config.getString("Tribute_three_spawn").split(",");
+ Player Tribute_three = plugin.Playing.get(2);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_three.teleport(loc);
+ plugin.Frozen.add(Tribute_three);
+ Tribute_three.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 4){
+ plugin.config.getString("Tribute_four_spawn");
+ String[] coords = plugin.config.getString("Tribute_four_spawn").split(",");
+ Player Tribute_four = plugin.Playing.get(3);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_four.teleport(loc);
+ plugin.Frozen.add(Tribute_four);
+ Tribute_four.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 5){
+ plugin.config.getString("Tribute_five_spawn");
+ String[] coords = plugin.config.getString("Tribute_five_spawn").split(",");
+ Player Tribute_five = plugin.Playing.get(4);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_five.teleport(loc);
+ plugin.Frozen.add(Tribute_five);
+ Tribute_five.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 6){
+ plugin.config.getString("Tribute_six_spawn");
+ String[] coords = plugin.config.getString("Tribute_six_spawn").split(",");
+ Player Tribute_six = plugin.Playing.get(5);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_six.teleport(loc);
+ plugin.Frozen.add(Tribute_six);
+ Tribute_six.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 7){
+ plugin.config.getString("Tribute_seven_spawn");
+ String[] coords = plugin.config.getString("Tribute_seven_spawn").split(",");
+ Player Tribute_seven = plugin.Playing.get(6);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_seven.teleport(loc);
+ plugin.Frozen.add(Tribute_seven);
+ Tribute_seven.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 8){
+ plugin.config.getString("Tribute_eight_spawn");
+ String[] coords = plugin.config.getString("Tribute_eight_spawn").split(",");
+ Player Tribute_eight = plugin.Playing.get(7);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_eight.teleport(loc);
+ plugin.Frozen.add(Tribute_eight);
+ Tribute_eight.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 9){
+ plugin.config.getString("Tribute_nine_spawn");
+ String[] coords = plugin.config.getString("Tribute_nine_spawn").split(",");
+ Player Tribute_nine = plugin.Playing.get(8);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_nine.teleport(loc);
+ plugin.Frozen.add(Tribute_nine);
+ Tribute_nine.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 10){
+ plugin.config.getString("Tribute_ten_spawn");
+ String[] coords = plugin.config.getString("Tribute_ten_spawn").split(",");
+ Player Tribute_ten = plugin.Playing.get(9);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_ten.teleport(loc);
+ plugin.Frozen.add(Tribute_ten);
+ Tribute_ten.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 11){
+ plugin.config.getString("Tribute_eleven_spawn");
+ String[] coords = plugin.config.getString("Tribute_eleven_spawn").split(",");
+ Player Tribute_eleven = plugin.Playing.get(10);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_eleven.teleport(loc);
+ plugin.Frozen.add(Tribute_eleven);
+ Tribute_eleven.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 12){
+ plugin.config.getString("Tribute_twelve_spawn");
+ String[] coords = plugin.config.getString("Tribute_twelve_spawn").split(",");
+ Player Tribute_twelve = plugin.Playing.get(11);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twelve.teleport(loc);
+ plugin.Frozen.add(Tribute_twelve);
+ Tribute_twelve.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 13){
+ plugin.config.getString("Tribute_thirteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_thirteen_spawn").split(",");
+ Player Tribute_thirteen = plugin.Playing.get(12);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_thirteen.teleport(loc);
+ plugin.Frozen.add(Tribute_thirteen);
+ Tribute_thirteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 14){
+ plugin.config.getString("Tribute_fourteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_fourteen_spawn").split(",");
+ Player Tribute_fourteen = plugin.Playing.get(13);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_fourteen.teleport(loc);
+ plugin.Frozen.add(Tribute_fourteen);
+ Tribute_fourteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 15){
+ plugin.config.getString("Tribute_fifteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_fifteen_spawn").split(",");
+ Player Tribute_fifteen = plugin.Playing.get(14);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_fifteen.teleport(loc);
+ plugin.Frozen.add(Tribute_fifteen);
+ Tribute_fifteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 16){
+ plugin.config.getString("Tribute_sixteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_sixteen_spawn").split(",");
+ Player Tribute_sixteen = plugin.Playing.get(15);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_sixteen.teleport(loc);
+ plugin.Frozen.add(Tribute_sixteen);
+ Tribute_sixteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 17){
+ plugin.config.getString("Tribute_seventeen_spawn");
+ String[] coords = plugin.config.getString("Tribute_seventeen_spawn").split(",");
+ Player Tribute_seventeen = plugin.Playing.get(16);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_seventeen.teleport(loc);
+ plugin.Frozen.add(Tribute_seventeen);
+ Tribute_seventeen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 18){
+ plugin.config.getString("Tribute_eighteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_eighteen_spawn").split(",");
+ Player Tribute_eighteen = plugin.Playing.get(17);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_eighteen.teleport(loc);
+ plugin.Frozen.add(Tribute_eighteen);
+ Tribute_eighteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 19){
+ plugin.config.getString("Tribute_nineteen_spawn");
+ String[] coords = plugin.config.getString("Tribute_nineteen_spawn").split(",");
+ Player Tribute_nineteen = plugin.Playing.get(18);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_nineteen.teleport(loc);
+ plugin.Frozen.add(Tribute_nineteen);
+ Tribute_nineteen.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 20){
+ plugin.config.getString("Tribute_twenty_spawn");
+ String[] coords = plugin.config.getString("Tribute_twenty_spawn").split(",");
+ Player Tribute_twenty = plugin.Playing.get(19);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twenty.teleport(loc);
+ plugin.Frozen.add(Tribute_twenty);
+ Tribute_twenty.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 21){
+ plugin.config.getString("Tribute_twentyone_spawn");
+ String[] coords = plugin.config.getString("Tribute_twentyone_spawn").split(",");
+ Player Tribute_twentyone = plugin.Playing.get(20);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twentyone.teleport(loc);
+ plugin.Frozen.add(Tribute_twentyone);
+ Tribute_twentyone.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 22){
+ plugin.config.getString("Tribute_twentytwo_spawn");
+ String[] coords = plugin.config.getString("Tribute_twentytwo_spawn").split(",");
+ Player Tribute_twentytwo = plugin.Playing.get(21);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twentytwo.teleport(loc);
+ plugin.Frozen.add(Tribute_twentytwo);
+ Tribute_twentytwo.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 23){
+ plugin.config.getString("Tribute_twentythree_spawn");
+ String[] coords = plugin.config.getString("Tribute_twentythree_spawn").split(",");
+ Player Tribute_twentythree = plugin.Playing.get(22);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twentythree.teleport(loc);
+ plugin.Frozen.add(Tribute_twentythree);
+ Tribute_twentythree.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 24){
+ plugin.config.getString("Tribute_twentyfour_spawn");
+ String[] coords = plugin.config.getString("Tribute_twentyfour_spawn").split(",");
+ Player Tribute_twentyfour = plugin.Playing.get(23);
+ double x = Double.parseDouble(coords[0]);
+ double y = Double.parseDouble(coords[1]);
+ double z = Double.parseDouble(coords[2]);
+ String world = coords[3];
+ World w = plugin.getServer().getWorld(world);
+ Location loc = new Location(w, x, y, z);
+ Tribute_twentyfour.teleport(loc);
+ plugin.Frozen.add(Tribute_twentyfour);
+ Tribute_twentyfour.setFoodLevel(20);
+ }
+ if(plugin.Playing.size()>= 2){
+ if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start");
+ }
+ }, 20L);
}
}
}
@@ -644,72 +1251,68 @@ public class HaCommands implements CommandExecutor {
String begin = plugin.config.getString("Start_Message");
begin = begin.replaceAll("(&([a-f0-9]))", "\u00A7$2");
final String msg = begin;
- if(p.hasPermission("HungerArena.Start")){
- if(plugin.config.getString("Countdown").equalsIgnoreCase("true")){
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("10");
- }
- }, 20L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("9");
- }
- }, 40L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("8");
- }
- }, 60L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("7");
- }
- }, 80L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("6");
- }
- }, 100L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("5");
- }
- }, 120L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("4");
- }
- }, 140L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("3");
- }
- }, 160L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("2");
- }
- }, 180L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.getServer().broadcastMessage("1");
- }
- }, 200L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- plugin.Frozen.clear();
- plugin.getServer().broadcastMessage(msg);
- plugin.canjoin = true;
- }
- }, 220L);
- }else{
- plugin.Frozen.clear();
- p.getServer().broadcastMessage(ChatColor.AQUA + "Let the Games Begin!!");
- plugin.canjoin = true;
- }
+ if(plugin.config.getString("Countdown").equalsIgnoreCase("true")){
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("10");
+ }
+ }, 20L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("9");
+ }
+ }, 40L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("8");
+ }
+ }, 60L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("7");
+ }
+ }, 80L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("6");
+ }
+ }, 100L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("5");
+ }
+ }, 120L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("4");
+ }
+ }, 140L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("3");
+ }
+ }, 160L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("2");
+ }
+ }, 180L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.getServer().broadcastMessage("1");
+ }
+ }, 200L);
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ plugin.Frozen.clear();
+ plugin.getServer().broadcastMessage(msg);
+ plugin.canjoin = true;
+ }
+ }, 220L);
}else{
- p.sendMessage(ChatColor.RED + "You don't have permission!");
+ plugin.Frozen.clear();
+ plugin.getServer().broadcastMessage(ChatColor.AQUA + "Let the Games Begin!!");
+ plugin.canjoin = true;
}
}
return false;
diff --git a/src/me/Travja/HungerArena/Signs.java b/src/me/Travja/HungerArena/Signs.java
index 5ae96c9..d31fb97 100644
--- a/src/me/Travja/HungerArena/Signs.java
+++ b/src/me/Travja/HungerArena/Signs.java
@@ -1,11 +1,13 @@
package me.Travja.HungerArena;
+import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
+import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class Signs implements Listener {
@@ -21,21 +23,25 @@ public class Signs implements Listener {
if(b.getType()== Material.SIGN || b.getType()==Material.SIGN_POST || b.getType()==Material.WALL_SIGN){
org.bukkit.block.Sign sign = (org.bukkit.block.Sign) b.getState();
String[] lines = sign.getLines();
- if(lines[0].equalsIgnoreCase("[HungerArena]")){
- if(lines[1].equalsIgnoreCase("Join")){
- p.performCommand("ha join");
- }
- if(lines[1].equalsIgnoreCase("Confirm")){
- p.performCommand("ha confirm");
- }
- if(lines[1].equalsIgnoreCase("Leave")){
- p.performCommand("ha leave");
+ if(lines[0].equalsIgnoreCase(ChatColor.BLUE + "[HungerArena]")){
+ if(lines[1].isEmpty()){
+ p.performCommand("ha");
+ }else{
+ p.performCommand("ha " + lines[1]);
}
}
- if(lines[0].equalsIgnoreCase("[Sponsor]")){
- p.performCommand("sponsor" + " " + lines[1] + " " + lines[2] + " " + lines[3]);
+ if(lines[0].equalsIgnoreCase(ChatColor.BLUE + "[Sponsor]")){
+ p.performCommand("sponsor " + lines[1] + " " + lines[2] + " " + lines[3]);
}
}
}
}
+ @EventHandler
+ public void Create(SignChangeEvent event){
+ String[] lines = event.getLines();
+ String top = lines[0];
+ if(top.equalsIgnoreCase("[HungerArena]") || top.equalsIgnoreCase("[Sponsor]")){
+ event.setLine(0, ChatColor.BLUE + top);
+ }
+ }
}
diff --git a/src/me/Travja/HungerArena/SponsorCommands.java b/src/me/Travja/HungerArena/SponsorCommands.java
index c1b6181..0868a18 100644
--- a/src/me/Travja/HungerArena/SponsorCommands.java
+++ b/src/me/Travja/HungerArena/SponsorCommands.java
@@ -19,45 +19,49 @@ public class SponsorCommands implements CommandExecutor {
Player p = (Player) sender;
String pname = p.getName();
if(cmd.getName().equalsIgnoreCase("Sponsor")){
- if(!plugin.Playing.contains(p)){
- if(args.length== 0){
- p.sendMessage(ChatColor.RED + "You didn't specify a tribute!");
- return false;
- }
- if(args.length== 1){
- p.sendMessage(ChatColor.RED + "You didn't specify an item!");
- }
- if(args.length== 2){
- p.sendMessage(ChatColor.RED + "You didn't specify an amount!");
- }
- if(args.length== 3){
- Player target = Bukkit.getPlayer(args[0]);
- if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){
- p.sendMessage(ChatColor.RED + "You can't sponsor that item!");
- }else{
- int ID = Integer.parseInt(args[1]);
- int Amount = Integer.parseInt(args[2]);
- ItemStack sponsoritem = new ItemStack(ID, Amount);
- if(p.getInventory().contains(plugin.config.getInt("Sponsor_Cost.ID"), plugin.config.getInt("Sponsor_Cost.Amount")*Amount)){
- if(!plugin.Playing.contains(target)){
- p.sendMessage(ChatColor.RED + "That person isn't playing!");
- }else{
- if(args[0].equalsIgnoreCase(pname)){
- p.sendMessage(ChatColor.RED + "You can't sponsor yourself!");
- }else{
- target.sendMessage(ChatColor.AQUA + "You have been Sponsored!");
- target.getInventory().addItem(sponsoritem);
- p.sendMessage("You have sponsored " + target.getName() + "!");
- p.getInventory().removeItem(plugin.Cost);
- }
- }
+ if(p.hasPermission("HungerArena.Sponsor")){
+ if(!plugin.Playing.contains(p)){
+ if(args.length== 0){
+ p.sendMessage(ChatColor.RED + "You didn't specify a tribute!");
+ return false;
+ }
+ if(args.length== 1){
+ p.sendMessage(ChatColor.RED + "You didn't specify an item!");
+ }
+ if(args.length== 2){
+ p.sendMessage(ChatColor.RED + "You didn't specify an amount!");
+ }
+ if(args.length== 3){
+ Player target = Bukkit.getPlayer(args[0]);
+ if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){
+ p.sendMessage(ChatColor.RED + "You can't sponsor that item!");
}else{
- p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!");
+ int ID = Integer.parseInt(args[1]);
+ int Amount = Integer.parseInt(args[2]);
+ ItemStack sponsoritem = new ItemStack(ID, Amount);
+ if(p.getInventory().contains(plugin.config.getInt("Sponsor_Cost.ID"), plugin.config.getInt("Sponsor_Cost.Amount")*Amount)){
+ if(!plugin.Playing.contains(target)){
+ p.sendMessage(ChatColor.RED + "That person isn't playing!");
+ }else{
+ if(args[0].equalsIgnoreCase(pname)){
+ p.sendMessage(ChatColor.RED + "You can't sponsor yourself!");
+ }else{
+ target.sendMessage(ChatColor.AQUA + "You have been Sponsored!");
+ target.getInventory().addItem(sponsoritem);
+ p.sendMessage("You have sponsored " + target.getName() + "!");
+ p.getInventory().removeItem(plugin.Cost);
+ }
+ }
+ }else{
+ p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!");
+ }
}
}
+ }else{
+ p.sendMessage(ChatColor.RED + "You are playing, you can't sponsor yourself!");
}
}else{
- p.sendMessage(ChatColor.RED + "You are playing, you can't sponsor yourself!");
+ p.sendMessage(ChatColor.RED + "You don't have permission!");
}
}
return false;