Please check my code

Discussion in 'Plugin Development' started by GoduHD, Jan 15, 2017.

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

    GoduHD

    I wrote a plugin that should give the Player coins when he kills a mob, but nothing happens when i try to run it please check my Code : http://pastebin.com/RUTeZDF2
     
  2. Offline

    timtower Administrator Administrator Moderator

    @GoduHD You didn't register the event.
     
    GoduHD likes this.
  3. Offline

    GoduHD

    And how can i do this? Thx for your fast answer
     
  4. Offline

    timtower Administrator Administrator Moderator

    TheEnderman, GoduHD and JanTuck like this.
  5. Offline

    GoduHD

    I tried for hours to fix my code with the tutorial but it still doesn't work. Can someone please correct my code and post it again?
     
  6. Offline

    timtower Administrator Administrator Moderator

    @GoduHD this.getServer().getPluginManager().registerEvents(this,this);
    You are missing that line.
     
    GoduHD likes this.
  7. Offline

    DoggyCode™

    I too, used this tutorial. It's a good way (however not a good tutorial in general) to learn how to save data to a yml file using the Bukkit API. However, I must discourage you from using this method when dealing with large data and plugins. It could potentially take 5 seconds before the user's data is found in the file if it has to constantly load from it in order to display wanted data to the user.
     
    GoduHD likes this.
  8. Offline

    JanTuck

    @DoggyCode™

    He could just cache the data using a LoadingCache or another Cache.

    But the way he does it is just... Waste of cpu power, he loads the file every single time.
     
    GoduHD, DoggyCode™ and mine-care like this.
  9. Offline

    DoggyCode™

    Exactly, the LoadingCache was made for this exact reason.
     
    GoduHD and JanTuck like this.
  10. Offline

    GoduHD

    Thanks so much to all for your helpful tips. I fixed the problem finally
     
  11. Offline

    Zombie_Striker

    @GoduHD
    If your problem has been solved, mark this thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page