ChestShop-3/src/main/java/com/Acrobot/ChestShop/Database/Account.java
Phoenix616 0525c70452 Rewrite NameManager to support multiple short names per user
This should fix the issue where the player's short name on the shop sign does not reflect the actual player's name. This works by storing every uuid-username combination together with the associated short name and the last time the player logged in with that combination.
2017-07-01 17:14:41 +01:00

73 lines
1.6 KiB
Java

package com.Acrobot.ChestShop.Database;
import com.Acrobot.Breeze.Utils.NameUtil;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import java.util.Date;
import java.util.UUID;
/**
* A mapping for an account
* @author Andrzej Pomirski (Acrobot)
*/
@DatabaseTable(tableName = "accounts")
@DatabaseFileName("users.db")
public class Account {
@DatabaseField(index = true, canBeNull = false, uniqueCombo = true)
private String name;
@DatabaseField(id = true, index = true, canBeNull = false)
private String shortName;
@DatabaseField(index = true, canBeNull = false, uniqueCombo = true)
private UUID uuid;
@DatabaseField(canBeNull = false, dataType = DataType.DATE_LONG, defaultValue = "0")
private Date lastSeen;
public Account() {
//empty constructor, needed for ORMLite
}
public Account(String name, UUID uuid) {
this.name = name;
this.shortName = NameUtil.stripUsername(name);
this.uuid = uuid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public UUID getUuid() {
return uuid;
}
public void setUuid(UUID uuid) {
this.uuid = uuid;
}
public Date getLastSeen() {
return lastSeen;
}
public void setLastSeen(Date lastSeen) {
this.lastSeen = lastSeen;
}
}