Need Help With Constructors and Global Variables

Discussion in 'Spigot Plugin Help' started by Pjpuffs, Mar 31, 2020.

  1. Today was actually my first day making spigot plugins (despite being somewhat familiar with Java), and so far I've made 4, all of which have turned out great. However, I'm having a ton of trouble with one of them. I'm trying to make a plugin that allows the user to choose a player head, place said player head, and do something when a regular player clicks on those heads. It's something very similar to the fairy soul system in Hypixel Skyblock, as a reference point.

    Main class: https://pastebin.com/GnyfbWRH
    Command class: https://pastebin.com/hLXp04hA
    Listener class: https://pastebin.com/MUyZDFMf

    As shown, my goal is to check whether the owner of the clicked head on the listener class is equal to the desired chosenBlock string on the command class, but I'm not sure how to cross check as they are in different classes. I've done some research and it seems constructors are the way to go but I'm not sure how to implement them in a situation like this.
     
  2. How would I save them in a way that’s accessible by other classes?
     
  3. You cannot check if the owner is equals to a block since the owner is a player entity. I don't get what you're trying to do.