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

      @Deprecated 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

      @Deprecated 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

      @Deprecated public String getPack()
      Deprecated.
      Get the name of the main pack of this assignment
      Returns:
      The (lowercase) name of the pack
    • getPacks

      public LinkedHashSet<String> getPacks()
      Get the list of packs
      Returns:
      The (lowercase) names of main packs
    • isPack

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

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

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

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

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

      public boolean removePack(String pack)
      Remove a pack
      Parameters:
      pack - The name of the pack to remove
      Returns:
      true if that pack was a main pack, false if not
    • getOptionalPacks

      public LinkedHashSet<String> getOptionalPacks()
      Get a list of optional packs
      Returns:
      The (lowercase) names of optional packs
    • isOptionalPack

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

      public boolean isOptionalPack(ResourcePack pack)
      Check whether certain pack is an optional pack in this assignment
      Parameters:
      pack - The pack
      Returns:
      true if this optional pack list contains this pack; false if not (or pack is null)
    • addOptionalPack

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

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

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

      public boolean removeOptionalPack(String pack)
      Remove an optional pack
      Parameters:
      pack - The name of the pack to remove
      Returns:
      true if that pack was a optional one, false if not
    • getSecondaries

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

      @Deprecated public boolean isSecondary(String pack)
      Deprecated.
      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

      @Deprecated 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

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

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

      @Deprecated 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

      @Deprecated 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