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) {
//int a = this.plugin.getArena(p).intValue();
int a = 1; //Jeppa: define a default (may be needed if protall is true)
if (plugin.getArena(p) != null) a = plugin.getArena(p);
if (!event.isCancelled() && plugin.Playing.get(a).contains(pname)){
if (plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")) {
event.setCancelled(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"))) {
if (plugin.getArena(p) != null){
a = plugin.getArena(p);
if (!event.isCancelled() && plugin.Playing.get(a).contains(pname)){
if (plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")) {
event.setCancelled(true);
p.sendMessage(ChatColor.RED + "That is an illegal block!");
} else {
String w = b.getWorld().getName();
int x = b.getX();
int y = b.getY();
int z = b.getZ();
int d = b.getTypeId();
byte m = b.getData();
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a;
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();
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);
p.sendMessage(ChatColor.RED + "That is an illegal block!");
} else {
String w = b.getWorld().getName();
int x = b.getX();
int y = b.getY();
int z = b.getZ();
int d = b.getTypeId();
byte m = b.getData();
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a;
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
getServer().broadcastMessage(ChatColor.GREEN + "Grace period is over, FIGHT!");
getServer().getScheduler().cancelTask(grace);
}
}
},20L, 20L);