A Few more bug fixes... Chests are still buggy

This commit is contained in:
Travis Eggett 2012-05-25 21:40:34 -06:00
parent abfcdf62b1
commit ffd94172db
18 changed files with 26 additions and 12 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -45,3 +45,4 @@ Tribute_twentyone_spawn: 100,100,100
Tribute_twentytwo_spawn: 100,100,100 Tribute_twentytwo_spawn: 100,100,100
Tribute_twentythree_spawn: 100,100,100 Tribute_twentythree_spawn: 100,100,100
Tribute_twentyfour_spawn: 100,100,100 Tribute_twentyfour_spawn: 100,100,100
Spawn_set: false

@ -61,15 +61,6 @@ public class Main extends JavaPlugin{
getServer().getPluginManager().registerEvents(new DeathListener(this), this); getServer().getPluginManager().registerEvents(new DeathListener(this), this);
Reward = new ItemStack(config.getInt("Reward.ID"), config.getInt("Reward.Amount")); Reward = new ItemStack(config.getInt("Reward.ID"), config.getInt("Reward.Amount"));
Cost = new ItemStack(config.getInt("Sponsor_Cost.ID"), config.getInt("Sponsor_Cost.Amount")); Cost = new ItemStack(config.getInt("Sponsor_Cost.ID"), config.getInt("Sponsor_Cost.Amount"));
if(!config.contains("Auto_Restart")){
config.addDefault("Auto_Restart", "false");
this.saveConfig();
}
if(!config.contains("Start_Message")){
config.addDefault("Start_Message", "&bLet The Games Begin!");
this.saveConfig();
System.out.println("Saved Start_Message");
}
} }
public void onDisable(){ public void onDisable(){
log = this.getLogger(); log = this.getLogger();
@ -123,6 +114,9 @@ public class Main extends JavaPlugin{
} }
} }
if(cmd.getName().equalsIgnoreCase("Ha")){ if(cmd.getName().equalsIgnoreCase("Ha")){
if(config.getString("Spawns_set").equalsIgnoreCase("false")){
p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!");
}
if(args.length== 0){ if(args.length== 0){
p.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja!"); p.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja!");
return false; return false;
@ -149,6 +143,7 @@ public class Main extends JavaPlugin{
String w = p.getWorld().getName(); String w = p.getWorld().getName();
config.set("Spawn_coords", x + "," + y + "," + z + "," + w); config.set("Spawn_coords", x + "," + y + "," + z + "," + w);
saveConfig(); saveConfig();
config.set("Spawns_set", "true");
p.sendMessage(ChatColor.AQUA + "You have set the spawn for dead tributes!"); p.sendMessage(ChatColor.AQUA + "You have set the spawn for dead tributes!");
}else{ }else{
p.sendMessage(ChatColor.RED + "You don't have permission!"); p.sendMessage(ChatColor.RED + "You don't have permission!");
@ -1135,6 +1130,13 @@ class DeathListener implements Listener{
public void onPlayerJoin(PlayerJoinEvent event){ public void onPlayerJoin(PlayerJoinEvent event){
Player p = event.getPlayer(); Player p = event.getPlayer();
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if(plugin.Watching.contains(p)){
p.setAllowFlight(true);
p.setFlying(true);
for(Player everyone:plugin.getServer().getOnlinePlayers()){
everyone.hidePlayer(p);
}
}
if(plugin.Out.contains(p)){ if(plugin.Out.contains(p)){
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
public void run(){ public void run(){
@ -1142,7 +1144,6 @@ class DeathListener implements Listener{
} }
}, 40L); }, 40L);
plugin.Out.remove(p); plugin.Out.remove(p);
plugin.Playing.add(p);
} }
if(plugin.Quit.contains(p) || plugin.Dead.contains(p)){ if(plugin.Quit.contains(p) || plugin.Dead.contains(p)){
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(","); String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
@ -1170,12 +1171,19 @@ class DeathListener implements Listener{
double spawny = Double.parseDouble(Spawncoords[1]); double spawny = Double.parseDouble(Spawncoords[1]);
double spawnz = Double.parseDouble(Spawncoords[2]); double spawnz = Double.parseDouble(Spawncoords[2]);
final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
if(plugin.Playing.contains(p)){
if(plugin.Playing.size()== 1){
}
plugin.Out.add(p);
}
if(plugin.Watching.contains(p)){ if(plugin.Watching.contains(p)){
System.out.println(p.getName() + " testing"); System.out.println(p.getName() + " testing");
} }
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
public void run(){ public void run(){
if(plugin.Playing.contains(p) && plugin.Out.contains(p) && plugin.canjoin== false){ if(plugin.Playing.contains(p) && plugin.Out.contains(p)){
if(plugin.canjoin== true){
plugin.Playing.remove(p); plugin.Playing.remove(p);
plugin.Quit.add(p); plugin.Quit.add(p);
plugin.Out.remove(p); plugin.Out.remove(p);
@ -1203,6 +1211,11 @@ class DeathListener implements Listener{
plugin.canjoin = false; plugin.canjoin = false;
} }
} }
}else if(plugin.canjoin== false){
plugin.Playing.remove(p);
plugin.Quit.add(p);
plugin.Out.remove(p);
}
} }
} }
}, 1200L); }, 1200L);