Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.0.5.5' into 3.0.6
Browse files Browse the repository at this point in the history
Conflicts:
	pom.xml
	src/com/wasteofplastic/askyblock/listeners/IslandGuard.java

	Resolved.
  • Loading branch information
tastybento committed Jan 23, 2017
2 parents b1b721b + 5f62a4b commit a0b5394
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public ChatListener(ASkyBlock plugin) {



@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onChat(final AsyncPlayerChatEvent event) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + event.getEventName());
Expand Down
62 changes: 35 additions & 27 deletions src/com/wasteofplastic/askyblock/listeners/IslandGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -1756,38 +1756,46 @@ public void onPlayerInteract(final PlayerInteractEvent e) {
plugin.getLogger().info("DEBUG: Material " + e.getMaterial());
}
// Look along player's sight line to see if any blocks are fire
BlockIterator iter = new BlockIterator(e.getPlayer(), 10);
Block lastBlock = iter.next();
while (iter.hasNext()) {
lastBlock = iter.next();
if (DEBUG)
plugin.getLogger().info("DEBUG: lastBlock = " + lastBlock.toString());
if (lastBlock.equals(e.getClickedBlock())) {
if (DEBUG)
plugin.getLogger().info("DEBUG: found clicked block");
continue;
}
if (lastBlock.getType().equals(Material.FIRE)) {
try {
BlockIterator iter = new BlockIterator(e.getPlayer(), 10);
Block lastBlock = iter.next();
while (iter.hasNext()) {
lastBlock = iter.next();
if (DEBUG)
plugin.getLogger().info("DEBUG: fire found");
if (island != null && island.isSpawn()) {
if (!island.getIgsFlag(SettingsFlag.FIRE_EXTINGUISH)) {
e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
} else {
if (Settings.allowFireExtinguish) {
if (DEBUG)
plugin.getLogger().info("DEBUG: extinguishing is allowed");
continue;
plugin.getLogger().info("DEBUG: lastBlock = " + lastBlock.toString());
if (lastBlock.equals(e.getClickedBlock())) {
if (DEBUG)
plugin.getLogger().info("DEBUG: found clicked block");
continue;
}
if (lastBlock.getType().equals(Material.FIRE)) {
if (DEBUG)
plugin.getLogger().info("DEBUG: fire found");
if (island != null && island.isSpawn()) {
if (!island.getIgsFlag(SettingsFlag.FIRE_EXTINGUISH)) {
e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
} else {
e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
if (Settings.allowFireExtinguish) {
if (DEBUG)
plugin.getLogger().info("DEBUG: extinguishing is allowed");
continue;
} else {
e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
}
}
} catch (Exception ex) {
// To catch at block iterator exceptions that can happen in the void or at the very top of blocks
if (DEBUG) {
plugin.getLogger().info("DEBUG: block iterator error");
ex.printStackTrace();
}
}
// Handle Shulker Boxes
if (e.getClickedBlock().getType().toString().contains("BOX")) {
Expand Down

0 comments on commit a0b5394

Please sign in to comment.