Solved Transfer of variables between classes

Discussion in 'Plugin Development' started by Clybzotik, Feb 16, 2019.

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

    Clybzotik

    Hi, how I can get a HashMap from main class to another class(Listener)
    I use this constructor:
    Code:
    private KitPVP plugin;
        public Handler(KitPVP plugin) {
            this.plugin = plugin;
        }
    
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Clybzotik Add a getter for the map.
    Then you can de plugin.getSomeMapName()
     
  3. Offline

    Clybzotik

    @timtower
    I have a HashMap Kills(HashMap<String, Integer> Kills = new HashMap<String, Integer>();)
    I try to create this getter:
    Code:
      public getKills() {
            return this.Kills;
         }
    
    But i get this error: Kills cannot be resolved or is not a field
     
  4. Offline

    timtower Administrator Administrator Moderator

    @Clybzotik Getter is missing a return type.
    Declaration might be good, can you out that in a code block as well?
     
  5. Offline

    Clybzotik

    It works, thanks.
    Solved.
     
    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page