Signs: need to know a few things...

Discussion in 'Plugin Development' started by Flenix, Aug 30, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Flenix

    Hey guys,

    I'm very new to developing plugins, but really enjoying it so far. However, I've hit a roadblock.

    My plugin idea is, I'm trying to make a sensor block that searches a players inventory for a specified item with the data value/metavalue - and if they have the item, it triggers a switch to activate redstone. Sort of like the sensors in Craftbook/Falsebook, but for items.

    My problem is, I can't work out how to make the sign "check" a players inventory, or find their location. I've searched around for about 3 hours and getting a little bored of it now...

    What I need to know:
    -How to check a players inventory, for an item specified on the sign
    -How to check a players location in relation to the sign
    -and how to let a player put these values on the sign (specify what item its looking for, and the radius)

    Any help would be very much appreciated!

    And yes, I did request this as a feature on both Craftbook and Falsebook, 5 times between them. Never got a response, and I need it... so decided to try myself in a standalone plugin.
     
  2. Offline

    Shamebot

    For how to read a sign, have a look at the org.bukkit.block.Sign class.
    Code:java
    1. Sign sign = (Sign)block.getState();

    make sure the block is a sign.
    Array of online players:
    Code:java
    1. Player[] players = getServer().getOnlinePlayers();

    Have a look at the org.bukkit.Location class.
     
Thread Status:
Not open for further replies.

Share This Page