Monument monument = warzone.getMonumentFromCenterBlock(block);
if (monument.hasOwner()) {
Team ownerTeam = monument.getOwnerTeam();
if (War.war.isSpoutServer()) {
for (Player p : team.getPlayers()) {
SpoutPlayer sp = SpoutManager.getPlayer(p);
if (sp.isSpoutCraftEnabled()) {
sp.sendNotification(
SpoutDisplayer.cleanForNotification("Monument " + ChatColor.WHITE + monument.getName()),
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "freed by " + team.getKind().getColor() + player.getName() + ChatColor.YELLOW + "!"),
ownerTeam.getKind().getMaterial(),
ownerTeam.getKind().getData(),
10000);
}
}
}
warzone.broadcast("zone.monument.lose", ownerTeam.getName(), monument.getName());
monument.uncapture();
}
event.setCancelled(false);
return;
}
// changes in parts of important areas
if (warzone != null && warzone.isImportantBlock(block) && (!isZoneMaker || (isZoneMaker && team != null))) {
// breakage of spawn
if (team != null && team.isSpawnLocation(block.getLocation())) {
// let team members loot one block the spawn for monument captures
if (player.getInventory().containsAtLeast(team.getKind().getBlockHead(), 1)) {
War.war.badMsg(player, "build.denied.zone.multteam", team.getName());
event.setCancelled(true);
return;
} else {
event.setCancelled(false); // very important, otherwise could get cancelled but unbreakableZoneBlocks further down
return;
}
}
// stealing of flag
if (team != null && warzone.isEnemyTeamFlagBlock(team, block)) {
if (warzone.isFlagThief(player.getName())) {
// detect audacious thieves
War.war.badMsg(player, "zone.stealextra.flag");
} else if (warzone.isBombThief(player.getName()) || warzone.isCakeThief(player.getName())) {
War.war.badMsg(player, "zone.stealextra.other");
} else {
Team lostFlagTeam = warzone.getTeamForFlagBlock(block);
if (lostFlagTeam.getPlayers().size() != 0) {
// player just broke the flag block of other team: cancel to avoid drop, give player the block, set block to air
ItemStack teamKindBlock = lostFlagTeam.getKind().getBlockHead();
player.getInventory().clear();
player.getInventory().addItem(teamKindBlock);
warzone.addFlagThief(lostFlagTeam, player.getName());
block.setType(Material.AIR);
for (Team t : warzone.getTeams()) {
t.teamcast("zone.steal.flag.broadcast", team.getKind().getColor() + player.getName() + ChatColor.WHITE, lostFlagTeam.getName());
if (t.getName().equals(lostFlagTeam.getName())) {
if (War.war.isSpoutServer()) {
for (Player p : t.getPlayers()) {
SpoutPlayer sp = SpoutManager.getPlayer(p);
if (sp.isSpoutCraftEnabled()) {
sp.sendNotification(
SpoutDisplayer.cleanForNotification(team.getKind().getColor() + player.getName() + ChatColor.YELLOW + " stole"),
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "your flag!"),
lostFlagTeam.getKind().getMaterial(),
lostFlagTeam.getKind().getData(),
5000);
}
}
}
t.teamcast("zone.steal.flag.prevent", team.getKind().getColor() + player.getName() + ChatColor.WHITE, team.getName());
}
}
War.war.msg(player, "zone.steal.flag.notice", lostFlagTeam.getName());
} else {
War.war.msg(player, "zone.steal.flag.empty", lostFlagTeam.getName());
}
}
event.setCancelled(true);
return;
} else if (team != null && warzone.isBombBlock(block)) {
if (warzone.isBombThief(player.getName())) {
// detect audacious thieves
War.war.badMsg(player, "zone.stealextra.bomb");
} else if (warzone.isFlagThief(player.getName()) || warzone.isCakeThief(player.getName())) {
War.war.badMsg(player, "zone.stealextra.other");
} else {
Bomb bomb = warzone.getBombForBlock(block);
// player just broke the bomb block: cancel to avoid drop, give player the block, set block to air
ItemStack tntBlock = new ItemStack(Material.TNT);
tntBlock.setDurability((short)8);
player.getInventory().clear();
player.getInventory().addItem(tntBlock);
warzone.addBombThief(bomb, player.getName());
block.setType(Material.AIR);
for (Team t : warzone.getTeams()) {
t.teamcast("zone.steal.bomb.broadcast", team.getKind().getColor() + player.getName() + ChatColor.WHITE, ChatColor.GREEN + bomb.getName() + ChatColor.WHITE);
if (War.war.isSpoutServer()) {
for (Player p : t.getPlayers()) {
SpoutPlayer sp = SpoutManager.getPlayer(p);
if (sp.isSpoutCraftEnabled()) {
sp.sendNotification(
SpoutDisplayer.cleanForNotification(team.getKind().getColor() + player.getName() + ChatColor.YELLOW + " has "),
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "bomb " + ChatColor.GREEN + bomb.getName() + ChatColor.YELLOW + "!"),
Material.TNT,
(short)0,
5000);
}
}
}
t.teamcast("zone.steal.bomb.prevent", team.getKind().getColor() + player.getName() + ChatColor.WHITE);
}
War.war.msg(player, "zone.steal.bomb.notice", bomb.getName());
}
event.setCancelled(true);
return;
} else if (team != null && warzone.isCakeBlock(block)) {
if (warzone.isCakeThief(player.getName())) {
// detect audacious thieves
War.war.badMsg(player, "zone.stealextra.cake");
} else if (warzone.isFlagThief(player.getName()) || warzone.isBombThief(player.getName())) {
War.war.badMsg(player, "zone.stealextra.other");
} else {
Cake cake = warzone.getCakeForBlock(block);
// player just broke the cake block: cancel to avoid drop, give player the block, set block to air
ItemStack cakeBlock = new ItemStack(Material.CAKE);
cakeBlock.setDurability((short)8);
player.getInventory().clear();
player.getInventory().addItem(cakeBlock);
warzone.addCakeThief(cake, player.getName());
block.setType(Material.AIR);
for (Team t : warzone.getTeams()) {
t.teamcast("zone.steal.cake.broadcast", team.getKind().getColor() + player.getName() + ChatColor.WHITE, ChatColor.GREEN + cake.getName() + ChatColor.WHITE);
if (War.war.isSpoutServer()) {
for (Player p : t.getPlayers()) {
SpoutPlayer sp = SpoutManager.getPlayer(p);
if (sp.isSpoutCraftEnabled()) {
sp.sendNotification(
SpoutDisplayer.cleanForNotification(team.getKind().getColor() + player.getName() + ChatColor.YELLOW + " has "),
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "cake " + ChatColor.GREEN + cake.getName() + ChatColor.YELLOW + "!"),
Material.CAKE,
(short)0,
5000);