Class PackAssignment

java.lang.Object
de.themoep.resourcepacksplugin.core.PackAssignment

public class PackAssignment extends Object
Created by Phoenix616 on 06.03.2017.
  • Constructor Details

    • PackAssignment

      public PackAssignment(String name)
    • PackAssignment

      public PackAssignment(PackAssignment assignment)
  • Method Details

    • setPack

      public boolean setPack(ResourcePack pack)
      Set the main pack of this assignment
      Parameters:
      pack - The main pack
      Returns:
      Whether or not the value changed
    • setPack

      public boolean setPack(String pack)
      Set the main pack of this assignment
      Parameters:
      pack - The name of the main pack
      Returns:
      Whether or not the value changed
    • getPack

      public String getPack()
      Get the name of the main pack of this assignment
      Returns:
      The (lowercase) name of the apck
    • getSecondaries

      public LinkedHashSet<String> getSecondaries()
      Get a list of secondary packs
      Returns:
      The (lowercase) names of secondary packs
    • isSecondary

      public boolean isSecondary(String pack)
      Check whether or not a certain pack is a secondary in this assignment
      Parameters:
      pack - The name of the pack
      Returns:
      true if this secondary list contains this pack; false if not
    • isSecondary

      public boolean isSecondary(ResourcePack pack)
      Check whether or not a certain pack is a secondary in this assignment
      Parameters:
      pack - The the pack
      Returns:
      true if this secondary list contains this pack; false if not (or pack is null)
    • addSecondary

      public boolean addSecondary(ResourcePack pack)
      Add a new secondary pack
      Parameters:
      pack - The pack to add
      Returns:
      true as defined in Collections.add
    • addSecondary

      public boolean addSecondary(String pack)
      Add a new secondary pack
      Parameters:
      pack - The name of the pack to add
      Returns:
      true as defined in Collections.add
    • removeSecondary

      public boolean removeSecondary(ResourcePack pack)
      Remove a secondary pack
      Parameters:
      pack - The pack to remove
      Returns:
      true if that pack was a secondary one, false if not
    • removeSecondary

      public boolean removeSecondary(String pack)
      Remove a secondary pack
      Parameters:
      pack - The name of the pack to remove
      Returns:
      true if that pack was a secondary one, false if not
    • isEmpty

      public boolean isEmpty()
      Check whether or not this assignment contains any pack settings
      Returns:
      true if it has no packs or secondaries; false if it has some
    • setSendDelay

      public boolean setSendDelay(long sendDelay)
      Set the delay in ticks to wait before sending the packs from this assignment
      Parameters:
      sendDelay - The delay in ticks
      Returns:
      Whether or not the value changed
    • getSendDelay

      public long getSendDelay()
      Get the delay in ticks to wait before sending the packs from this assignment
      Returns:
      The delay in ticks; -1 if there was no special one configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setRegex

      public boolean setRegex(Pattern regex)
      Set the key name regex of this assignment
      Parameters:
      regex - The compiled Pattern of this regex
      Returns:
      Whether or not the value changed
    • getRegex

      public Pattern getRegex()
      Get the compiled Pattern of this assignment's key regex
      Returns:
      The compiled regex pattern or null if none is set and the key should be used literally
    • getName

      public String getName()
      Get the name of this assignment
      Returns:
      The name of this assignment
    • serialize

      public Map<String,​Object> serialize()
      Serialize this assignment to a map
      Returns:
      A map holding the data of this object
    • getReplacements

      public String[] getReplacements()
      Get replacements
      Returns:
      The placeholder replacements of this pack as an array. Index n is the placeholder, n+1 the value.
    • getUpdateActions

      protected String[] getUpdateActions()
      Get all possible update actions
      Returns:
      The possible update actions
    • update

      public boolean update(PluginCommandExecutor command, ResourcepacksPlayer sender, String[] args)
      Update this assignment
      Parameters:
      command - The command triggering the update
      sender - The sender updating it
      args - The arguments for updating the assignment
      Returns:
      Whether or not the update completed properly