mirror of
https://github.com/BentoBoxWorld/Greenhouses.git
synced 2025-01-21 07:31:26 +01:00
Fixes where water could be placed in nether
https://github.com/BentoBoxWorld/Greenhouses/issues/3 https://github.com/BentoBoxWorld/Greenhouses/issues/22
This commit is contained in:
parent
f28a50eb5f
commit
228644d40f
@ -43,7 +43,8 @@ public class GreenhouseEvents implements Listener {
|
|||||||
if (!e.getPlayer().getWorld().getEnvironment().equals(World.Environment.NETHER)) {
|
if (!e.getPlayer().getWorld().getEnvironment().equals(World.Environment.NETHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getItem() != null && e.getItem().getType().equals(Material.WATER_BUCKET)) {
|
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getItem() != null && e.getItem().getType().equals(Material.WATER_BUCKET)
|
||||||
|
&& plugin.getManager().getMap().getGreenhouse(e.getClickedBlock().getLocation()).isPresent()) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
e.getClickedBlock().getRelative(e.getBlockFace()).setType(Material.WATER);
|
e.getClickedBlock().getRelative(e.getBlockFace()).setType(Material.WATER);
|
||||||
e.getItem().setType(Material.BUCKET);
|
e.getItem().setType(Material.BUCKET);
|
||||||
@ -120,7 +121,7 @@ public class GreenhouseEvents implements Listener {
|
|||||||
* Checks is broken blocks cause the greenhouse to fail
|
* Checks is broken blocks cause the greenhouse to fail
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled=true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled=true)
|
||||||
public void onBlockBreak(final BlockBreakEvent e) {
|
public void onBlockBreak(final BlockBreakEvent e) {
|
||||||
User user = User.getInstance(e.getPlayer());
|
User user = User.getInstance(e.getPlayer());
|
||||||
plugin.getManager().getMap().getGreenhouse(e.getBlock().getLocation()).ifPresent(g -> {
|
plugin.getManager().getMap().getGreenhouse(e.getBlock().getLocation()).ifPresent(g -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user