Add item-frame-rotation flag.

When set to allow, allows players to rotate item in item frames even if
they wouldn't normally have permissions to modify the item frame.

Fixes WORLDGUARD-3588.
This commit is contained in:
wizjany 2019-03-06 19:05:36 -05:00
parent b6e2bca5bc
commit ff37cc7935
2 changed files with 7 additions and 1 deletions

View File

@ -59,6 +59,7 @@ public final class Flags {
public static final StateFlag LIGHTER = register(new StateFlag("lighter", false));
public static final StateFlag RIDE = register(new StateFlag("ride", false));
public static final StateFlag POTION_SPLASH = register(new StateFlag("potion-splash", false));
public static final StateFlag ITEM_FRAME_ROTATE = register(new StateFlag("item-frame-rotation", false));
// These flags are similar to the ones above (used in tandem with BUILD),
// but their defaults are set to TRUE because it is more user friendly.

View File

@ -424,7 +424,12 @@ public void onUseEntity(UseEntityEvent event) {
/* Paintings, item frames, etc. */
} else if (Entities.isConsideredBuildingIfUsed(event.getEntity())) {
if (event.getEntity().getType() == EntityType.ITEM_FRAME && event.getCause().getFirstPlayer() != null
&& ((org.bukkit.entity.ItemFrame) event.getEntity()).getItem() != null) {
canUse = query.testBuild(BukkitAdapter.adapt(target), associable, combine(event, Flags.ITEM_FRAME_ROTATE));
} else {
canUse = query.testBuild(BukkitAdapter.adapt(target), associable, combine(event));
}
what = "change that";
/* Ridden on use */