3/15 - Most recent Dev

This commit is contained in:
travja 2013-03-15 23:07:55 -06:00
parent 444ec3ea01
commit 482e3e8e55
16 changed files with 289 additions and 220 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -53,6 +53,7 @@ public class Chests implements Listener {
int a = plugin.getArena(p); int a = plugin.getArena(p);
if(plugin.Playing.get(a).contains(p.getName()) && plugin.canjoin.get(a)){ if(plugin.Playing.get(a).contains(p.getName()) && plugin.canjoin.get(a)){
if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){ if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){
if(block!= null){
if(block.getState() instanceof Chest){ if(block.getState() instanceof Chest){
ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents(); ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents();
int blockx = block.getX(); int blockx = block.getX();
@ -81,3 +82,4 @@ public class Chests implements Listener {
} }
} }
} }
}

View File

@ -46,11 +46,13 @@ public class DeathListener implements Listener{
Server s = p.getServer(); Server s = p.getServer();
String pname = p.getName(); String pname = p.getName();
int players = plugin.Playing.size()-1; int players = plugin.Playing.size()-1;
String leftmsg = ChatColor.BLUE + "There are now " + players + " tributes left!"; String leftmsg = null;
for(i = 1; i < plugin.Frozen.size(); i++){ for(i = 1; i < plugin.Frozen.size(); i++){
if(plugin.Frozen.get(i).contains(pname)){ if(plugin.Frozen.get(i).contains(pname)){
if(plugin.getArena(p)!= null){ if(plugin.getArena(p)!= null){
a = plugin.getArena(p); a = plugin.getArena(p);
players = plugin.Playing.get(a).size()-1;
leftmsg = ChatColor.BLUE + "There are now " + players + " tributes left!";
if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){ if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){
double y = p.getLocation().getY(); double y = p.getLocation().getY();
double newy = y+200; double newy = y+200;
@ -83,6 +85,8 @@ public class DeathListener implements Listener{
} }
}else if(plugin.getArena(p)!= null){ }else if(plugin.getArena(p)!= null){
a = plugin.getArena(p); a = plugin.getArena(p);
players = plugin.Playing.get(a).size()-1;
leftmsg = ChatColor.BLUE + "There are now " + players + " tributes left!";
if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){ if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){
double y = p.getLocation().getY(); double y = p.getLocation().getY();
double newy = y+200; double newy = y+200;

View File

@ -101,34 +101,51 @@ public class HaCommands implements CommandExecutor {
if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){ if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){
for(String playernames: plugin.Playing.get(a)){ for(String playernames: plugin.Playing.get(a)){
Player players = plugin.getServer().getPlayerExact(playernames); Player players = plugin.getServer().getPlayerExact(playernames);
if(p.hasPermission("HungerArena.List")){ if(p.hasPermission("HungerArena.GameMaker")){
sender.sendMessage(ChatColor.GREEN + playernames);
}else{
sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20");
}else if(p.hasPermission("HungerArena.List")){
sender.sendMessage(ChatColor.GREEN + playernames);
} }
} }
}else{ }else{
p.sendMessage(ChatColor.GRAY + "No one is playing!"); p.sendMessage(ChatColor.GRAY + "No one is playing!");
} }
p.sendMessage(ChatColor.AQUA + "---------------------"); p.sendMessage(ChatColor.AQUA + "-------------------");
}catch(Exception e){ }catch(Exception e){
p.sendMessage(ChatColor.RED + "Argument not an integer!"); p.sendMessage(ChatColor.RED + "Argument not an integer or is an invalid arena!");
} }
}else{ }else{
if(plugin.getArena(p)== null){
p.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); p.sendMessage(ChatColor.AQUA + "----- Arena 1 -----");
if(!plugin.Playing.get(1).isEmpty() && plugin.Playing.containsKey(1)){ if(!plugin.Playing.get(1).isEmpty() && plugin.Playing.containsKey(1)){
for(String playernames: plugin.Playing.get(1)){ for(String playernames: plugin.Playing.get(1)){
Player players = plugin.getServer().getPlayerExact(playernames); Player players = plugin.getServer().getPlayerExact(playernames);
if(p.hasPermission("HungerArena.List")){ if(p.hasPermission("HungerArena.GameMaker")){
sender.sendMessage(ChatColor.GREEN + playernames);
}else{
sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20");
}else if(p.hasPermission("HungerArena.List")){
sender.sendMessage(ChatColor.GREEN + playernames);
} }
} }
}else{ }else{
p.sendMessage(ChatColor.GRAY + "No one is playing!"); p.sendMessage(ChatColor.GRAY + "No one is playing!");
} }
p.sendMessage(ChatColor.AQUA + "---------------------"); }else{
a = plugin.getArena(p);
sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----");
if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){
for(String playernames: plugin.Playing.get(a)){
Player players = plugin.getServer().getPlayerExact(playernames);
if(p.hasPermission("HungerArena.GameMaker")){
sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20");
}else if(p.hasPermission("HungerArena.List")){
sender.sendMessage(ChatColor.GREEN + playernames);
}
}
}else{
p.sendMessage(ChatColor.GRAY + "No one is playing!");
}
}
p.sendMessage(ChatColor.AQUA + "-------------------");
} }
}else{ }else{
p.sendMessage(ChatColor.RED + "You don't have permission!"); p.sendMessage(ChatColor.RED + "You don't have permission!");
@ -146,7 +163,7 @@ public class HaCommands implements CommandExecutor {
}else{ }else{
p.sendMessage(ChatColor.GRAY + "No one is ready!"); p.sendMessage(ChatColor.GRAY + "No one is ready!");
} }
p.sendMessage(ChatColor.AQUA + "---------------------"); p.sendMessage(ChatColor.AQUA + "-------------------");
}catch(Exception e){ }catch(Exception e){
p.sendMessage(ChatColor.RED + "Argument not an integer!"); p.sendMessage(ChatColor.RED + "Argument not an integer!");
} }
@ -159,7 +176,7 @@ public class HaCommands implements CommandExecutor {
}else{ }else{
p.sendMessage(ChatColor.GRAY + "No one is ready!"); p.sendMessage(ChatColor.GRAY + "No one is ready!");
} }
p.sendMessage(ChatColor.AQUA + "---------------------"); p.sendMessage(ChatColor.AQUA + "-------------------");
} }
}else{ }else{
p.sendMessage(ChatColor.RED + "You don't have permission!"); p.sendMessage(ChatColor.RED + "You don't have permission!");
@ -359,7 +376,7 @@ public class HaCommands implements CommandExecutor {
} }
} }
if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + String.valueOf(a)); plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a);
} }
} }
} }
@ -490,8 +507,11 @@ public class HaCommands implements CommandExecutor {
} }
} }
}else if(args[0].equalsIgnoreCase("Ready")){ }else if(args[0].equalsIgnoreCase("Ready")){
p.sendMessage(String.valueOf(plugin.getArena(p)));
if(plugin.getArena(p)!= null){ if(plugin.getArena(p)!= null){
a = plugin.getArena(p); a = plugin.getArena(p);
for(String s:plugin.Playing.get(a))
p.sendMessage(s);
if(plugin.Playing.get(a).contains(pname)){ if(plugin.Playing.get(a).contains(pname)){
if(plugin.Ready.get(a).contains(pname)){ if(plugin.Ready.get(a).contains(pname)){
p.sendMessage(ChatColor.RED + "You're already ready!"); p.sendMessage(ChatColor.RED + "You're already ready!");
@ -643,13 +663,7 @@ public class HaCommands implements CommandExecutor {
a = Integer.parseInt(args[1]); a = Integer.parseInt(args[1]);
int list056; int list056;
list056 = 0; list056 = 0;
int limit = 0; int limit = plugin.config.getStringList("StorageXYZ").size();
for(String chests: plugin.config.getStringList("StorageXYZ")){
String[] chest = chests.split(",");
if(Integer.parseInt(chest[3])== a){
limit = limit+1;
}
}
while(limit > list056){ while(limit > list056){
String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056);
int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X");
@ -659,6 +673,7 @@ public class HaCommands implements CommandExecutor {
String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W");
Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz);
plugin.exists = false; plugin.exists = false;
if(chesta== a){
if(blockatlocation.getState() instanceof Chest){ if(blockatlocation.getState() instanceof Chest){
plugin.exists = true; plugin.exists = true;
Chest chest = (Chest) blockatlocation.getState(); Chest chest = (Chest) blockatlocation.getState();
@ -676,10 +691,13 @@ public class HaCommands implements CommandExecutor {
chest.update(); chest.update();
} }
} }
}else{
list056 = list056+1;
} }
if(limit== list056){ if(limit== list056){
sender.sendMessage(ChatColor.GREEN + "All for arena " + a + " refilled!"); sender.sendMessage(ChatColor.GREEN + "All for arena " + a + " refilled!");
} }
}
}else{ }else{
int list056; int list056;
list056 = 0; list056 = 0;
@ -794,7 +812,8 @@ public class HaCommands implements CommandExecutor {
p.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!"); p.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!");
}else{ }else{
for(i = 1; i <= plugin.Watching.size(); i++){ for(i = 1; i <= plugin.Watching.size(); i++){
for(b = 0; b < plugin.Watching.get(b).size(); b++){ for(b = 0; b <= plugin.Watching.get(i).size(); b++){
if(plugin.Watching.get(i).get(b)!= null){
String s = plugin.Watching.get(i).get(b); String s = plugin.Watching.get(i).get(b);
Player spectator = plugin.getServer().getPlayerExact(s); Player spectator = plugin.getServer().getPlayerExact(s);
spectator.setAllowFlight(false); spectator.setAllowFlight(false);
@ -804,6 +823,7 @@ public class HaCommands implements CommandExecutor {
} }
} }
} }
}
plugin.Dead.clear(); plugin.Dead.clear();
plugin.Quit.clear(); plugin.Quit.clear();
plugin.Watching.clear(); plugin.Watching.clear();
@ -866,11 +886,14 @@ public class HaCommands implements CommandExecutor {
a = Integer.parseInt(args[1]); a = Integer.parseInt(args[1]);
if(plugin.open.get(a)){ if(plugin.open.get(a)){
plugin.open.put(a, false); plugin.open.put(a, false);
if(plugin.Playing.get(a)!= null){
for(String players: plugin.Playing.get(a)){ for(String players: plugin.Playing.get(a)){
Player tributes = plugin.getServer().getPlayerExact(players); Player tributes = plugin.getServer().getPlayerExact(players);
clearInv(tributes); clearInv(tributes);
tributes.teleport(tributes.getWorld().getSpawnLocation()); tributes.teleport(tributes.getWorld().getSpawnLocation());
} }
}
if(plugin.Watching.get(a)!= null){
for(String sname: plugin.Watching.get(a)){ for(String sname: plugin.Watching.get(a)){
Player spectators = plugin.getServer().getPlayerExact(sname); Player spectators = plugin.getServer().getPlayerExact(sname);
spectators.teleport(spectators.getWorld().getSpawnLocation()); spectators.teleport(spectators.getWorld().getSpawnLocation());
@ -879,6 +902,7 @@ public class HaCommands implements CommandExecutor {
online.showPlayer(spectators); online.showPlayer(spectators);
} }
} }
}
plugin.Dead.get(a).clear(); plugin.Dead.get(a).clear();
plugin.Quit.get(a).clear(); plugin.Quit.get(a).clear();
plugin.Watching.get(a).clear(); plugin.Watching.get(a).clear();
@ -897,11 +921,14 @@ public class HaCommands implements CommandExecutor {
for(i = 1; i <= plugin.open.size(); i++){ for(i = 1; i <= plugin.open.size(); i++){
if(plugin.open.get(i)){ if(plugin.open.get(i)){
plugin.open.put(i, false); plugin.open.put(i, false);
if(plugin.Playing.get(i)!= null){
for(String players: plugin.Playing.get(i)){ for(String players: plugin.Playing.get(i)){
Player tributes = plugin.getServer().getPlayerExact(players); Player tributes = plugin.getServer().getPlayerExact(players);
clearInv(tributes); clearInv(tributes);
tributes.teleport(tributes.getWorld().getSpawnLocation()); tributes.teleport(tributes.getWorld().getSpawnLocation());
} }
}
if(plugin.Watching.get(i)!= null){
for(String sname: plugin.Watching.get(i)){ for(String sname: plugin.Watching.get(i)){
Player spectators = plugin.getServer().getPlayerExact(sname); Player spectators = plugin.getServer().getPlayerExact(sname);
spectators.teleport(spectators.getWorld().getSpawnLocation()); spectators.teleport(spectators.getWorld().getSpawnLocation());
@ -910,6 +937,7 @@ public class HaCommands implements CommandExecutor {
online.showPlayer(spectators); online.showPlayer(spectators);
} }
} }
}
plugin.Dead.clear(); plugin.Dead.clear();
plugin.Quit.clear(); plugin.Quit.clear();
plugin.Watching.clear(); plugin.Watching.clear();
@ -943,9 +971,11 @@ public class HaCommands implements CommandExecutor {
for(i = 1; i <= plugin.open.size(); i++){ for(i = 1; i <= plugin.open.size(); i++){
if(!plugin.open.get(i)){ if(!plugin.open.get(i)){
plugin.open.put(i, true); plugin.open.put(i, true);
p.sendMessage(ChatColor.GOLD + "Arena " + a + " Open!"); p.sendMessage(ChatColor.GOLD + "Arena " + i + " Open!");
i = i+1;
}else{ }else{
p.sendMessage(ChatColor.RED + "Arena " + a + " already open, type /ha close to close them!"); p.sendMessage(ChatColor.RED + "Arena " + i + " already open, type /ha close to close them!");
i = i+1;
} }
} }
} }
@ -1014,7 +1044,17 @@ public class HaCommands implements CommandExecutor {
} }
}else if(args[0].equalsIgnoreCase("Start")){ }else if(args[0].equalsIgnoreCase("Start")){
if(p.hasPermission("HungerArena.Start")){ if(p.hasPermission("HungerArena.Start")){
if(args.length!= 2){
p.sendMessage(ChatColor.RED + "You need an arena!");
}else{
a = Integer.parseInt(args[1]);
if(plugin.canjoin.get(a)== true)
p.sendMessage(ChatColor.RED + "Game already in progress!");
else if(plugin.Playing.get(a).isEmpty())
p.sendMessage(ChatColor.RED + "No one is in that game!");
else
plugin.startGames(a); plugin.startGames(a);
}
}else{ }else{
p.sendMessage(ChatColor.RED + "You don't have permission!"); p.sendMessage(ChatColor.RED + "You don't have permission!");
} }
@ -1141,13 +1181,7 @@ public class HaCommands implements CommandExecutor {
a = Integer.parseInt(args[1]); a = Integer.parseInt(args[1]);
int list056; int list056;
list056 = 0; list056 = 0;
int limit = 0; int limit = plugin.config.getStringList("StorageXYZ").size();
for(String chests: plugin.config.getStringList("StorageXYZ")){
String[] chest = chests.split(",");
if(Integer.parseInt(chest[3])== a){
limit = limit+1;
}
}
while(limit > list056){ while(limit > list056){
String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056);
int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X");
@ -1157,6 +1191,7 @@ public class HaCommands implements CommandExecutor {
String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W");
Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz);
plugin.exists = false; plugin.exists = false;
if(chesta== a){
if(blockatlocation.getState() instanceof Chest){ if(blockatlocation.getState() instanceof Chest){
plugin.exists = true; plugin.exists = true;
Chest chest = (Chest) blockatlocation.getState(); Chest chest = (Chest) blockatlocation.getState();
@ -1174,6 +1209,9 @@ public class HaCommands implements CommandExecutor {
chest.update(); chest.update();
} }
} }
}else{
list056 = list056+1;
}
} }
if(limit== list056){ if(limit== list056){
sender.sendMessage(ChatColor.GREEN + "All for arena " + a + " refilled!"); sender.sendMessage(ChatColor.GREEN + "All for arena " + a + " refilled!");
@ -1358,11 +1396,14 @@ public class HaCommands implements CommandExecutor {
a = Integer.parseInt(args[1]); a = Integer.parseInt(args[1]);
if(plugin.open.get(a)){ if(plugin.open.get(a)){
plugin.open.put(a, false); plugin.open.put(a, false);
if(plugin.Playing.get(a)!= null){
for(String players: plugin.Playing.get(a)){ for(String players: plugin.Playing.get(a)){
Player tributes = plugin.getServer().getPlayerExact(players); Player tributes = plugin.getServer().getPlayerExact(players);
clearInv(tributes); clearInv(tributes);
tributes.teleport(tributes.getWorld().getSpawnLocation()); tributes.teleport(tributes.getWorld().getSpawnLocation());
} }
}
if(plugin.Watching.get(a)!= null){
for(String sname: plugin.Watching.get(a)){ for(String sname: plugin.Watching.get(a)){
Player spectators = plugin.getServer().getPlayerExact(sname); Player spectators = plugin.getServer().getPlayerExact(sname);
spectators.teleport(spectators.getWorld().getSpawnLocation()); spectators.teleport(spectators.getWorld().getSpawnLocation());
@ -1371,6 +1412,7 @@ public class HaCommands implements CommandExecutor {
online.showPlayer(spectators); online.showPlayer(spectators);
} }
} }
}
plugin.Dead.get(a).clear(); plugin.Dead.get(a).clear();
plugin.Quit.get(a).clear(); plugin.Quit.get(a).clear();
plugin.Watching.get(a).clear(); plugin.Watching.get(a).clear();
@ -1380,7 +1422,7 @@ public class HaCommands implements CommandExecutor {
plugin.Out.get(a).clear(); plugin.Out.get(a).clear();
plugin.Playing.get(a).clear(); plugin.Playing.get(a).clear();
plugin.inArena.get(a).clear(); plugin.inArena.get(a).clear();
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill " + a); Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill " + a);
sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Closed!"); sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Closed!");
}else{ }else{
sender.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!"); sender.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!");
@ -1389,12 +1431,15 @@ public class HaCommands implements CommandExecutor {
for(i = 1; i <= plugin.open.size(); i++){ for(i = 1; i <= plugin.open.size(); i++){
if(plugin.open.get(i)){ if(plugin.open.get(i)){
plugin.open.put(i, false); plugin.open.put(i, false);
for(String players: plugin.Playing.get(a)){ if(plugin.Playing.get(i)!= null){
for(String players: plugin.Playing.get(i)){
Player tributes = plugin.getServer().getPlayerExact(players); Player tributes = plugin.getServer().getPlayerExact(players);
clearInv(tributes); clearInv(tributes);
tributes.teleport(tributes.getWorld().getSpawnLocation()); tributes.teleport(tributes.getWorld().getSpawnLocation());
} }
for(String sname: plugin.Watching.get(a)){ }
if(plugin.Watching.get(i)!= null){
for(String sname: plugin.Watching.get(i)){
Player spectators = plugin.getServer().getPlayerExact(sname); Player spectators = plugin.getServer().getPlayerExact(sname);
spectators.teleport(spectators.getWorld().getSpawnLocation()); spectators.teleport(spectators.getWorld().getSpawnLocation());
spectators.setAllowFlight(false); spectators.setAllowFlight(false);
@ -1402,6 +1447,7 @@ public class HaCommands implements CommandExecutor {
online.showPlayer(spectators); online.showPlayer(spectators);
} }
} }
}
plugin.Dead.clear(); plugin.Dead.clear();
plugin.Quit.clear(); plugin.Quit.clear();
plugin.Watching.clear(); plugin.Watching.clear();
@ -1411,14 +1457,13 @@ public class HaCommands implements CommandExecutor {
plugin.Out.clear(); plugin.Out.clear();
plugin.Playing.clear(); plugin.Playing.clear();
plugin.inArena.clear(); plugin.inArena.clear();
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill"); Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill");
sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Closed!"); sender.sendMessage(ChatColor.GOLD + "Arena " + i + " Closed!");
}else{ }else{
sender.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!"); sender.sendMessage(ChatColor.RED + "Arena " + i + " already closed, type /ha open to re-open them!");
} }
} }
} }
}else if(args[0].equalsIgnoreCase("open")){ }else if(args[0].equalsIgnoreCase("open")){
if(args.length>= 2){ if(args.length>= 2){
a = Integer.parseInt(args[1]); a = Integer.parseInt(args[1]);
@ -1465,7 +1510,7 @@ public class HaCommands implements CommandExecutor {
i = 1; i = 1;
for(String playing: plugin.Playing.get(a)){ for(String playing: plugin.Playing.get(a)){
Player tribute = plugin.getServer().getPlayerExact(playing); Player tribute = plugin.getServer().getPlayerExact(playing);
tribute.teleport(plugin.location.get(a).get(i)); //TODO BUG? tribute.teleport(plugin.location.get(a).get(i));
tribute.setHealth(20); tribute.setHealth(20);
tribute.setFoodLevel(20); tribute.setFoodLevel(20);
tribute.setSaturation(20); tribute.setSaturation(20);
@ -1492,7 +1537,17 @@ public class HaCommands implements CommandExecutor {
} }
} }
}else if(args[0].equalsIgnoreCase("Start")){ }else if(args[0].equalsIgnoreCase("Start")){
if(args.length!= 2){
sender.sendMessage(ChatColor.RED + "You need an arena!");
}else{
a = Integer.parseInt(args[1]);
if(plugin.canjoin.get(a)== true)
sender.sendMessage(ChatColor.RED + "Game already in progress!");
else if(plugin.Playing.get(a).isEmpty())
sender.sendMessage(ChatColor.RED + "No one is in that game!");
else
plugin.startGames(a); plugin.startGames(a);
}
}else{ }else{
sender.sendMessage(ChatColor.RED + "Unknown command, type /ha help to see all commands!"); sender.sendMessage(ChatColor.RED + "Unknown command, type /ha help to see all commands!");
} }

View File

@ -17,6 +17,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -314,10 +315,10 @@ public class Main extends JavaPlugin{
double spawny = Double.parseDouble(Spawncoords[1]); double spawny = Double.parseDouble(Spawncoords[1]);
double spawnz = Double.parseDouble(Spawncoords[2]); double spawnz = Double.parseDouble(Spawncoords[2]);
Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
if(Playing.size()== 1 && canjoin.get(a)== true){ if(Playing.get(a).size()== 1 && canjoin.get(a)== true){
//Announce winner //Announce winner
for(i = 1; i < Playing.get(a).size(); i++){ for(i = 0; i < Playing.get(a).size(); i++){
String winnername = Playing.get(a).get(i++); String winnername = Playing.get(a).get(i);
Player winner = getServer().getPlayerExact(winnername); Player winner = getServer().getPlayerExact(winnername);
String winnername2 = winner.getName(); String winnername2 = winner.getName();
getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
@ -332,7 +333,16 @@ public class Main extends JavaPlugin{
winner.removePotionEffect(potion); winner.removePotionEffect(potion);
} }
Tele.add(winner); Tele.add(winner);
final World w = winner.getWorld();
winner.teleport(Spawn); winner.teleport(Spawn);
if(config.getBoolean("reloadWorld")){
getServer().unloadWorld(w, false);
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
public void run(){
getServer().createWorld(new WorldCreator(w.getName()));
}
},200L);
}
if(!config.getBoolean("rewardEco.enabled")){ if(!config.getBoolean("rewardEco.enabled")){
for(ItemStack Rewards: Reward){ for(ItemStack Rewards: Reward){
winner.getInventory().addItem(Rewards); winner.getInventory().addItem(Rewards);
@ -343,7 +353,7 @@ public class Main extends JavaPlugin{
} }
econ.depositPlayer(winner.getName(), config.getDouble("rewardEco.reward")); econ.depositPlayer(winner.getName(), config.getDouble("rewardEco.reward"));
} }
Playing.clear(); Playing.get(a).clear();
getServer().getScheduler().cancelTask(deathtime); getServer().getScheduler().cancelTask(deathtime);
} }
//Show spectators //Show spectators
@ -402,6 +412,7 @@ public class Main extends JavaPlugin{
i = i-1; i = i-1;
canjoin.put(a, true); canjoin.put(a, true);
if(i== -1){ if(i== -1){
if(Frozen.get(a)!= null)
Frozen.get(a).clear(); Frozen.get(a).clear();
if(config.getBoolean("broadcastAll")){ if(config.getBoolean("broadcastAll")){
getServer().broadcastMessage(msg); getServer().broadcastMessage(msg);
@ -477,14 +488,11 @@ public class Main extends JavaPlugin{
} }
} }
public Integer getArena(Player p){ public Integer getArena(Player p){
int x = 0; for (int x: Playing.keySet()) {
for(x = 1; x < Playing.size(); x++){
if(Playing.get(x)!= null){
if (Playing.get(x).contains(p.getName())){ if (Playing.get(x).contains(p.getName())){
return x; return x;
} }
} }
}
return null; return null;
} }
public boolean isSpectating(Player p){ public boolean isSpectating(Player p){