Solved Use HashMap from another Class

Discussion in 'Plugin Development' started by idkG0D, Oct 4, 2019.

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


    Basically, i want to use a HashMap created in a Class, in another Class. Example:

    In the Class Spawn i have a HashMap:

    HashMap<UUID, Integer> cooldown = new HashMap<>();

    And in another Class named CancelSpawn, i want to use that HashMap. How can i do that without using public static in the HashMap?
  2. Offline

    timtower Moderator Moderator

    @idkG0D Put the map in the main class.
  3. Offline


    Create your HashMap as a variable and provide a method to access it in your class, like:
    CancelSpawn cancelSpawn = new CancelSpawn();
    idkG0D likes this.
Thread Status:
Not open for further replies.

Share This Page