Cover some more plants as crop-growth.

Note that spigot doesn't throw events for bamboo yet, so this only
applies to sugar canes and cacti at the moment. Should work if spigot
implements BlockGrowEvent for cacti though.

Fixes WORLDGUARD-4137.
This commit is contained in:
wizjany 2019-09-13 17:20:51 -04:00
parent effbd62e68
commit c633a2d070
2 changed files with 6 additions and 2 deletions

View File

@ -620,7 +620,7 @@ public void onBlockSpread(BlockSpreadEvent event) {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockGrow(BlockGrowEvent event) {
WorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
final Material type = event.getBlock().getType();
final Material type = event.getNewState().getType();
if (Materials.isCrop(type)) {
if (wcfg.disableCropGrowth) {

View File

@ -1198,7 +1198,11 @@ public static boolean isCrop(Material type) {
|| type == Material.MELON_STEM
|| type == Material.PUMPKIN_STEM
|| type == Material.PUMPKIN
|| type == Material.MELON;
|| type == Material.MELON
|| type == Material.CACTUS
|| type == Material.SUGAR_CANE
|| type == Material.BAMBOO
|| type == Material.BAMBOO_SAPLING;
}
/**