Plugin Development Help

Discussion in 'Plugin Development' started by Lama_0, Nov 1, 2011.

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

    Lama_0

    Hey there fellow Minecrafters,

    I have recently been developing a simple but useful plugin for servers, BlockModifier. Yesterday I got a request that I am not too sure on how to handle, and that is being able to assign a block the id of colored wool. Such as with my plugin you can change any blocks into any other block with a whole number in the form of a java command 'int,' as all normal id's are whole numbers. But to deal with colored blocks, I would have to put something in referring to wool damage values... which in this case are something along the line of 35.1 (for orange) 35.2 (for magenta) and so on so forth... Would I simply change 'int' (in the source code) to 'double,' or add a whole new method (not deleting the 'int' method) being 'double' built for the sole purpose of wool color?

    Anyone want to shed some wisdom on this matter?

    Thanks for your time,
    Lama
     
  2. Offline

    ks07

    @Lama_0 The easiest thing to do would be to add a new method with two parameters, where the second is another int for the damage value. In your command listener, you would check the number of arguments, and the call the corresponding method depending on the format they used,

    E.g.
    /bm [id] OR /bm [id] [dmg]

    The other thing you could do would be to take [id] as a String, and then split it by ':' as normally used by plugins to show data values. This is slightly more work than the other, but it's down to preference and your command structure overall.

    Also, this should probably be in the dev forum.
     
  3. Offline

    Lama_0

    @ks07 Thanks, this actually helped shed a lot of light on this.

    Is there a way to move this to the dev forum? I didn't see it when creating the thread... EDIT: Wow, I need to check to see if I need glasses... The forum is staring at me now!
     
  4. Offline

    ks07

    No way to move it yourself - a forum mod might do it if you ask nicely. :p
     
  5. Offline

    Lama_0

    Ok, so I added a new method (a boolean) and it seems to not have any errors.. but now in my previous original method, there is an error for no reason where there wasnt one in the first place.. I think I may have done something wrong. And I am having trouble with adapting the listener class. Any advice?

    I really need some help with this, maybe a mod can move it for me to the Dev. Forum?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
  6. Offline

    ks07

    Without knowing specifically what the errors/problems are, I can't really offer any advice. What does the error say that wasn't there before? What are you adapting the listener class to do?

    It might help if you pastebinned the code, if you're willing to share, as well as the errors you're seeing. :)
     
  7. Offline

    Lama_0

    I would be willing to share privately... Im not sure how. Im sure when you look at it you will see something obvious. xD
     
  8. Offline

    ks07

    You're welcome to PM it to me (click my username), but I may not have time to look at it tonight, I'm about to get off.
     
  9. Offline

    Lama_0

    PM'ed. Thanks for all your effort, may as well list you as a second author by now >.>
     
Thread Status:
Not open for further replies.

Share This Page