This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/common/src/main/java/envoy/event/UserStatusChange.java

49 lines
1.1 KiB
Java
Raw Normal View History

2020-02-01 11:32:55 +01:00
package envoy.event;
import envoy.data.User;
import envoy.data.User.UserStatus;
/**
* @author Leon Hofmeister
* @since Envoy Common v0.2-alpha
*/
public final class UserStatusChange extends Event<UserStatus> {
2020-02-01 11:32:55 +01:00
private final long id;
2020-02-01 11:32:55 +01:00
private static final long serialVersionUID = 0L;
2020-02-01 11:32:55 +01:00
/**
2020-06-20 09:19:39 +02:00
* Initializes a {@link UserStatusChange}.
2020-02-01 11:32:55 +01:00
*
* @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
2020-02-01 11:32:55 +01:00
* @since Envoy Common v0.2-alpha
*/
2020-06-20 09:19:39 +02:00
public UserStatusChange(long id, User.UserStatus status) {
super(status);
this.id = id;
2020-02-01 11:32:55 +01:00
}
/**
2020-06-20 09:19:39 +02:00
* Initializes a {@link UserStatusChange} through a User.
2020-02-01 11:32:55 +01:00
*
* @param user the User from which to build the event
* @since Envoy Common v0.2-alpha
*/
public UserStatusChange(User user) {
this(user.getID(), user.getStatus());
}
2020-02-01 11:32:55 +01:00
/**
* @return the ID of the {@link User} this event is related to
* @since Envoy Common v0.2-alpha
*/
public long getID() { return id; }
@Override
public String toString() {
return String.format("UserStatusChange[id=%d,status=%s]", id, value);
}
2020-02-01 11:32:55 +01:00
}