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 Shares
Grouping for air/breath related sharables.static final org.mvplugins.multiverse.inventories.share.SharableGroup
Grouping for ALL default sharables.static final Shares
Grouping for experience sharables.static final org.mvplugins.multiverse.inventories.share.SharableGroup
Grouping for player health related sharables.static final Shares
Grouping 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.SharableGroup
Grouping 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.SharableGroup
Grouping for player stat related sharables not including inventory.Sharing Total Experience. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends Sharable> c) static Shares
all()
static Shares
allOf()
void
clear()
Checks to see if any of the sharables passed in are shared by this Shares.static Shares
complimentOf
(Shares shares) boolean
boolean
containsAll
(Collection<?> c) static Shares
enabled()
static Shares
boolean
static Shares
fromCollection
(Collection<Sharable> sharesCollection) Creates a new instance ofShares
containing all Sharables contained in sharesCollection.static Shares
Creates a new instance ofShares
containing all shares not negated in the given list.static Shares
fromSharables
(Sharable... sharables) static Shares
fromShares
(Shares shares) Creates a new instance ofShares
containing all Sharables contained in shares.static Collection
<String> int
hashCode()
static void
init
(MultiverseInventories inventories) Initialize this class with the instance of Inventories.boolean
isEmpty()
static boolean
isIgnoringSpawnListener
(org.bukkit.entity.Player player) boolean
boolean
iterator()
static Shares
Looks up a sharable by one of the acceptable names.void
mergeShares
(Shares newShares) Merges what is shared with another share.static Shares
negativeFromList
(List sharesList) Creates a new instance ofShares
containing all shares negated in the given list.static Shares
noneOf()
static Shares
optional()
static Shares
static void
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) setSharing
(Sharable sharable, boolean sharing) setSharing
(Shares sharables, boolean sharing) int
size()
static Shares
standard()
static Shares
Object[]
toArray()
<T> T[]
toArray
(T[] a) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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
Shares
collection containing ALL registered optionalSharable
s. 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
Shares
instance for your own devices.
-
fromCollection
Creates a new instance ofShares
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.
-
negativeFromList
Creates a new instance ofShares
containing 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
Shares
containing all shares negated in the given list.
-
fromList
Creates a new instance ofShares
containing 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
Shares
containing 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:
containsAll
in interfaceCollection<Sharable>
- Specified by:
containsAll
in interfaceSet<Sharable>
-
addAll
-
retainAll
-
removeAll
-
clear
public void clear() -
equals
-
hashCode
public int hashCode() -
toStringList
- Specified by:
toStringList
in interfaceShares
- Returns:
- These shares as a string list.
-
toString
-