Overview
The Ember Client Server API uses Bukkit’s event-driven architecture to notify your plugin when important actions occur. All events are fired asynchronously when the server receives responses from Ember Client.Bukkit Event Architecture
The API leverages Bukkit’s standard event system, which means:- Events extend
PlayerEvent(they’re associated with a specific player) - You listen to events using
@EventHandlerannotations - Events are called through Bukkit’s
PluginManager - You can set event priorities and control cancellation (where applicable)
Listening to Events
To listen to Ember Client events, create a listener class and register it with Bukkit:Available Events
The Server API provides three events that correspond to different client interactions:EmberPlayerJoinEvent
Package:com.emberclient.serverapi.event.EmberPlayerJoinEvent
Fired when a player joins the server using Ember Client.
EmberPlayerJoinEvent.java
Available Methods
Returns the player who joined with Ember Client.
Example Usage
EmberAttestationRegisterEvent
Package:com.emberclient.serverapi.event.EmberAttestationRegisterEvent
Fired when a player completes (or fails) an attestation key registration request.
EmberAttestationRegisterEvent.java
Available Methods
Returns the player attempting to register an attestation key.
Returns the registration result status. Possible values:
SUCCESS- Key registered successfullySIGNING_NOT_ALLOWED- Device doesn’t support attestationUSER_CANCELLED- User cancelled the registrationUNKNOWN_ERROR- An unexpected error occurred
Returns the public key if registration was successful,
null otherwise. Store this key to verify future signatures.Example Usage
EmberAttestationSignEvent
Package:com.emberclient.serverapi.event.EmberAttestationSignEvent
Fired when a player completes (or fails) an attestation signing request.
EmberAttestationSignEvent.java
Available Methods
Returns the player attempting to sign data.
Returns the signing result status. Possible values:
SUCCESS- Data signed successfullySIGNING_NOT_ALLOWED- Device doesn’t support attestationSIGN_DATA_INVALID- The verification data was invalidUSER_CANCELLED- User cancelled the signingKEY_DOES_NOT_EXIST- No attestation key registeredUNKNOWN_ERROR- An unexpected error occurred
Returns the signed data if signing was successful,
null otherwise. Verify this signature against the stored public key.Example Usage
Event Data Summary
EmberPlayerJoinEvent
Data:
- Player
EmberAttestationRegisterEvent
Data:
- Player
- AttestationRegisterResult
- X509EncodedKeySpec (public key)
EmberAttestationSignEvent
Data:
- Player
- AttestationSignResult
- byte[] (signed data)
Best Practices
Always check event status before processing data
Always check event status before processing data
The
getStatus() method tells you whether the operation succeeded. Only access getPublicKey() or getSignedData() when status is SUCCESS:Handle all possible status values
Handle all possible status values
Don’t just check for
SUCCESS - handle failure cases to provide helpful feedback:Store public keys securely
Store public keys securely
Public keys should be stored in a secure database, associated with the player’s UUID. Use proper encryption for your database:
Clean up pending verifications
Clean up pending verifications
If you track pending sign requests, always clean them up after receiving the event:
Next Steps
Attestation Concept
Learn more about how attestation authentication works
Attestation Guide
Step-by-step guide to implementing attestation in your plugin