Class Research

    • Method Detail

      • isEnabled

        public boolean isEnabled​()
        This method returns whether this Research is enabled. false can mean that this particular Research was disabled or that researches alltogether have been disabled.
        Returns:
        Whether this Research is enabled or not
      • getID

        public int getID​()
        Gets the ID of this Research. This is the old way of identifying Researches, use a NamespacedKey in the future.
        Returns:
        The ID of this Research
      • getName

        public String getName​(Player p)
        This method gives you a localized name for this Research. The name is automatically taken from the currently selected Language of the specified Player.
        Parameters:
        p - The Player to translate this name for.
        Returns:
        The localized Name of this Research.
      • getCost

        public int getCost​()
        Gets the cost in XP levels to unlock this Research.
        Returns:
        The cost in XP levels for this Research
      • setCost

        public void setCost​(int cost)
        Sets the cost in XP levels to unlock this Research.
        Parameters:
        cost - The cost in XP levels
      • unlock

        public void unlock​(Player p,
                           boolean instant)
        Unlocks this Research for the specified Player.
        Parameters:
        p - The Player for which to unlock this Research
        instant - Whether to unlock the research instantly
      • register

        public void register​()
        Registers this Research.
      • getByID

        public static Research getByID​(int id)
        Attempts to get a Research with the given ID. We will use NamespacedKey for this in the future.
        Parameters:
        id - ID of the research to get
        Returns:
        Research if found, or null