Class SkillCheck


  • public class SkillCheck
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFail​(java.util.function.Consumer<Survivor> consumer)
      Adds another method to the Failed Skill Check list.
      void addGood​(java.util.function.Consumer<Survivor> consumer)
      Adds another method to the Good Skill Check list.
      void addGreat​(java.util.function.Consumer<Survivor> consumer)
      Adds another method to the Great Skill Check list.
      static SkillCheck createSkillCheck​(org.bukkit.plugin.java.JavaPlugin plugin, Survivor survivor, SkillCheckReason reason, java.util.function.Consumer<Survivor> great, java.util.function.Consumer<Survivor> good, java.util.function.Consumer<Survivor> fail)
      Creates a Skill Check using the specified parameters.
      long getDelay()
      Gets the speed of the Skill Check.
      int getGoodSize()
      Gets the size of the Good Skill Check.
      boolean hasStarted()
      Checks whether this Skill Check has started.
      boolean isFinished()
      Checks whether this Skill Check is over.
      boolean isShown()
      Checks whether this Skill Check was shown.
      void setDelay​(long delay)
      Sets the speed of the Skill Check. (1 = fast, 2 = default, bigger than 3 = slow)
      void setGoodSize​(int goodSize)
      Sets the length of the Good Skill Check.
      void show()
      Shows the Survivor the specified Skill Check.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createSkillCheck

        public static SkillCheck createSkillCheck​(org.bukkit.plugin.java.JavaPlugin plugin,
                                                  Survivor survivor,
                                                  SkillCheckReason reason,
                                                  java.util.function.Consumer<Survivor> great,
                                                  java.util.function.Consumer<Survivor> good,
                                                  java.util.function.Consumer<Survivor> fail)
        Creates a Skill Check using the specified parameters.
        Parameters:
        plugin - Your plugin's main class.
        survivor - The Survivor who you want to work with.
        reason - The reason why the Skill Check was created.
        great - A void method with a Survivor as its parameter. This method will run if the Survivor hits the Great Skill Check.
        good - A void method with a Survivor as its parameter. This method will run if the Survivor hits the Good Skill Check.
        fail - A void method with a Survivor as its parameter. This method will run if the Survivor fails the Skill Check.
        Returns:
        The Skill Check
      • setGoodSize

        public void setGoodSize​(int goodSize)
        Sets the length of the Good Skill Check.
        Parameters:
        goodSize - The length of the Good Skill Check. If it is a negative value, the actual length is going to be 0.
        Throws:
        java.lang.IllegalStateException - If the Skill Check was already shown.
      • getGoodSize

        public int getGoodSize()
        Gets the size of the Good Skill Check.
        Returns:
        The length of the Good Skill Check.
      • getDelay

        public long getDelay()
        Gets the speed of the Skill Check.
        Returns:
        The delay - in ticks - of the cursor of the Skill Check.
      • setDelay

        public void setDelay​(long delay)
        Sets the speed of the Skill Check. (1 = fast, 2 = default, bigger than 3 = slow)
        Parameters:
        delay - The delay of the cursor in ticks, so effectively the speed. Default value is 2.
        Throws:
        java.lang.IllegalArgumentException - If the specified number is a non-positive value.
      • addGreat

        public void addGreat​(java.util.function.Consumer<Survivor> consumer)
        Adds another method to the Great Skill Check list. This method will also run if the Survivor hits the Great Skill Check. The methods will be executed one after the other depending on the order they were added into the list.
        Parameters:
        consumer - The method to be run.
        Throws:
        java.lang.IllegalStateException - If the Skill Check is being/was shown to the Survivor.
      • addGood

        public void addGood​(java.util.function.Consumer<Survivor> consumer)
        Adds another method to the Good Skill Check list. This method will also run if the Survivor hits the Good Skill Check. The methods will be executed one after the other depending on the order they were added into the list.
        Parameters:
        consumer - The method to be run.
        Throws:
        java.lang.IllegalStateException - If the Skill Check is being/was shown to the Survivor.
      • addFail

        public void addFail​(java.util.function.Consumer<Survivor> consumer)
        Adds another method to the Failed Skill Check list. This method will also run if the Survivor fails the Skill Check. The methods will be executed one after the other depending on the order they were added into the list.
        Parameters:
        consumer - The method to be run.
        Throws:
        java.lang.IllegalStateException - If the Skill Check is being/was shown to the Survivor.
      • show

        public void show()
        Shows the Survivor the specified Skill Check. If the Survivor was already seeing a Skill Check, that will count as a failure for the previous Skill Check.
      • isFinished

        public boolean isFinished()
        Checks whether this Skill Check is over. This method is important, because if it returns true, you will get an IllegalStateException if you try to show it to a Survivor.
        Returns:
        True if the Skill Check is finished and no longer usable.
      • hasStarted

        public boolean hasStarted()
        Checks whether this Skill Check has started. The Skill Checks starts when the red wool with the surrounding square appears.
        Returns:
        True if the Skill Check has started.
      • isShown

        public boolean isShown()
        Checks whether this Skill Check was shown. The Skill Check was shown if the Survivor sees/saw its inventory.
        Returns:
        True if the Survivor sees/saw the gray wool.