The rite of passage "bukkit api n00b Questions" thread

Discussion in 'Plugin Development' started by feverdream, Jan 14, 2011.

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

    feverdream

    I have been looking at the docs as much as I can but as I am still finding it difficult to find people willing to share source that I can look at to learn the API so I am still somewhat confused by a few things. Yes, I could just test this on a server.. but I don't have access to a working test environment due to Notches updates.. and I want to learn. :)

    Essentially I want to be able to set and get blocks at given x/y/z coordinates for the current world. I figure this is a good basic skill as you can do a lot with it, and I would have loved to look at the iStick code for this as it does what I am looking for, but as the source is not available I am left looking at the docs instead. Oh well.

    1. Is it really as simple as the following to remove a block or otherwise change its type? This looks to be "too easy" and I want to be sure I am not otherwise missing something. As I am sure many of you know Hey0 used explicit setblockat() calls and I cant find anything like that in the javadoc so I just want to be sure this was it:
    Code:
                        Block b = plugin.getServer().getWorlds()[0].getBlockAt(blockClicked.getX() , blockClicked.getY() , blockClicked.getZ() );
                        b.setType(Material.Air);
    
    2. You may notice above I am blindly looking for the first world object returned by the server in that array; So how would I tell what world I am in so that I do not mistakenly change blocks in a world I am not in?

    3. I have a very strong desire to work with Chests and provide anti griefer plugins to protect worlds against thieves (exploding chests, etc).. but I am not finding much in the way of inventory API's for chests. Are these all one interface? I look in the javadocs and a search for "chest" returns no hits.

    Thank you in advance.
     
  2. Offline

    Lamp

    Chest hooks haven't been implemented yet ;).
     
  3. Offline

    feverdream

    What about the other 2 questions?
     
  4. Offline

    apexearth

  5. Offline

    feverdream

    Thank you. So many options to do what *looks* like the same thing, I sometimes feel like I'm working in Perl again..

    In bukkit the code I posted seems to be the only option for setting blocks I can find.
     
  6. Offline

    gillbz

    Who cares if they don't share source. Just use http://java.decompiler.free.fr/
    It's what the people making bukkit are (probably) using to decompile the minecraft code.
     
  7. Offline

    apexearth

    It's possible they just made the b.setType() function without actually filling it with any server-updating functionality. In which case, what you're doing is correct and you just need to wait for them to finish their code. That's what I'm banking on for a lot of my code. *cross fingers*

    It makes sense for them to do that as it gives plugin developers the ability to write their code even though Bukkit is not completed. And, I think I read somewhere that such was the case.
     
  8. Offline

    thegleek

    Well, yeah there's JD-GUI as you mentioned, but you also have to take into consideration that all the source is obfuscated... There's a public project called MCP that deals with the deobfuscation of that source code.
     
  9. Offline

    nossr50

  10. Offline

    DjDCH

Thread Status:
Not open for further replies.

Share This Page