Class DragonTemplate

java.lang.Object
wtf.choco.dragoneggdrop.dragon.DragonTemplate
All Implemented Interfaces:
Registerable

public class DragonTemplate
extends Object
implements Registerable
Represents an immutable template for a custom dragon to be spawned containing information about its name, the style of its boss bar, as well as the loot table used to generate its loot after it has been killed.
Author:
Parker Hawke - Choco
  • Method Details

    • getId

      public String getId()
      Description copied from interface: Registerable
      Get the unique id for this registerable object.
      Specified by:
      getId in interface Registerable
      Returns:
      the unique id
    • getName

      public String getName()
      Get the name of the dragon.
      Returns:
      the dragon's name. null if none
    • getBarStyle

      public org.bukkit.boss.BarStyle getBarStyle()
      Get the style of the boss bar.
      Returns:
      the boss bar style
    • getBarColor

      public org.bukkit.boss.BarColor getBarColor()
      Get the colour of the boss bar.
      Returns:
      the boss bar colour
    • getParticleShapeDefinition

      public ParticleShapeDefinition getParticleShapeDefinition()
      Get the particle shape definition to use when this dragon is killed.
      Returns:
      the shape definition
    • getLootTable

      public DragonLootTable getLootTable()
      Get the loot table used to generate the loot for this dragon once killed.
      Returns:
      the dragon loot table
    • getSpawnWeight

      public double getSpawnWeight()
      Get the weight of this dragon's spawn percentage.
      Returns:
      the spawn weight
    • getSpawnAnnouncement

      public List<String> getSpawnAnnouncement()
      Get the messages to be announced to all players when this template spawns.
      Returns:
      the spawn announcement
    • shouldAnnounceSpawn

      public boolean shouldAnnounceSpawn()
      Check whether this dragon's name should be announced as it spawns.
      Returns:
      true if it should be announced, false otherwise
    • getAttributes

      public Map<org.bukkit.attribute.Attribute,​Double> getAttributes()
      Get an immutable Map of all attributes and their values according to this template.
      Returns:
      the mapped attributes and values
    • getAttribute

      public double getAttribute​(org.bukkit.attribute.Attribute attribute)
      Get the value to be applied for a specific attribute. If the provided attribute value is not specified, -1 will be returned.
      Parameters:
      attribute - the attribute to check
      Returns:
      the value of the attribute, or -1 if non existent
    • hasAttribute

      public boolean hasAttribute​(org.bukkit.attribute.Attribute attribute)
      Check whether this template has specified an attribute's value.
      Parameters:
      attribute - the attribute to check
      Returns:
      true if defined. false otherwise
    • applyToBattle

      public void applyToBattle​(org.bukkit.entity.EnderDragon dragon, org.bukkit.boss.DragonBattle battle)
      Apply this templates data to an EnderDragonBattle object.
      Parameters:
      dragon - the dragon to modify
      battle - the battle to modify
    • builder

      public static DragonTemplateBuilder builder​(String id)
      Get a new DragonTemplateBuilder to construct an instance of DragonTemplate.
      Parameters:
      id - the template's unique id
      Returns:
      the template builder
    • buildCopy

      public static DragonTemplateBuilder buildCopy​(String id, DragonTemplate template)
      Get a new DragonTemplateBuilder to construct an instance of DragonTemplate with values copied from an existing template.
      Parameters:
      id - the template's unique id
      template - the template from which to copy values
      Returns:
      the template builder
    • fromFile

      public static DragonTemplate fromFile​(File file)
      Load and create a DragonTemplate from a YAML File.
      Parameters:
      file - the file from which to parse a dragon template
      Returns:
      the dragon template