Added UserStatusChange - Event
This commit is contained in:
		
							
								
								
									
										54
									
								
								src/main/java/envoy/event/UserStatusChangeEvent.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/main/java/envoy/event/UserStatusChangeEvent.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
package envoy.event;
 | 
			
		||||
 | 
			
		||||
import envoy.data.User;
 | 
			
		||||
import envoy.data.User.UserStatus;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Project: <strong>envoy-common</strong><br>
 | 
			
		||||
 * File: <strong>UserStatusChangeEvent.java</strong><br>
 | 
			
		||||
 * Created: <strong>1 Feb 2020</strong><br>
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leon Hofmeister
 | 
			
		||||
 * @since Envoy Common v0.2-alpha
 | 
			
		||||
 */
 | 
			
		||||
public class UserStatusChangeEvent implements Event<UserStatus> {
 | 
			
		||||
 | 
			
		||||
	private final long				id;
 | 
			
		||||
	private final User.UserStatus	status;
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 4566145392192761313L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Initializes a {@link UserStatusChangeEvent}.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param id     the ID of the {@link User} this event is related to
 | 
			
		||||
	 * @param status the status of the {@link User} this event is related
 | 
			
		||||
	 *               to
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	public UserStatusChangeEvent(long id, User.UserStatus status) {
 | 
			
		||||
		this.id		= id;
 | 
			
		||||
		this.status	= status;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Initializes a {@link UserStatusChangeEvent} through a User.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param user the User from which to build the event
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	public UserStatusChangeEvent(User user) { this(user.getId(), user.getStatus()); }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the status of the {@link User} this event is related to
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	@Override
 | 
			
		||||
	public User.UserStatus get() { return status; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the ID of the {@link User} this event is related to
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	public long getId() { return id; }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user