Added auto-ignite-tnt arena setting.

This commit is contained in:
garbagemule
2012-03-08 02:05:31 +01:00
parent a036891996
commit 70ec22a066
4 changed files with 25 additions and 13 deletions
+22 -11
View File
@@ -18,6 +18,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Slime;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Wolf;
import org.bukkit.event.Event.Result;
@@ -94,7 +95,8 @@ public class ArenaListener
lockFoodLevel;
private boolean allowTeleport,
canShare,
allowMonsters;
allowMonsters,
autoIgniteTNT;
private Set<Player> banned;
@@ -111,16 +113,17 @@ public class ArenaListener
* Uglier code
*/
ConfigSection s = arena.getSettings();
this.softRestore = s.getBoolean("soft-restore", false);
this.softRestoreDrops = s.getBoolean("soft-restore-drops", false);
this.protect = s.getBoolean("protect", true);
this.monsterExp = s.getBoolean("monster-exp", false);
this.monsterInfight = s.getBoolean("monster-infight", false);
this.pvpEnabled = s.getBoolean("pvp-enabled", false);
this.foodRegen = s.getBoolean("food-regen", false);
this.lockFoodLevel = s.getBoolean("lock-food-level", true);
this.allowTeleport = s.getBoolean("allow-teleporting", false);
this.canShare = s.getBoolean("share-items-in-arena", true);
this.softRestore = s.getBoolean("soft-restore", false);
this.softRestoreDrops = s.getBoolean("soft-restore-drops", false);
this.protect = s.getBoolean("protect", true);
this.monsterExp = s.getBoolean("monster-exp", false);
this.monsterInfight = s.getBoolean("monster-infight", false);
this.pvpEnabled = s.getBoolean("pvp-enabled", false);
this.foodRegen = s.getBoolean("food-regen", false);
this.lockFoodLevel = s.getBoolean("lock-food-level", true);
this.allowTeleport = s.getBoolean("allow-teleporting", false);
this.canShare = s.getBoolean("share-items-in-arena", true);
this.autoIgniteTNT = s.getBoolean("auto-ignite-tnt", false);
this.allowMonsters = arena.getWorld().getAllowMonsters();
@@ -186,6 +189,14 @@ public class ArenaListener
event.setCancelled(true);
return;
}
// If the block is TNT, replace with a TNTPrimed
if (autoIgniteTNT && b.getType() == Material.TNT) {
event.setCancelled(true);
event.getPlayer().getInventory().removeItem(new ItemStack(Material.TNT, 1));
b.getWorld().spawn(b.getRelative(BlockFace.UP).getLocation(), TNTPrimed.class);
return;
}
// Otherwise, block was placed during a session.
arena.addBlock(b);