Class Sharables
java.lang.Object
org.mvplugins.multiverse.inventories.share.Sharables
- All Implemented Interfaces:
Cloneable,Iterable<Sharable>,Collection<Sharable>,Set<Sharable>,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 Summary
FieldsModifier and TypeFieldDescriptionSharing Advancements.static final SharesGrouping for air/breath related sharables.static final org.mvplugins.multiverse.inventories.share.SharableGroupGrouping for ALL default sharables.static final SharesGrouping for experience sharables.static final org.mvplugins.multiverse.inventories.share.SharableGroupGrouping for player health related sharables.static final SharesGrouping for inventory sharables.static final Sharable<org.bukkit.inventory.ItemStack[]> Sharing Armor.static final Sharable<org.bukkit.Location> Sharing Bed Spawn.Sharing Economy.static final Sharable<org.bukkit.inventory.ItemStack[]> Sharing Enderchest Inventory.Sharing Exhaustion.Sharing Experience.Sharing Fall Distance.Sharing Fire Ticks.Sharing Hunger.Sharing Statistics.Sharing Health.static final org.mvplugins.multiverse.inventories.share.SharableGroupGrouping for hunger related sharables.static final Sharable<org.bukkit.inventory.ItemStack[]> Sharing Inventory.static final Sharable<org.bukkit.Location> Sharing Last Location.Sharing Level.Sharing Max Health.Sharing Maximum Air.static final Sharable<org.bukkit.inventory.ItemStack> Sharing Offhand.static final Sharable<org.bukkit.potion.PotionEffect[]> Sharing Potions.Sharing Recipes.Sharing Remaining Air.Sharing Saturation.static final org.mvplugins.multiverse.inventories.share.SharableGroupGrouping for player stat related sharables not including inventory.Sharing Total Experience. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends Sharable> c) static Sharesall()static SharesallOf()voidclear()Checks to see if any of the sharables passed in are shared by this Shares.static SharescomplimentOf(Shares shares) booleanbooleancontainsAll(Collection<?> c) static Sharesenabled()static Sharesbooleanstatic SharesfromCollection(Collection<Sharable> sharesCollection) Creates a new instance ofSharescontaining all Sharables contained in sharesCollection.static SharesCreates a new instance ofSharescontaining all shares not negated in the given list.static SharesfromSharables(Sharable... sharables) static SharesfromShares(Shares shares) Creates a new instance ofSharescontaining all Sharables contained in shares.static Collection<String> inthashCode()static voidinit(MultiverseInventories inventories) Initialize this class with the instance of Inventories.booleanisEmpty()static booleanisIgnoringSpawnListener(org.bukkit.entity.Player player) booleanbooleaniterator()static SharesLooks up a sharable by one of the acceptable names.voidmergeShares(Shares newShares) Merges what is shared with another share.static SharesnegativeFromList(List sharesList) Creates a new instance ofSharescontaining all shares negated in the given list.static SharesnoneOf()static Sharesoptional()static Sharesstatic voidbooleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) setSharing(Sharable sharable, boolean sharing) setSharing(Shares sharables, boolean sharing) intsize()static Sharesstandard()static SharesObject[]toArray()<T> T[]toArray(T[] a) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Field Details
-
ENDER_CHEST
Sharing Enderchest Inventory. -
INVENTORY
Sharing Inventory. -
ARMOR
Sharing Armor. -
OFF_HAND
Sharing Offhand. -
MAX_HEALTH
Sharing Max Health. -
HEALTH
Sharing Health. -
REMAINING_AIR
Sharing Remaining Air. -
MAXIMUM_AIR
Sharing Maximum Air. -
FALL_DISTANCE
Sharing Fall Distance. -
FIRE_TICKS
Sharing Fire Ticks. -
EXPERIENCE
Sharing Experience. -
LEVEL
Sharing Level. -
TOTAL_EXPERIENCE
Sharing Total Experience. -
FOOD_LEVEL
Sharing Hunger. -
EXHAUSTION
Sharing Exhaustion. -
SATURATION
Sharing Saturation. -
BED_SPAWN
Sharing Bed Spawn. -
LAST_LOCATION
Sharing Last Location. -
ECONOMY
Sharing Economy. -
POTIONS
Sharing Potions. -
ADVANCEMENTS
Sharing Advancements. -
GAME_STATISTICS
Sharing Statistics. -
RECIPES
Sharing Recipes. -
ALL_INVENTORY
Grouping for inventory sharables. -
ALL_EXPERIENCE
Grouping for experience sharables. -
AIR
Grouping for air/breath related sharables. -
HUNGER
public static final org.mvplugins.multiverse.inventories.share.SharableGroup HUNGERGrouping for hunger related sharables. -
ALL_HEALTH
public static final org.mvplugins.multiverse.inventories.share.SharableGroup ALL_HEALTHGrouping for player health related sharables. -
STATS
public static final org.mvplugins.multiverse.inventories.share.SharableGroup STATSGrouping for player stat related sharables not including inventory. -
ALL_DEFAULT
public static final org.mvplugins.multiverse.inventories.share.SharableGroup ALL_DEFAULTGrouping for ALL default sharables. TODO: make this really mean all, including 3rd party.
-
-
Method Details
-
init
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
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.
-
all
-
standard
-
enabled
-
optional
- Returns:
- A
Sharescollection containing ALL registered optionalSharables. This is NOT to be modified and serves only as a reference. For a version you can do what you want with, seeoptionalOf().
-
allOf
-
enabledOf
-
standardOf
-
optionalOf
-
noneOf
- Returns:
- A new empty
Sharesinstance for your own devices.
-
fromCollection
Creates a new instance ofSharescontaining all Sharables contained in sharesCollection.- Parameters:
sharesCollection- A collection of Sharables to effectively copy.- Returns:
- A new Shares instance containing all Sharables in sharesCollection.
-
negativeFromList
Creates a new instance ofSharescontaining all shares negated in the given list.- Parameters:
sharesList- A list whose elements are to be strings which will be parsed withlookup(String)if they start with "-" indicating they are "negated" shares.- Returns:
- A new instance of
Sharescontaining all shares negated in the given list.
-
fromList
Creates a new instance ofSharescontaining all shares not negated in the given list.- Parameters:
sharesList- A list whose elements are to be strings which will be parsed withlookup(String)if they do not start with "-" indicating they are normal shares.- Returns:
- A new instance of
Sharescontaining all shares non-negated in the given list.
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<Sharable>- Specified by:
containsAllin interfaceSet<Sharable>
-
addAll
-
retainAll
-
removeAll
-
clear
public void clear() -
equals
-
hashCode
public int hashCode() -
toStringList
- Specified by:
toStringListin interfaceShares- Returns:
- These shares as a string list.
-
toString
-