Fix sapling + bonemeal considered as usage rather than building.

Fixes WORLDGUARD-3169.
This commit is contained in:
sk89q 2014-08-31 18:21:11 -07:00
parent c4b3c1d033
commit bd2a8daad3
2 changed files with 17 additions and 1 deletions

View File

@ -246,8 +246,13 @@ public boolean apply(Location target) {
boolean canUse; boolean canUse;
String what; String what;
/* Saplings, etc. */
if (Materials.isConsideredBuildingIfUsed(type)) {
canUse = query.testBuild(target, associable);
what = "use that";
/* Inventory */ /* Inventory */
if (Materials.isInventoryBlock(type)) { } else if (Materials.isInventoryBlock(type)) {
canUse = query.testBuild(target, associable, DefaultFlag.USE, DefaultFlag.CHEST_ACCESS); canUse = query.testBuild(target, associable, DefaultFlag.USE, DefaultFlag.CHEST_ACCESS);
what = "open that"; what = "open that";

View File

@ -616,4 +616,15 @@ public static boolean isItemAppliedToBlock(Material item, Material block) {
return flags == null || (flags & MODIFIES_BLOCKS) == MODIFIES_BLOCKS; return flags == null || (flags & MODIFIES_BLOCKS) == MODIFIES_BLOCKS;
} }
/**
* Test whether the given material should be tested as "building" when
* it is used.
*
* @param type the type
* @return true to be considered as used
*/
public static boolean isConsideredBuildingIfUsed(Material type) {
return type == Material.SAPLING;
}
} }