Class WorldManager


  • public final class WorldManager
    extends java.lang.Object
    The class that manages the Arena.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBlock​(org.bukkit.block.Block block)
      Adds the Block and its data to the "To Be Restored Blocks" list.
      void addLever​(ExitLever lever)
      Adds an Exit Lever to the list of Exit Levers.
      void blockVault​(org.bukkit.block.Block block, int duration)
      Blocks the Vault for the specific duration.
      boolean canExitGatesGetPower()
      Checks if the Exit Gates can be powered.
      boolean canHatchOpen()
      Checks if the Hatch can open.
      boolean canHatchSpawn()
      Checks if the Hatch can spawn.
      void clearup()
      Called at the end of the Game.
      void closeHatch()
      Closes the Hatch if it is open.
      java.util.ArrayList<Totem> getActiveTotems()
      Returns a copy of the Totems which are not cleansed.
      java.util.ArrayList<Hook> getAvailableHooks​(org.bukkit.Location location)
      Gets a List of the Hooks that are not used at the moment and that are in a range of the specified Location.
      java.util.Optional<Chest> getChest​(org.bukkit.Location location)
      Gets the Chest in the specified Location.
      java.util.ArrayList<Totem> getDullTotems()
      Returns a copy of the Dull Totems.
      boolean getExitGatesPowered()
      Checks if the Exit Gates are powered.
      java.util.Optional<ExitLever> getExitLever​(org.bukkit.Location location)
      Gets the Exit Lever which is in the specified Location.
      java.util.ArrayList<ExitLever> getExitLevers()
      Gets a copy of the list of Exit Levers.
      java.util.Optional<Generator> getGenerator​(org.bukkit.Location location)
      Gets the Generator in the specified location.
      java.util.ArrayList<Generator> getGenerators()
      Gets a copy of the list of Generators.
      int getGensToDo()
      Gets the number of Generators the Survivors need to repair before the Exit Gates get powered.
      java.util.Optional<Hatch> getHatch()
      Gets the Hatch.
      java.util.ArrayList<Hook> getHooks()
      Gets a copy of the list of Hooks.
      java.util.Optional<Totem> getTotem​(org.bukkit.Location location)  
      java.util.ArrayList<Totem> getTotems()
      Returns a copy of the Totems.
      World getWorld()
      Gets Dead by Moonlight's World.
      boolean isEndGame()
      Checks if End Game Collapse is running.
      boolean isVaultBlocked​(org.bukkit.block.Block block)
      Checks if the Vault is blocked.
      void openHatch()
      Opens the Hatch if it closed.
      void powerExitGates()
      Powers the Exit Gates if they are not powered already.
      void spawnHatch()
      Spawns the Hatch if it hasn't spawned yet.
      void startEGC()
      Starts the End Game Collapse.
      void unblockVault​(org.bukkit.block.Block block)
      Unblocks the Vault.
      • Methods inherited from class java.lang.Object

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

      • getWorld

        public World getWorld()
        Gets Dead by Moonlight's World.
        Returns:
        The World.
      • getHatch

        public java.util.Optional<Hatch> getHatch()
        Gets the Hatch.
        Returns:
        The Hatch if it spawned, otherwise null.
      • getChest

        public java.util.Optional<Chest> getChest​(org.bukkit.Location location)
        Gets the Chest in the specified Location.
        Parameters:
        location - The supposed location of the Chest.
        Returns:
        The Chest, or null if the Location is wrong.
      • getGenerator

        public java.util.Optional<Generator> getGenerator​(org.bukkit.Location location)
        Gets the Generator in the specified location.
        Parameters:
        location - The supposed Location of the Ender Chest.
        Returns:
        The Generator if the location is right, or null if it is wrong.
      • getAvailableHooks

        public java.util.ArrayList<Hook> getAvailableHooks​(org.bukkit.Location location)
        Gets a List of the Hooks that are not used at the moment and that are in a range of the specified Location. Used for determining whether the Killer can hang the Survivor they are carrying.
        Parameters:
        location - The radius' centre.
        Returns:
        The List of the Hooks.
      • addLever

        public void addLever​(ExitLever lever)
        Adds an Exit Lever to the list of Exit Levers.
        Parameters:
        lever - The lever which will be added to the List.
      • getExitLever

        public java.util.Optional<ExitLever> getExitLever​(org.bukkit.Location location)
        Gets the Exit Lever which is in the specified Location.
        Parameters:
        location - The Location of the Exit Lever.
        Returns:
        The Exit Lever.
      • addBlock

        public void addBlock​(org.bukkit.block.Block block)
        Adds the Block and its data to the "To Be Restored Blocks" list. The elements of this List will be placed at the end of the Game. (for example: the Pallets)
        Parameters:
        block - The Block which will be restored at the end of the Game.
      • clearup

        public void clearup()
        Called at the end of the Game. Clears the Arena, and makes it ready for the next round.
      • canHatchSpawn

        public boolean canHatchSpawn()
        Checks if the Hatch can spawn.
        Returns:
        True if the Hatch can spawn.
      • spawnHatch

        public void spawnHatch()
        Spawns the Hatch if it hasn't spawned yet.
      • canHatchOpen

        public boolean canHatchOpen()
        Checks if the Hatch can open.
        Returns:
        True if the Hatch can open.
      • openHatch

        public void openHatch()
        Opens the Hatch if it closed.
      • closeHatch

        public void closeHatch()
        Closes the Hatch if it is open. Also starts the End Game Collapse.
      • canExitGatesGetPower

        public boolean canExitGatesGetPower()
        Checks if the Exit Gates can be powered.
        Returns:
        True if the Exit Gates can be powered.
      • powerExitGates

        public void powerExitGates()
        Powers the Exit Gates if they are not powered already.
      • startEGC

        public void startEGC()
        Starts the End Game Collapse. Also powers the Exit Gates.
      • isEndGame

        public boolean isEndGame()
        Checks if End Game Collapse is running.
        Returns:
        True if End Game Collapse is on.
      • blockVault

        public void blockVault​(org.bukkit.block.Block block,
                               int duration)
        Blocks the Vault for the specific duration.
        Parameters:
        block - The bottom (or middle) block of the Vault.
        duration - The duration in Ticks. As the Barrier Particle's duration is hardcoded to be 4 seconds, if the duration is not divisible by 4, the visuals of the effect and the effect itself will not be synchronized, therefore confusing the players. Might use a different Particle due to this reason in later versions.
      • isVaultBlocked

        public boolean isVaultBlocked​(org.bukkit.block.Block block)
        Checks if the Vault is blocked.
        Parameters:
        block - The bottom (or middle) block of the Vault.
        Returns:
        True if it is blocked.
      • unblockVault

        public void unblockVault​(org.bukkit.block.Block block)
        Unblocks the Vault. Keep in mind that the duration of the Barrier Particle Effect is fixed, therefore the effect will remain until it is expired.
        Parameters:
        block - The Vault to unblock.
      • getGenerators

        public java.util.ArrayList<Generator> getGenerators()
        Gets a copy of the list of Generators.
        Returns:
        A copy of the list of Generators.
      • getHooks

        public java.util.ArrayList<Hook> getHooks()
        Gets a copy of the list of Hooks.
        Returns:
        A copy of the list of Hooks.
      • getExitLevers

        public java.util.ArrayList<ExitLever> getExitLevers()
        Gets a copy of the list of Exit Levers.
        Returns:
        A copy of the list of Exit Levers.
      • getGensToDo

        public int getGensToDo()
        Gets the number of Generators the Survivors need to repair before the Exit Gates get powered.
        Returns:
        The number of Generators need to be repaired.
      • getExitGatesPowered

        public boolean getExitGatesPowered()
        Checks if the Exit Gates are powered.
        Returns:
        True, if the Exit Gates are powered.
      • getTotems

        public java.util.ArrayList<Totem> getTotems()
        Returns a copy of the Totems.
        Returns:
        A copy of the list of the Totems.
      • getActiveTotems

        public java.util.ArrayList<Totem> getActiveTotems()
        Returns a copy of the Totems which are not cleansed.
        Returns:
        A copy of the list of the non-cleansed Totems.
      • getDullTotems

        public java.util.ArrayList<Totem> getDullTotems()
        Returns a copy of the Dull Totems.
        Returns:
        A copy of the list of the Dull Totems.
      • getTotem

        public java.util.Optional<Totem> getTotem​(org.bukkit.Location location)