Help with random item giving

Discussion in 'Plugin Development' started by SmooshCakez, Jul 11, 2014.

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

    SmooshCakez

    Disclaimer: I started learning Java and the Bukkit API about a week ago, and I'm pretty sucky at it right now, so don't flip if I got the simplest thing wrong (which I probably did).

    So, I'm basically trying to make a plugin where you can right-click chests with a certain name ("Satchels") and get a random item. I've looked a lot of places, and just can't seem to find what's wrong with it. Whenever I try to start my server (1.7.10) I get a long crash report (and obviously, it crashes). The code looked a lot different before now, I've been trying a lot to fix this up.

    Here's my main class: http://pastebin.com/EZpLp1Sb (No other class files in the project, only this 1)
    Here's my plugin.yml: http://pastebin.com/DtcEN0bJ
    Here's the crash report: http://pastebin.com/dQMEnFt1
    (Using pastebin because the code is pretty long for a forum post)

    I know it could probably be done a lot better, simpler, and more compact than the way I did it, but as I said, I don't know much Java as of now. Any help would be appreciated.
     
  2. If your server crashes/sends a crash report on startup, it could either be something in the onEnable() function, another plugin, or an internal server problem. A crash report/any errors would be beneficial in helping determine what is causing the crash and errors. SmooshCakez
     
  3. Offline

    SmooshCakez

    I have tried working out a lot of things in this code. The onEnable() hasn't had any affect as far as I can tell, my original code still failed to work on my server without it. Also, added the link to the crash report to the main post.
     
  4. Offline

    SmooshCakez

    Bump, in a bit of a hurry to get this done.
     
  5. Offline

    Necrodoom

    The crash report has to do with a wrongly done MC JSON file, rather than any plugin. Check your server folder JSON files, and try move them out.

    On another matter, I dont have the time to inspect all your code, but one thing that stands out is that you try to compare strings with ==, which will fail for your purposes. See java tutorials about string for why, and use .equals() instead.
     
  6. Offline

    SmooshCakez

    The server will start up now, I fixed the JSON. The plugin still doesn't work. Also, I'm looking at them now.
     
  7. Offline

    Necrodoom

    SmooshCakez fix these errors and see If you still get issues, if yes, explain them and paste edited code.
     
  8. Offline

    SmooshCakez

    I fixed the issues, and I'll post the edited code soon, I'm on a different computer. :/

    Bump.
     
Thread Status:
Not open for further replies.

Share This Page