mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-26 01:51:30 +01:00
Disables podzol and coarse dirt from becoming path.
This protection reuses Flags.COARSE_DIRT_TILLING. Fixes #1878
This commit is contained in:
parent
2f244c0606
commit
3784aa48d7
@ -35,6 +35,28 @@ public class CoarseDirtTillingListener extends FlagListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protect Coarse dirt and podzol from being made as dirt path block.
|
||||||
|
* @param e PlayerInteractEvent
|
||||||
|
*/
|
||||||
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
|
public void onDirtPathCreation(PlayerInteractEvent e)
|
||||||
|
{
|
||||||
|
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) &&
|
||||||
|
e.getItem() != null &&
|
||||||
|
this.getIWM().inWorld(e.getClickedBlock().getWorld()) &&
|
||||||
|
(e.getClickedBlock().getType().equals(Material.COARSE_DIRT) || e.getClickedBlock().getType().equals(Material.PODZOL)) &&
|
||||||
|
e.getItem().getType().name().endsWith("_SHOVEL") &&
|
||||||
|
!Flags.COARSE_DIRT_TILLING.isSetForWorld(e.getClickedBlock().getWorld()))
|
||||||
|
{
|
||||||
|
e.setCancelled(true);
|
||||||
|
User user = User.getInstance(e.getPlayer());
|
||||||
|
user.notify("protection.protected", TextVariables.DESCRIPTION, user.getTranslation(Flags.COARSE_DIRT_TILLING.getHintReference()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If podzol is mined when coarse dirt tilling is not allowed, then it'll just drop podzol and not dirt
|
* If podzol is mined when coarse dirt tilling is not allowed, then it'll just drop podzol and not dirt
|
||||||
* This prevents an exploit where growing big spruce trees can turn gravel into podzol.
|
* This prevents an exploit where growing big spruce trees can turn gravel into podzol.
|
||||||
|
Loading…
Reference in New Issue
Block a user