[SOLVED] EnumParticles

Discussion in 'Spigot Plugin Development' started by K3ttle, Jun 19, 2015.

  1. Soooo I ran some checks and everything ran fine in my code, however when it comes to the actual passsing of the EnumPasrticle enum, i get kicked out of the server for a null packet being sent... and it is only when I am trying to send an actual enum Object I passed through my code. Here is an example:

    Particle Class(Where the error happens):
    http://prntscr.com/7itrkk

    Refrence class:
    http://prntscr.com/7itsk7

    Click Event Class:
    http://prntscr.com/7ittfa

    Any suggestions as to why in my particle sending class the refrence is making the enum particle null?
     
  2. The particle you try to send, isn't added intro your particle lists in your refrence class, try adding System.out.println(particleName); to the method that should return it. Then you should see that what is outputted isn't added in the init() method in the refrence class, this makes it so that the EnumParticle will be null. What I also recommend is before sending check if the EnumParticle isn't null in the particle class. I hope this should help.
     
  3. So I already tried your second method which is how I knew it WAS null, however on my onEnable I am calling the init method which is adding the particles into their hashmaps. SSo they shouldnt be null. If that is what you were saying wass my problem... If not mind further explaining what you mean?
    And thankyou for your help :D
     
  4. In the init method of you refrence class you only add 2 particles, if you try to get a particle that isn't in the lists (so not of those 2), you get null. Try adding all the particles in the init method of the refrence class.
     
  5. That wouldnt be nesssisary seing as to how im only referring to one of the items?
     
  6. Try printing out iplayer.getIParticle().getParticle() in the console in the particleclass before you use it in the Refs.getParticle(). What does it output?
     
  7. I went again and just reimplemented the whole way I transferred the information and am no longer useing that method. Thanks for all the help though!
     
  8. Ok! Glad you fixed it