Class ResidentModeHandler
java.lang.Object
com.palmergames.bukkit.towny.object.resident.mode.ResidentModeHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddMode(Resident resident, AbstractResidentMode mode) static voidapplyDefaultModes(Resident resident, boolean notify) static voidclearModes(Resident resident, boolean notify) Removes all modes from a Resident.static voidclearModes(org.bukkit.entity.Player player) Removes all modes from a Player.static @Nullable AbstractResidentModestatic Set<AbstractResidentMode> static Set<AbstractResidentMode> getModes(org.bukkit.entity.Player player) protected static Set<AbstractResidentMode> getResidentModes(Resident resident) getResidentModesNames(Resident resident) static booleanhasMode(Resident resident, AbstractResidentMode mode) static booleanstatic voidstatic booleanstatic booleanisValidMode(String name) static voidregisterMode(@NotNull AbstractResidentMode mode) Registers a new ResidentMode.protected static voidremoveMode(Resident resident, AbstractResidentMode mode) static voidresetModes(Resident resident, boolean notify) Removes all modes from a Resident and then resets their modes to the Default Modes according to their permissions.static voidtoggleMode(Resident resident, AbstractResidentMode mode, boolean notify) Will attempt to toggle on or off, a AbstractResidentMode on a Resident.static voidtoggleMode(Resident resident, String name, boolean notify) Will attempt to toggle on or off, a named mode on a Resident.static voidtoggleMode(org.bukkit.entity.Player player, String name, boolean notify) Will attempt to toggle on or off, a named mode on a Player.static voidtoggleModes(Resident resident, String[] names, boolean notify, boolean clearModes) Will clear a Resident's modes and then apply all of the given named Modes.static voidtoggleModes(org.bukkit.entity.Player player, String[] names, boolean notify) Will clear a Player's modes and then apply all of the given named Modes.
-
Constructor Details
-
ResidentModeHandler
public ResidentModeHandler()
-
-
Method Details
-
initialize
public static void initialize() -
registerMode
Registers a new ResidentMode. Should not be used at all outside of the ResidentModesInitializeEvent.- Parameters:
mode- The ResidentMode to add.- Throws:
TownyException- if a mode with this name is already registered.
-
isValidMode
-
isValidMode
-
getValidModeNames
-
getMode
-
getModes
-
getModes
-
hasMode
-
hasMode
-
toggleModes
public static void toggleModes(org.bukkit.entity.Player player, String[] names, boolean notify) throws TownyException Will clear a Player's modes and then apply all of the given named Modes.- Parameters:
player- Player to toggle modes on.names- String[] of all modes to add to the Player.notify- whether to notify the Player of their new modes.- Throws:
TownyException
-
toggleModes
public static void toggleModes(Resident resident, String[] names, boolean notify, boolean clearModes) Will clear a Resident's modes and then apply all of the given named Modes.- Parameters:
resident- Resident to toggle modes on.names- String[] of all modes to add to the Resident.notify- whether to notify the Resident of their new modes.clearModes- whether a resident's nodes are cleared before toggling happens.
-
toggleMode
public static void toggleMode(org.bukkit.entity.Player player, String name, boolean notify) throws TownyException Will attempt to toggle on or off, a named mode on a Player.- Parameters:
player- Player to toggle a mode on.name- the String name of theAbstractResidentModeto toggle.notify- whether to notify the Player of their mode changing.- Throws:
TownyException- thrown when a mode doesn't exist, the Player does not have permisson, or when the ResidentToggleModeEvent is cancelled, or the Player isn't a registered Resident.
-
toggleMode
Will attempt to toggle on or off, a named mode on a Resident.- Parameters:
resident- Resident to toggle a mode on.name- the String name of theAbstractResidentModeto toggle.notify- whether to notify the Resident of their mode changing.- Throws:
TownyException- thrown when a mode doesn't exist, the resident does not have permisson, or when the ResidentToggleModeEvent is cancelled.
-
toggleMode
public static void toggleMode(Resident resident, AbstractResidentMode mode, boolean notify) throws TownyException Will attempt to toggle on or off, a AbstractResidentMode on a Resident.- Parameters:
resident- Resident to toggle a mode on.mode-AbstractResidentModeto toggle on or off.notify- whether to notify the Resident of their mode changing.- Throws:
TownyException- thrown when a mode doesn't exist, the resident does not have permisson, or when the ResidentToggleModeEvent is cancelled.
-
clearModes
public static void clearModes(org.bukkit.entity.Player player) Removes all modes from a Player.- Parameters:
player- Player to remove the modes from.
-
clearModes
Removes all modes from a Resident.- Parameters:
resident- Resident to remove the modes from.notify- whether to notify the Resident of their modes being cleared.
-
resetModes
Removes all modes from a Resident and then resets their modes to the Default Modes according to their permissions.- Parameters:
resident- Resident to reset.notify- whether to notify the Resident of their modes after.
-
applyDefaultModes
-
addMode
-
removeMode
-
getResidentModesNames
-
getResidentModes
-