Skip to content

Commit

Permalink
Add item-frame-rotation flag.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wizjany committed Mar 7, 2019
1 parent b6e2bca commit ff37cc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -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.
Expand Down
Expand Up @@ -424,7 +424,12 @@ public void onUseEntity(UseEntityEvent event) {

/* Paintings, item frames, etc. */
} else if (Entities.isConsideredBuildingIfUsed(event.getEntity())) {
canUse = query.testBuild(BukkitAdapter.adapt(target), associable, combine(event));
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 */
Expand Down

0 comments on commit ff37cc7

Please sign in to comment.