-
Notifications
You must be signed in to change notification settings - Fork 9
SettingUpdateEvent
David Rodriguez edited this page Mar 13, 2024
·
2 revisions
The SettingUpdateEvent is a custom event provided by the plugin called every time a setting changes for a player. The event defines methods to access the modified setting, its new value, its previous value, and the player to whom it belongs.
The following is an example of how to use the custom event to send players a message that shows the name of the setting modified and the new value it was assigned:
@EventHandler
public void onSettingUpdate(SettingUpdateEvent event) {
Player player = event.getPlayer();
Setting setting = event.getSetting();
int newValue = event.getNewValue();
int previousValue = event.getPreviousValue();
player.sendMessage("Setting " + setting.getName() + " changed from " + previousValue + " to " + newValue);
}Getting Started
Developers