mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-13 02:18:34 +00:00
tttt
This commit is contained in:
61
src/main/java/dev/plex/banning/Ban.java
Normal file
61
src/main/java/dev/plex/banning/Ban.java
Normal file
@ -0,0 +1,61 @@
|
||||
package dev.plex.banning;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.IndexOptions;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity(value = "bans", useDiscriminator = false)
|
||||
public class Ban
|
||||
{
|
||||
public Ban()
|
||||
{
|
||||
}
|
||||
|
||||
@Setter(AccessLevel.NONE)
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
@Setter(AccessLevel.NONE)
|
||||
@Indexed(options = @IndexOptions(unique = true))
|
||||
private UUID uuid;
|
||||
|
||||
@Indexed // have the banner be indexed in the future to get bans issued by a person
|
||||
private UUID banner;
|
||||
|
||||
private String ip;
|
||||
private String reason;
|
||||
private Date endDate;
|
||||
private boolean active;
|
||||
|
||||
public Ban(UUID uuid, UUID banner, String ip, String reason, Date endDate)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
this.id = uuid.toString().substring(0, 8) + "-" + RandomStringUtils.randomAlphabetic(6);
|
||||
this.banner = banner;
|
||||
this.ip = ip;
|
||||
this.reason = reason;
|
||||
this.endDate = endDate;
|
||||
this.active = true;
|
||||
}
|
||||
|
||||
public Ban(String id, UUID uuid, UUID banner, String ip, String reason, Date endDate)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
this.id = id;
|
||||
this.banner = banner;
|
||||
this.ip = ip;
|
||||
this.reason = reason;
|
||||
this.endDate = endDate;
|
||||
this.active = true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user