Package valorless.rarespawns.databases
Class PlayerOptOut
java.lang.Object
valorless.rarespawns.databases.PlayerOptOut
In-memory cache and persistence helper for RareSpawns opt-out players.
Persists a list of player UUIDs under optout.yml (key: "optedout") and
maintains a runtime list of currently opted-out online players. Call
init() during plugin enable to load existing data and
shutdown() during disable to save.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static valorless.valorlessutils.config.ConfigBacking configuration file (optout.yml). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()Initializes the storage and loads the opt-out list from optout.yml.static booleanisOptedOut(org.bukkit.entity.Player player) Checks whether the given player is currently opted out.static voidshutdown()Persists opt-out data to disk.static voidtoggleOptOut(org.bukkit.entity.Player player) Toggles the player's opt-out status in the in-memory list.
-
Field Details
-
config
protected static valorless.valorlessutils.config.Config configBacking configuration file (optout.yml).
-
-
Constructor Details
-
PlayerOptOut
public PlayerOptOut()
-
-
Method Details
-
init
public static void init()Initializes the storage and loads the opt-out list from optout.yml.Behavior:
- Creates optout.yml if missing and ensures the "optedout" key exists.
- Clears any in-memory state.
- Reads UUID strings from "optedout" and adds those players that are currently online.
-
isOptedOut
public static boolean isOptedOut(org.bukkit.entity.Player player) Checks whether the given player is currently opted out.- Parameters:
player- the player to check- Returns:
- true if the player is in the in-memory opt-out list; false otherwise
-
toggleOptOut
public static void toggleOptOut(org.bukkit.entity.Player player) Toggles the player's opt-out status in the in-memory list.Note: Persistence occurs during
shutdown().- Parameters:
player- the player to toggle
-
shutdown
public static void shutdown()Persists opt-out data to disk. Call on plugin disable.
-