io.github.alshain01.flags.api
Class Registrar

java.lang.Object
  extended by io.github.alshain01.flags.api.Registrar

public final class Registrar
extends java.lang.Object

Class for handling the registration of new flags


Method Summary
 java.util.Collection<Flag> getBypassedFlags(org.bukkit.permissions.Permissible permissible)
          Gets a set of flags for the provided permissible
 Flag getFlag(java.lang.String flag)
          Gets a flag based on it's case sensitive name.
 java.util.Collection<java.lang.String> getFlagGroups()
          Gets a set of all registered flag group names.
 Flag getFlagIgnoreCase(java.lang.String flag)
          Gets a flag, ignoring the case.
 java.util.Collection<java.lang.String> getFlagNames()
          Gets a set of all registered flag names.
 java.util.Collection<Flag> getFlags()
          Gets a collection of all registered flags.
 java.util.Map<java.lang.String,java.util.Collection<Flag>> getFlagsByGroup()
          Gets a map of flag sets ordered by group
 java.util.Collection<Flag> getGroup(java.lang.String group)
          Gets a set of flags for the provided group
 java.util.Collection<Flag> getPermittedFlagGroup(org.bukkit.permissions.Permissible permissible, java.lang.String group)
          Gets a set of flags for the provided group that the permissible has permission to use.
 java.util.Collection<java.lang.String> getPermittedFlagGroups(org.bukkit.permissions.Permissible permissible)
          Gets a set of all registered flag group names that contain flags the permissible is allowed to use.
 java.util.Collection<Flag> getPermittedFlags(org.bukkit.permissions.Permissible permissible)
          Gets a set of flags for the provided permissible
 java.util.Map<java.lang.String,java.util.Collection<Flag>> getPermittedFlagsByGroup(org.bukkit.permissions.Permissible permissible)
          Gets a map of flag sets ordered by group that are permitted for use
 java.util.Collection<Flag> getPlayerFlags()
          Gets a set of flags defined as player flags
 java.util.Collection<Flag> getStandardFlags()
          Gets a set of flags not defined as player flags
 boolean isFlag(java.lang.String flag)
          Checks if a flag name has been registered.
 java.util.Collection<Flag> registerFlag(org.bukkit.configuration.ConfigurationSection data, java.lang.String group)
          Registers a set of flags from a formatted ConfigurationSection
 Flag registerFlag(java.lang.String name, java.lang.String description, boolean def, java.lang.String group)
          Registers a non-player flag
 Flag registerFlag(java.lang.String name, java.lang.String description, boolean def, java.lang.String group, java.lang.String areaMessage, java.lang.String wildernessMessage)
          Registers a player flag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFlag

public Flag getFlag(@Nonnull
                    java.lang.String flag)
Gets a flag based on it's case sensitive name.

Parameters:
flag - The flag to retrieve.
Returns:
The flag requested or null if it does not exist.

getFlagGroups

public java.util.Collection<java.lang.String> getFlagGroups()
Gets a set of all registered flag group names.

Returns:
A list of names of all the flags registered.

getPermittedFlagGroups

public java.util.Collection<java.lang.String> getPermittedFlagGroups(@Nonnull
                                                                     org.bukkit.permissions.Permissible permissible)
Gets a set of all registered flag group names that contain flags the permissible is allowed to use.

Returns:
A list of names of all the flags registered.

getFlagIgnoreCase

public Flag getFlagIgnoreCase(@Nonnull
                              java.lang.String flag)
Gets a flag, ignoring the case. This is an less efficient method, use it only when absolutely necessary.

Parameters:
flag - The flag to retrieve.
Returns:
The flag requested or null if it does not exist.

getFlagNames

public java.util.Collection<java.lang.String> getFlagNames()
Gets a set of all registered flag names.

Returns:
A list of names of all the flags registered.

getFlags

public java.util.Collection<Flag> getFlags()
Gets a collection of all registered flags.

Returns:
A collection of all the flags registered.

getGroup

public java.util.Collection<Flag> getGroup(@Nonnull
                                           java.lang.String group)
Gets a set of flags for the provided group

Returns:
A set of all the flags in the group.

getPermittedFlagGroup

public java.util.Collection<Flag> getPermittedFlagGroup(@Nonnull
                                                        org.bukkit.permissions.Permissible permissible,
                                                        @Nonnull
                                                        java.lang.String group)
Gets a set of flags for the provided group that the permissible has permission to use.

Returns:
A set of all the flags in the group.

getFlagsByGroup

public java.util.Map<java.lang.String,java.util.Collection<Flag>> getFlagsByGroup()
Gets a map of flag sets ordered by group

Returns:
A map of all the flags for all groups.

getPermittedFlagsByGroup

public java.util.Map<java.lang.String,java.util.Collection<Flag>> getPermittedFlagsByGroup(@Nonnull
                                                                                           org.bukkit.permissions.Permissible permissible)
Gets a map of flag sets ordered by group that are permitted for use

Parameters:
permissible - The permissibile to check
Returns:
A map of all the flags for all groups.

getStandardFlags

public java.util.Collection<Flag> getStandardFlags()
Gets a set of flags not defined as player flags

Returns:
A set of flags that are not player flags

getPlayerFlags

public java.util.Collection<Flag> getPlayerFlags()
Gets a set of flags defined as player flags

Returns:
A set of flags that are player flags

getPermittedFlags

public java.util.Collection<Flag> getPermittedFlags(@Nonnull
                                                    org.bukkit.permissions.Permissible permissible)
Gets a set of flags for the provided permissible

Returns:
A set of all the flags the permissible may change

getBypassedFlags

public java.util.Collection<Flag> getBypassedFlags(@Nonnull
                                                   org.bukkit.permissions.Permissible permissible)
Gets a set of flags for the provided permissible

Returns:
A set of all the flags the permissible may bypass

isFlag

public boolean isFlag(@Nonnull
                      java.lang.String flag)
Checks if a flag name has been registered.

Parameters:
flag - The flag name
Returns:
True if the flag name has been registered

registerFlag

public Flag registerFlag(@Nonnull
                         java.lang.String name,
                         @Nonnull
                         java.lang.String description,
                         boolean def,
                         @Nonnull
                         java.lang.String group)
Registers a non-player flag

Parameters:
name - The name of the flag
description - A brief description of the flag
def - The flag's default state
group - The group the flag belongs in.
Returns:
The flag if the flag was successfully registered. Null otherwise.

registerFlag

public Flag registerFlag(@Nonnull
                         java.lang.String name,
                         @Nonnull
                         java.lang.String description,
                         boolean def,
                         @Nonnull
                         java.lang.String group,
                         @Nonnull
                         java.lang.String areaMessage,
                         @Nonnull
                         java.lang.String wildernessMessage)
Registers a player flag

Parameters:
name - The name of the flag
description - A brief description of the flag
def - The flag's default state
group - The group the flag belongs in.
areaMessage - The default message for areas.
wildernessMessage - The default message for wilderness areas.
Returns:
The flag if the flag was successfully registered. Null otherwise.

registerFlag

public java.util.Collection<Flag> registerFlag(@Nonnull
                                               org.bukkit.configuration.ConfigurationSection data,
                                               @Nonnull
                                               java.lang.String group)
Registers a set of flags from a formatted ConfigurationSection

Parameters:
data - The configuration section file containing the flag keys
group - The group the flags belong in.
Returns:
The set of flags if the flags were successfully registered. May be null or empty.