mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 19:55:17 +01:00
parent
01b7ace0be
commit
6f0912e1d2
@ -14,7 +14,6 @@ import world.bentobox.bentobox.lists.Flags;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author tastybento
|
* @author tastybento
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class BlockInteractionListener extends FlagListener {
|
public class BlockInteractionListener extends FlagListener {
|
||||||
|
|
||||||
@ -24,6 +23,15 @@ public class BlockInteractionListener extends FlagListener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(final PlayerInteractEvent e) {
|
public void onPlayerInteract(final PlayerInteractEvent e) {
|
||||||
|
// For some items, we need to do a specific check for RIGHT_CLICK_BLOCK
|
||||||
|
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
|
if (e.getClickedBlock().getType().equals(Material.ITEM_FRAME)) {
|
||||||
|
checkIsland(e, e.getClickedBlock().getLocation(), Flags.ITEM_FRAME);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, we just don't care about the RIGHT_CLICK_BLOCK action.
|
||||||
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -243,11 +251,13 @@ public class BlockInteractionListener extends FlagListener {
|
|||||||
case END_PORTAL_FRAME:
|
case END_PORTAL_FRAME:
|
||||||
checkIsland(e, loc, Flags.PLACE_BLOCKS);
|
checkIsland(e, loc, Flags.PLACE_BLOCKS);
|
||||||
break;
|
break;
|
||||||
|
case ITEM_FRAME:
|
||||||
|
checkIsland(e, loc, Flags.ITEM_FRAME);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,6 +83,7 @@ public final class Flags {
|
|||||||
public static final Flag BUTTON = new Flag.Builder("BUTTON", Material.OAK_BUTTON).build();
|
public static final Flag BUTTON = new Flag.Builder("BUTTON", Material.OAK_BUTTON).build();
|
||||||
public static final Flag REDSTONE = new Flag.Builder("REDSTONE", Material.REDSTONE).build();
|
public static final Flag REDSTONE = new Flag.Builder("REDSTONE", Material.REDSTONE).build();
|
||||||
public static final Flag SPAWN_EGGS = new Flag.Builder("SPAWN_EGGS", Material.COW_SPAWN_EGG).build();
|
public static final Flag SPAWN_EGGS = new Flag.Builder("SPAWN_EGGS", Material.COW_SPAWN_EGG).build();
|
||||||
|
public static final Flag ITEM_FRAME = new Flag.Builder("ITEM_FRAME", Material.ITEM_FRAME).build();
|
||||||
|
|
||||||
// Entity interactions
|
// Entity interactions
|
||||||
public static final Flag ARMOR_STAND = new Flag.Builder("ARMOR_STAND", Material.ARMOR_STAND).listener(new EntityInteractListener()).build();
|
public static final Flag ARMOR_STAND = new Flag.Builder("ARMOR_STAND", Material.ARMOR_STAND).listener(new EntityInteractListener()).build();
|
||||||
|
Loading…
Reference in New Issue
Block a user