Interface WorldGroupManager
@Contract
public sealed interface WorldGroupManager
Manager class for manipulating the groups of this plugin that are contained in the groups configuration.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkForConflicts
(org.mvplugins.multiverse.core.command.MVCommandIssuer issuer) Runs a check for conflicts between groups and displays them to issuer or console.Checks all the world groups to see if there are any potential issues.void
Creates a default world group including all of the loaded MV worlds sharing everything.Retrieves the world group associated with the given name.Returns a list of all the world groups defined in Multiverse-Inventories's groups configuration.getGroupsForWorld
(String worldName) Retrieves all of the world groups associated with the given world.boolean
hasConfiguredGroup
(String worldName) Check if the given world has any configured groups.org.mvplugins.multiverse.external.vavr.control.Try
<Void> load()
Loads the groups from storage.newEmptyGroup
(String name) Creates a new empty world group.void
Recalculates the applicable shares for all groups removing disabled optional shares.boolean
removeGroup
(WorldGroup worldGroup) Removes a world group from the collection in memory AND from the groups configuration.void
updateGroup
(WorldGroup worldGroup) Adds or updates a world group in Multiverse-Inventories.
-
Method Details
-
load
org.mvplugins.multiverse.external.vavr.control.Try<Void> load()Loads the groups from storage.
-
getGroup
Retrieves the world group associated with the given name.
These groups represent the groups that define a set of worlds and what they share.- Parameters:
groupName
- Name of world group to retrieve. Casing is ignored.- Returns:
- The world group by the name given or null if one doesn't exist by that name.
-
getGroups
List<WorldGroup> getGroups()Returns a list of all the world groups defined in Multiverse-Inventories's groups configuration.
This list is unmodifiable.- Returns:
- An unmodifiable list of all world groups.
-
getGroupsForWorld
Retrieves all of the world groups associated with the given world.- Parameters:
worldName
- Name of the world to get groups for.- Returns:
- List of World Groups associated with the world or null if none.
-
hasConfiguredGroup
Check if the given world has any configured groups.- Parameters:
worldName
- Name of the world to check.- Returns:
- true if this world has one or more groups.
-
updateGroup
Adds or updates a world group in Multiverse-Inventories.
This will update an existing group by persisting changes made to it in the groups configuration. This should be called when any of the facets of a group such as worlds or shares have been modified.
If the group does not exist it will be added to the groups configuration.
If worldGroup's name matches the name of a different WorldGroupProfileContainer object that is already known, the previous object will be overwritten with worldGroup parameter.- Parameters:
worldGroup
- the world group to add.
-
removeGroup
Removes a world group from the collection in memory AND from the groups configuration.- Parameters:
worldGroup
- the world group to remove.- Returns:
- true if group was removed.
-
newEmptyGroup
Creates a new empty world group.
Please note if you do not add worlds to this group it will not persist very well. This does not automatically persist the new group. It must bed added viaupdateGroup(WorldGroup)
.- Parameters:
name
- A name for the new group.- Returns:
- The newly created world group.
-
createDefaultGroup
void createDefaultGroup()Creates a default world group including all of the loaded MV worlds sharing everything. -
getDefaultGroup
WorldGroup getDefaultGroup()- Returns:
- The default world group which may be empty.
-
checkGroups
List<GroupingConflict> checkGroups()Checks all the world groups to see if there are any potential issues.- Returns:
- A list of all the potential conflicts.
-
checkForConflicts
void checkForConflicts(org.mvplugins.multiverse.core.command.MVCommandIssuer issuer) Runs a check for conflicts between groups and displays them to issuer or console.- Parameters:
issuer
- The issuer to relay information to. If null, info only displayed in console.
-