Fixed bugs

This commit is contained in:
travja 2013-03-28 15:43:17 -06:00
parent 563e453a26
commit 1ebab85ead
7 changed files with 24 additions and 21 deletions

Binary file not shown.

View File

@ -41,28 +41,30 @@ public class BlockStorage implements Listener {
if (plugin.getArena(p) != null || !protall) { if (plugin.getArena(p) != null || !protall) {
//int a = this.plugin.getArena(p).intValue(); //int a = this.plugin.getArena(p).intValue();
int a = 1; //Jeppa: define a default (may be needed if protall is true) int a = 1; //Jeppa: define a default (may be needed if protall is true)
if (plugin.getArena(p) != null) a = plugin.getArena(p); if (plugin.getArena(p) != null){
if (!event.isCancelled() && plugin.Playing.get(a).contains(pname)){ a = plugin.getArena(p);
if (plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")) { if (!event.isCancelled() && plugin.Playing.get(a).contains(pname)){
event.setCancelled(true); if (plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")) {
p.sendMessage(ChatColor.RED + "You can't break blocks while playing!");
} else if ((((plugin.canjoin.get(a))) || (protall)) && ((plugin.config.getStringList("worlds").isEmpty()) || ((!plugin.config.getStringList("worlds").isEmpty()) && (plugin.config.getStringList("worlds").contains(p.getWorld().getName()))))) {
if (((plugin.management.getIntegerList("blocks.whitelist").isEmpty()) || ((!plugin.management.getIntegerList("blocks.whitelist").isEmpty()) && (!plugin.management.getIntegerList("blocks.whitelist").contains(Integer.valueOf(b.getTypeId()))))) ^ (plugin.management.getBoolean("blocks.useWhitelistAsBlacklist"))) {
event.setCancelled(true); event.setCancelled(true);
p.sendMessage(ChatColor.RED + "That is an illegal block!"); p.sendMessage(ChatColor.RED + "You can't break blocks while playing!");
} else { } else if ((((plugin.canjoin.get(a))) || (protall)) && ((plugin.config.getStringList("worlds").isEmpty()) || ((!plugin.config.getStringList("worlds").isEmpty()) && (plugin.config.getStringList("worlds").contains(p.getWorld().getName()))))) {
String w = b.getWorld().getName(); if (((plugin.management.getIntegerList("blocks.whitelist").isEmpty()) || ((!plugin.management.getIntegerList("blocks.whitelist").isEmpty()) && (!plugin.management.getIntegerList("blocks.whitelist").contains(Integer.valueOf(b.getTypeId()))))) ^ (plugin.management.getBoolean("blocks.useWhitelistAsBlacklist"))) {
int x = b.getX(); event.setCancelled(true);
int y = b.getY(); p.sendMessage(ChatColor.RED + "That is an illegal block!");
int z = b.getZ(); } else {
int d = b.getTypeId(); String w = b.getWorld().getName();
byte m = b.getData(); int x = b.getX();
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; int y = b.getY();
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed"); int z = b.getZ();
if (!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)) { int d = b.getTypeId();
blocks.add(coords); byte m = b.getData();
plugin.data.set("Blocks_Destroyed", blocks); String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a;
plugin.saveData(); List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
if (!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)) {
blocks.add(coords);
plugin.data.set("Blocks_Destroyed", blocks);
plugin.saveData();
}
} }
} }
} }

View File

@ -450,6 +450,7 @@ public class Main extends JavaPlugin{
} }
}else }else
getServer().broadcastMessage(ChatColor.GREEN + "Grace period is over, FIGHT!"); getServer().broadcastMessage(ChatColor.GREEN + "Grace period is over, FIGHT!");
getServer().getScheduler().cancelTask(grace);
} }
} }
},20L, 20L); },20L, 20L);