onPlayerFlagSet

Event handler for PlayerFlagSetEvent occurrences during testing.

This method responds to PlayerFlagSetEvent instances specifically for diagnostic and testing purposes. It filters events to only process test-related flag changes, then provides comprehensive logging and feedback about the event details.

Event Filtering: Only processes events where the flag name equals "coreplugin_test_flag" to avoid interfering with normal gameplay events and to provide focused diagnostic output.

Information Captured:

  • Player UUID of the affected player

  • Flag name that was modified

  • Previous value (old value) before the change

  • New value after the change

  • Timestamp through automatic logging

Output Behavior:

  1. Console Logging: Writes detailed event information to the server console for administrators and developers to monitor

  2. Player Feedback: Sends formatted messages to online operators who triggered the test, providing immediate visual confirmation of event firing

Message Formatting: Uses Adventure API components for rich text formatting:

  • Gold color for the plugin identifier

  • Yellow color for player UUIDs

  • Default color for descriptive text and values

Operator Notification Logic: Only sends in-game messages to operators whose UUID matches the event's player UUID, ensuring that only the player who triggered the test receives the notification. This prevents spam to other online operators.

Usage Context: This handler is primarily invoked when:

  • /core testplugin command is executed

  • Manual flag setting operations are performed during development

  • Event system validation is being conducted

Thread Safety: This method is called on the main server thread by Bukkit's event system, ensuring thread safety for all Bukkit API interactions.

Parameters

event

The PlayerFlagSetEvent instance containing all event details

See also

Component
NamedTextColor