ChestShop (iConomyChestShop)

ChestShop (iConomyChestShop)

6M Downloads

API questions

LogGits opened this issue ยท 3 comments

commented

I am trying to get if a double chest has is already a shop, is there a way to do this. I have tried ChestShopSign.isShopBlock(b) but that only does it for the specific block.

Also is there a method that returns whether the player can actually place a sign on the chest (e.g. has build perms for that area that applies to worldguard regions, spawn regions, griefprevention regions etc)?

Loving the plugin, keep up the great work!

commented

I am trying to get if a double chest has is already a shop, is there a way to do this. I have tried ChestShopSign.isShopBlock(b) but that only does it for the specific block.

See the listener method that blocks shop chest breaking.

Also is there a method that returns whether the player can actually place a sign on the chest (e.g. has build perms for that area that applies to worldguard regions, spawn regions, griefprevention regions etc)?

You could use the Security#canAccess method (or directly call the ProtectioCheckEvent) or one of the other Security class methods to check that.

Loving the plugin, keep up the great work!

Thanks

commented

See the listener method that blocks shop chest breaking.

Am not able to get this working, im checking if (uBlock.findAnyNearbyShopSign(b) == null) { to see if their is no shop connected to that (e.g. doublechest). Let me know if i'm missing something.

You could use the Security#canAccess method (or directly call the ProtectioCheckEvent) or one of the other Security class methods to check that.

Cheers however i was also not able to get this functional.

if (uBlock.findAnyNearbyShopSign(b) == null) { // to check if the block (chest/doublechest) is a shop
broadcast(1);
if (Security.canAccess(player, relative)) { // to test if player can place sign on the aforementioned chest.
broadcast(2);

yields, 1 and 2 when it's testing a double chest.

commented

@Phoenix616 Thought i got this working but that wasn't the case. I am trying to make an item that when a player rightclicks a chest(double or single) it creates a shop but i am unable to check if they are actually able to create a sign on the chest (if its a shop).

        if (block != null && b.getType() == Material.CHEST) {
            if (!canBeBroken(block, player)) {
                Text.sendMessage(sender, MessageHandler.ITEM_CREATE_SHOP_INVALID_SHOP_EXISTS.getMessage());
                return false;
            }
            BlockFace opposite = player.getFacing().getOppositeFace();
            Block relative = block.getRelative(opposite);
            if (Security.canAccess(player, block)) {

It gets through both checks (canBeBroken & canAccess) where block is the block that they rightclick on. Any ideas?