Package com.jackdaw.chatwithnpc.group
Class GroupManager
java.lang.Object
com.jackdaw.chatwithnpc.group.GroupManager
This class is used to manage the groups of the game.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddGroupMember(String groupName, String member) Add a member to the group, and all the parent groups.static voiddiscardGroup(String name) Discard a group from the group map.static voidDiscard all the groups.static voidDiscard the groups that have not been load for a long time.static @Nullable GroupGet the group by the name.Get the list of the groups from the files.static @NotNull StringgetGroupsPrompt(String group) Get the prompt of the group and all the parent groups.static @NotNull StringgetGroupTree(String root) Get the group tree.getParentGroups(@NotNull String currentGroup) Get all the parent groups of the group.static booleanstatic voidInitialize a group if the group is not loaded.static voidremoveGroupMember(String groupName, String member) Remove a member from the group, and all the parent groups.static voidsetGroupParent(String groupName, String newParentName) Set the parent group of the group.
-
Field Details
-
GroupMap
-
-
Constructor Details
-
GroupManager
public GroupManager()
-
-
Method Details
-
isLoaded
-
loadGroup
Initialize a group if the group is not loaded.- Parameters:
name- The name of the group
-
discardGroup
Discard a group from the group map.- Parameters:
name- The name of the group
-
getGroup
Get the group by the name.- Parameters:
name- The name of the group- Returns:
- The group
-
endOutOfTimeGroup
public static void endOutOfTimeGroup()Discard the groups that have not been load for a long time. -
endAllGroup
public static void endAllGroup()Discard all the groups. -
getParentGroups
@NotNull public static @NotNull ArrayList<Group> getParentGroups(@NotNull @NotNull String currentGroup) Get all the parent groups of the group. Include the group itself.- Parameters:
currentGroup- the parent group of the group.- Returns:
- parentGroups the parent groups of the group.
-
getGroupList
Get the list of the groups from the files.- Returns:
- The list of the groups.
-
addGroupMember
Add a member to the group, and all the parent groups.- Parameters:
groupName- The name of the groupmember- The name of the member
-
removeGroupMember
Remove a member from the group, and all the parent groups.- Parameters:
groupName- The name of the groupmember- The name of the member
-
setGroupParent
Set the parent group of the group. And move all the members to the new parent group.- Parameters:
groupName- The name of the groupnewParentName- The name of the new parent group
-
getGroupsPrompt
Get the prompt of the group and all the parent groups.- Parameters:
group- the group name- Returns:
- the prompt of the group
-
getGroupTree
Get the group tree.- Parameters:
root- The root of the tree- Returns:
- The group tree
-