#421 Clean up events javadoc and interface
- Add proper javadoc to all events - Use proper handling of the Eventlist in all events: each event has its own EventList and its static method, as specified by Bukkit's Event class - Add common supertype to all AuthMe events - Remove unused events - Remove unused methods (setters to fields that we ignore entirely)
This commit is contained in:
@@ -5,24 +5,33 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is called when we need to compare or hash password and allows
|
||||
* This event is called when we need to compare or hash a password for a player and allows
|
||||
* third-party listeners to change the encryption method. This is typically
|
||||
* done with the {@link fr.xephi.authme.security.HashAlgorithm#CUSTOM} setting.
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
public class PasswordEncryptionEvent extends Event {
|
||||
public class PasswordEncryptionEvent extends CustomEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private EncryptionMethod method;
|
||||
private String playerName;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param method The method used to encrypt the password
|
||||
* @param playerName The name of the player
|
||||
*/
|
||||
public PasswordEncryptionEvent(EncryptionMethod method, String playerName) {
|
||||
super(false);
|
||||
this.method = method;
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||
*
|
||||
* @return The list of handlers
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
@@ -32,14 +41,29 @@ public class PasswordEncryptionEvent extends Event {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the encryption method used to hash the password.
|
||||
*
|
||||
* @return The encryption method
|
||||
*/
|
||||
public EncryptionMethod getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the encryption method to hash the password with.
|
||||
*
|
||||
* @param method The encryption method to use
|
||||
*/
|
||||
public void setMethod(EncryptionMethod method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the player the event has been fired for.
|
||||
*
|
||||
* @return The player name
|
||||
*/
|
||||
public String getPlayerName() {
|
||||
return playerName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user