2016-04-08 13:12:31 +02:00
|
|
|
package net.frozenorb.apiv3.models;
|
2016-03-21 23:28:17 +01:00
|
|
|
|
|
|
|
import lombok.Getter;
|
|
|
|
import net.frozenorb.apiv3.APIv3;
|
|
|
|
import org.mongodb.morphia.annotations.Entity;
|
|
|
|
import org.mongodb.morphia.annotations.Id;
|
|
|
|
|
|
|
|
@Entity(value = "ranks", noClassnameStored = true)
|
|
|
|
public final class Rank {
|
|
|
|
|
|
|
|
@Getter @Id private String id;
|
|
|
|
@Getter private int weight;
|
|
|
|
@Getter private String displayName;
|
|
|
|
@Getter private String gameColor;
|
|
|
|
@Getter private String websiteColor;
|
2016-04-08 13:12:31 +02:00
|
|
|
@Getter private boolean staffRank;
|
|
|
|
|
|
|
|
public static Rank byId(String id) {
|
|
|
|
return APIv3.getDatastore().createQuery(Rank.class).field("id").equal(id).get();
|
|
|
|
}
|
2016-03-21 23:28:17 +01:00
|
|
|
|
|
|
|
public Rank() {} // For Morphia
|
|
|
|
|
2016-04-08 13:12:31 +02:00
|
|
|
public Rank(String id, int weight, String displayName, String gameColor, String websiteColor, boolean staffRank) {
|
2016-03-21 23:28:17 +01:00
|
|
|
this.id = id;
|
|
|
|
this.weight = weight;
|
|
|
|
this.displayName = displayName;
|
|
|
|
this.gameColor = gameColor;
|
|
|
|
this.websiteColor = websiteColor;
|
2016-04-08 13:12:31 +02:00
|
|
|
this.staffRank = staffRank;
|
2016-03-21 23:28:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void delete() {
|
|
|
|
APIv3.getDatastore().delete(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|