Skip to content

Commit

Permalink
Added bed explosion protection in the nether.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Aug 9, 2016
1 parent 631e3a7 commit fe54b47
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,5 @@
<url>http://maven.sk89q.com/repo/</url>
</repository>
</repositories>
<version>3.0.3</version>
<version>3.0.3.1</version>
</project>
36 changes: 9 additions & 27 deletions src/com/wasteofplastic/askyblock/listeners/IslandGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
Expand Down Expand Up @@ -1800,33 +1801,6 @@ public void onPlayerInteract(final PlayerInteractEvent e) {
}
// Get island
Island island = plugin.getGrid().getProtectedIslandAt(e.getPlayer().getLocation());
/* This doesn't work because this event is not called when an ender pearl is thrown
// Ender pearl check
if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if(e.getPlayer().getItemInHand().getType().equals(Material.ENDER_PEARL)) {
if (island == null) {
if (Settings.allowEnderPearls) {
return;
}
} else {
if (island.isSpawn()) {
if (Settings.allowEnderPearls) {
return;
}
} else {
// Regular island
if (island.getIgsFlag(Flags.allowEnderPearls)) {
return;
}
}
}
e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
*/

// Check for disallowed clicked blocks
if (e.getClickedBlock() != null) {
if (DEBUG) {
Expand Down Expand Up @@ -2153,6 +2127,14 @@ public void onPlayerInteract(final PlayerInteractEvent e) {
e.setCancelled(true);
return;
}
break;
case BED_BLOCK:
if (e.getPlayer().getWorld().getEnvironment().equals(Environment.NETHER)) {
// Prevent explosions
e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
default:
break;
}
Expand Down
6 changes: 6 additions & 0 deletions src/com/wasteofplastic/askyblock/panels/ControlPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ public void onInventoryClick(InventoryClickEvent event) {
// Challenges
if (inventory.getName().equals(plugin.myLocale(player.getUniqueId()).challengesguiTitle)) {
event.setCancelled(true);
if (event.getClick().equals(ClickType.SHIFT_RIGHT)) {
player.closeInventory();
return;
}
if (event.getSlotType() == SlotType.OUTSIDE) {
player.closeInventory();
return;
Expand Down Expand Up @@ -276,6 +280,7 @@ public void onInventoryClick(InventoryClickEvent event) {
}
}
}
return;
}
/*
* Minishop section
Expand Down Expand Up @@ -354,6 +359,7 @@ public void onInventoryClick(InventoryClickEvent event) {
}
}
}
return;
}
// Check control panels
for (String panelName : controlPanel.keySet()) {
Expand Down

0 comments on commit fe54b47

Please sign in to comment.