Plugin using signs and check for block

Discussion in 'Plugin Development' started by yourmaster01, Jan 21, 2015.

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

    yourmaster01

    Ok all i know how to make the onSignCreate() event i am just needing help with 2 things.

    1) if a sign is places on or above a chest get the item that is in the chest (only below or on the chest)
    and
    2) get the number of items in the chest

    these need to be stored as a string if able. can anyone please help
     
  2. Offline

    Ambamore2000

    Idk what an onSignCreate() event is, but heres what you do. Get the location of the sign, subtract 1 from y. Get the block at that location, if chest, cast that block to a chest, and then there should be a chest method to get the number of items in it.
     
  3. Offline

    yourmaster01

    that i understand but i have not really worked with getting blocks at all
     
  4. Offline

    mythbusterma

  5. Offline

    yourmaster01

    Last edited by a moderator: Jan 22, 2015
  6. Offline

    mythbusterma

    @yourmaster01

    No......not at all. You know, that "null" warning isn't there for nothing, right?
     
  7. Offline

    yourmaster01

    @mythbusterma
    ok then can you give me a hand and show me how i should be doing this

    Can anyone help me out here

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  8. Offline

    PreFiXAUT

    @yourmaster01 The scennshot you took there..do you know anything about Java? Because that's just cancer for the eyes when I take a look at it. I currently count 7 BIG Problems with your Code, by just taking ONE look at it.

    So, decide:
    • Learn Java (or maybe again?) and start with Bukkit
    • Get someone who creates a Plugin for you
    I don't wanna be rude nor want to blame you (we all started somewhere), but apparently everyone without any Java experience is tring to start with Bukkit and is woundering why nothing is working. It's like you try to read a Book in a language you dont even know.

    Anyway. I dont wanna only cry'n'stuff, so here are your Problems (Figure them out by yourself by searching, they aren't that complicated):

    onSignPlace()
    • You init the Sign with Null (NULL = Nothing. So your Sign is NOTHING. And you try to get a Location of something, that doesn't exist at all)
    • You try to access the Signs Location without checking if it is null (which it is, because you set it to null one line before)
    • You init a World with Null (Same Problem as with the Sign)
    • You try to get a Block from a NULL-World (also here, no check or anything)
    onSignCreate()
    • You init the Block with Null (again ...)
    • You compare an Block to an Integer (...)
    • The amount is a String (why???)
     
Thread Status:
Not open for further replies.

Share This Page