[trunk] New base class for User for storing all data.

More data for future use.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1143 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-04-07 02:59:56 +00:00
parent 46e6276c63
commit 3908443717

View File

@ -42,8 +42,11 @@ public abstract class UserData extends PlayerExtension implements IConf {
ignoredPlayers = getIgnoredPlayers();
godmode = getGodModeEnabled();
muted = getMuted();
muteTimeout = _getMuteTimeout();
jailed = getJailed();
jailTimeout = _getJailTimeout();
lastLogin = _getLastLogin();
lastLogout = _getLastLogout();
}
public double getMoney() {
@ -239,6 +242,10 @@ public abstract class UserData extends PlayerExtension implements IConf {
return config.getStringList("mail", new ArrayList<String>());
}
public List<String> getMails() {
return mails;
}
public void setMails(List<String> mails) {
if (mails == null) {
config.removeProperty("mail");
@ -384,6 +391,22 @@ public abstract class UserData extends PlayerExtension implements IConf {
return ret;
}
private long muteTimeout;
private long _getMuteTimeout() {
return config.getLong("timestamps.mute", 0);
}
public long getMuteTimeout() {
return muteTimeout;
}
public void setMuteTimeout(long time) {
muteTimeout = time;
config.setProperty("timestamps.mute", time);
config.save();
}
private boolean jailed;
private boolean getJailed() {
@ -406,6 +429,73 @@ public abstract class UserData extends PlayerExtension implements IConf {
return ret;
}
private long jailTimeout;
private long _getJailTimeout() {
return config.getLong("timestamps.jail", 0);
}
public long getJailTimeout() {
return jailTimeout;
}
public void setJailTimeout(long time) {
jailTimeout = time;
config.setProperty("timestamps.jail", time);
config.save();
}
public String getBanReason() {
return config.getString("ban.reason");
}
public void setBanReason(String reason) {
config.setProperty("ban.reason", reason);
config.save();
}
public long getBanTimeout() {
return config.getLong("ban.timeout", 0);
}
public void setBanTimeout(long time) {
config.setProperty("ban.timeout", time);
config.save();
}
private long lastLogin;
private long _getLastLogin() {
return config.getLong("timestamps.login", 0);
}
public long getLastLogin() {
return lastLogin;
}
public void setLastLogin(long time) {
lastLogin = time;
config.setProperty("timestamps.login", time);
config.save();
}
private long lastLogout;
private long _getLastLogout() {
return config.getLong("timestamps.logout", 0);
}
public long getLastLogout() {
return lastLogout;
}
public void setLastLogout(long time) {
lastLogout = time;
config.setProperty("timestamps.logout", time);
config.save();
}
private void updateConfig() {
if (config.hasProperty("home") && !config.hasProperty("home.default")) {
@SuppressWarnings("unchecked")