java.lang.Object
org.mvplugins.multiverse.inventories.share.Sharables
All Implemented Interfaces:
Cloneable, Iterable<Sharable>, Collection<Sharable>, Set<Sharable>, Shares

public final class Sharables extends Object implements Shares
The Sharables class is where all the default Sharable instances are located as constants as well as a factory class for generating Shares.
  • Field Details

    • ENDER_CHEST

      public static final Sharable<org.bukkit.inventory.ItemStack[]> ENDER_CHEST
      Sharing Enderchest Inventory.
    • INVENTORY

      public static final Sharable<org.bukkit.inventory.ItemStack[]> INVENTORY
      Sharing Inventory.
    • ARMOR

      public static final Sharable<org.bukkit.inventory.ItemStack[]> ARMOR
      Sharing Armor.
    • OFF_HAND

      public static final Sharable<org.bukkit.inventory.ItemStack> OFF_HAND
      Sharing Offhand.
    • MAX_HEALTH

      public static final Sharable<Double> MAX_HEALTH
      Sharing Max Health.
    • HEALTH

      public static final Sharable<Double> HEALTH
      Sharing Health.
    • REMAINING_AIR

      public static final Sharable<Integer> REMAINING_AIR
      Sharing Remaining Air.
    • MAXIMUM_AIR

      public static final Sharable<Integer> MAXIMUM_AIR
      Sharing Maximum Air.
    • FALL_DISTANCE

      public static final Sharable<Float> FALL_DISTANCE
      Sharing Fall Distance.
    • FIRE_TICKS

      public static final Sharable<Integer> FIRE_TICKS
      Sharing Fire Ticks.
    • EXPERIENCE

      public static final Sharable<Float> EXPERIENCE
      Sharing Experience.
    • LEVEL

      public static final Sharable<Integer> LEVEL
      Sharing Level.
    • TOTAL_EXPERIENCE

      public static final Sharable<Integer> TOTAL_EXPERIENCE
      Sharing Total Experience.
    • FOOD_LEVEL

      public static final Sharable<Integer> FOOD_LEVEL
      Sharing Hunger.
    • EXHAUSTION

      public static final Sharable<Float> EXHAUSTION
      Sharing Exhaustion.
    • SATURATION

      public static final Sharable<Float> SATURATION
      Sharing Saturation.
    • BED_SPAWN

      public static final Sharable<org.bukkit.Location> BED_SPAWN
      Sharing Bed Spawn.
    • LAST_LOCATION

      public static final Sharable<org.bukkit.Location> LAST_LOCATION
      Sharing Last Location.
    • ECONOMY

      public static final Sharable<Double> ECONOMY
      Sharing Economy.
    • POTIONS

      public static final Sharable<org.bukkit.potion.PotionEffect[]> POTIONS
      Sharing Potions.
    • ADVANCEMENTS

      public static final Sharable<List> ADVANCEMENTS
      Sharing Advancements.
    • GAME_STATISTICS

      public static final Sharable<Map> GAME_STATISTICS
      Sharing Statistics.
    • RECIPES

      public static final Sharable<List> RECIPES
      Sharing Recipes.
    • ALL_INVENTORY

      public static final Shares ALL_INVENTORY
      Grouping for inventory sharables.
    • ALL_EXPERIENCE

      public static final Shares ALL_EXPERIENCE
      Grouping for experience sharables.
    • AIR

      public static final Shares AIR
      Grouping for air/breath related sharables.
    • HUNGER

      public static final org.mvplugins.multiverse.inventories.share.SharableGroup HUNGER
      Grouping for hunger related sharables.
    • ALL_HEALTH

      public static final org.mvplugins.multiverse.inventories.share.SharableGroup ALL_HEALTH
      Grouping for player health related sharables.
    • STATS

      public static final org.mvplugins.multiverse.inventories.share.SharableGroup STATS
      Grouping for player stat related sharables not including inventory.
    • ALL_DEFAULT

      public static final org.mvplugins.multiverse.inventories.share.SharableGroup ALL_DEFAULT
      Grouping for ALL default sharables. TODO: make this really mean all, including 3rd party.
  • Method Details

    • init

      public static void init(MultiverseInventories inventories)
      Initialize this class with the instance of Inventories.
      Parameters:
      inventories - the instance of Inventories.
    • isIgnoringSpawnListener

      @Internal public static boolean isIgnoringSpawnListener(org.bukkit.entity.Player player)
    • lookup

      public static Shares lookup(String name)
      Looks up a sharable by one of the acceptable names.
      Parameters:
      name - Name to look up by.
      Returns:
      Sharable by that name or null if none by that name.
    • getShareNames

      public static Collection<String> getShareNames()
      Returns:
      A collection of all registered Shares. This is NOT to be modified and serves only as a reference.
    • all

      public static Shares all()
      Returns:
      A Shares collection containing ALL registered Sharables. This is NOT to be modified and serves only as a reference. For a version you can do what you want with, see allOf().
    • standard

      public static Shares standard()
      Returns:
      A Shares collection containing ALL registered standard Sharables. This is NOT to be modified and serves only as a reference. For a version you can do what you want with, see allOf().
    • enabled

      public static Shares enabled()
      Returns:
      A Shares collection containing ALL registered enabled Sharables. This is NOT to be modified and serves only as a reference. For a version you can do what you want with, see allOf().
    • optional

      public static Shares optional()
      Returns:
      A Shares collection containing ALL registered optional Sharables. This is NOT to be modified and serves only as a reference. For a version you can do what you want with, see optionalOf().
    • allOf

      public static Shares allOf()
      Returns:
      A new Shares instance containing ALL registered Sharables for your own devices.
    • enabledOf

      public static Shares enabledOf()
      Returns:
      A new Shares instance containing ALL enabled optional Sharables for your own devices.
    • standardOf

      public static Shares standardOf()
    • optionalOf

      public static Shares optionalOf()
      Returns:
      A new Shares instance containing ALL registered optional Sharables for your own devices.
    • noneOf

      public static Shares noneOf()
      Returns:
      A new empty Shares instance for your own devices.
    • complimentOf

      public static Shares complimentOf(Shares shares)
      Parameters:
      shares - Shares to compare against.
      Returns:
      A new Shares instance containing all Sharables present in all() that are NOT contained in the shares argument.
    • fromShares

      public static Shares fromShares(Shares shares)
      Creates a new instance of Shares containing all Sharables contained in shares.
      Parameters:
      shares - Shares instance to effectively copy.
      Returns:
      A new Shares instance containing all Sharables in shares.
    • fromCollection

      public static Shares fromCollection(Collection<Sharable> sharesCollection)
      Creates a new instance of Shares containing all Sharables contained in sharesCollection.
      Parameters:
      sharesCollection - A collection of Sharables to effectively copy.
      Returns:
      A new Shares instance containing all Sharables in sharesCollection.
    • fromSharables

      public static Shares fromSharables(Sharable... sharables)
      Creates a new instance of Shares containing the listed Sharables.
      Parameters:
      sharables - Sharables to fill new Shares with.
      Returns:
      A new Shares instance containing all Sharables passed in.
    • negativeFromList

      public static Shares negativeFromList(List sharesList)
      Creates a new instance of Shares containing all shares negated in the given list.
      Parameters:
      sharesList - A list whose elements are to be strings which will be parsed with lookup(String) if they start with "-" indicating they are "negated" shares.
      Returns:
      A new instance of Shares containing all shares negated in the given list.
    • fromList

      public static Shares fromList(List sharesList)
      Creates a new instance of Shares containing all shares not negated in the given list.
      Parameters:
      sharesList - A list whose elements are to be strings which will be parsed with lookup(String) if they do not start with "-" indicating they are normal shares.
      Returns:
      A new instance of Shares containing all shares non-negated in the given list.
    • recalculateEnabledShares

      public static void recalculateEnabledShares()
    • size

      public int size()
      Specified by:
      size in interface Collection<Sharable>
      Specified by:
      size in interface Set<Sharable>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<Sharable>
      Specified by:
      isEmpty in interface Set<Sharable>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<Sharable>
      Specified by:
      contains in interface Set<Sharable>
    • iterator

      public Iterator<Sharable> iterator()
      Specified by:
      iterator in interface Collection<Sharable>
      Specified by:
      iterator in interface Iterable<Sharable>
      Specified by:
      iterator in interface Set<Sharable>
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection<Sharable>
      Specified by:
      toArray in interface Set<Sharable>
    • toArray

      public <T> T[] toArray(T[] a)
      Specified by:
      toArray in interface Collection<Sharable>
      Specified by:
      toArray in interface Set<Sharable>
    • add

      public boolean add(Sharable sharable)
      Specified by:
      add in interface Collection<Sharable>
      Specified by:
      add in interface Set<Sharable>
    • remove

      public boolean remove(Object o)
      Specified by:
      remove in interface Collection<Sharable>
      Specified by:
      remove in interface Set<Sharable>
    • containsAll

      public boolean containsAll(Collection<?> c)
      Specified by:
      containsAll in interface Collection<Sharable>
      Specified by:
      containsAll in interface Set<Sharable>
    • addAll

      public boolean addAll(Collection<? extends Sharable> c)
      Specified by:
      addAll in interface Collection<Sharable>
      Specified by:
      addAll in interface Set<Sharable>
    • retainAll

      public boolean retainAll(Collection<?> c)
      Specified by:
      retainAll in interface Collection<Sharable>
      Specified by:
      retainAll in interface Set<Sharable>
    • removeAll

      public boolean removeAll(Collection<?> c)
      Specified by:
      removeAll in interface Collection<Sharable>
      Specified by:
      removeAll in interface Set<Sharable>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<Sharable>
      Specified by:
      clear in interface Set<Sharable>
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Collection<Sharable>
      Specified by:
      equals in interface Set<Sharable>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<Sharable>
      Specified by:
      hashCode in interface Set<Sharable>
      Overrides:
      hashCode in class Object
    • mergeShares

      public void mergeShares(Shares newShares)
      Merges what is shared with another share. Only the false items should be merged.
      Specified by:
      mergeShares in interface Shares
      Parameters:
      newShares - The set of shares to merge into this set of shares.
    • setSharing

      public Shares setSharing(Sharable sharable, boolean sharing)
      Specified by:
      setSharing in interface Shares
      Parameters:
      sharable - The Sharable you wish to set sharing for.
      sharing - Whether to share or not.
    • setSharing

      public Shares setSharing(Shares sharables, boolean sharing)
      Specified by:
      setSharing in interface Shares
      Parameters:
      sharables - a Set of Sharables you wish to set sharing for.
      sharing - Whether to share or not.
    • compare

      public Shares compare(Shares shares)
      Description copied from interface: Shares
      Checks to see if any of the sharables passed in are shared by this Shares.
      Specified by:
      compare in interface Shares
      Parameters:
      shares - Shares to check for.
      Returns:
      A Set containing all of the Sharables both sets contain.
    • isSharing

      public boolean isSharing(Sharable sharable)
      Specified by:
      isSharing in interface Shares
      Parameters:
      sharable - The Sharable you want to check for.
      Returns:
      True if it is sharing the sharable.
    • isSharing

      public boolean isSharing(Shares shares)
      Specified by:
      isSharing in interface Shares
      Parameters:
      shares - Shares to compare with.
      Returns:
      True if it is sharing the same sharables.
    • toStringList

      public List<String> toStringList()
      Specified by:
      toStringList in interface Shares
      Returns:
      These shares as a string list.
    • toString

      public String toString()
      Overrides:
      toString in class Object