Finalisation de la commande /modo
This commit is contained in:
@@ -6,26 +6,26 @@ public class ModoHistoryElement extends SQLElement {
|
||||
private ActionType actionType;
|
||||
private long time;
|
||||
private String playerName;
|
||||
private Long duration = null;
|
||||
private Long value = null;
|
||||
private String message;
|
||||
|
||||
|
||||
public ModoHistoryElement(String modo, ActionType type, long time, String player, String message) {
|
||||
public ModoHistoryElement(String modo, ActionType type, String player, String message) {
|
||||
super("pandacraft_modo_history");
|
||||
setModoName(modo);
|
||||
setActionType(type);
|
||||
setTime(time);
|
||||
setPlayerName(player);
|
||||
setMessage(message);
|
||||
time = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
ModoHistoryElement(int id, String modo, ActionType type, long time, String player, String message) {
|
||||
ModoHistoryElement(int id, String modo, ActionType type, String player, String message) {
|
||||
super("pandacraft_modo_history", id);
|
||||
setModoName(modo);
|
||||
setActionType(type);
|
||||
setTime(time);
|
||||
setPlayerName(player);
|
||||
setMessage(message);
|
||||
time = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,7 +35,7 @@ public class ModoHistoryElement extends SQLElement {
|
||||
actionType.name(),
|
||||
String.valueOf(time),
|
||||
playerName,
|
||||
(duration == null)?null:duration.toString(),
|
||||
(value == null)?null:value.toString(),
|
||||
message
|
||||
};
|
||||
}
|
||||
@@ -75,14 +75,21 @@ public class ModoHistoryElement extends SQLElement {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
/**
|
||||
* Retourne la durée de la sanction appliquée (en secondes), ou la somme d'argent retirée du compte
|
||||
* @return
|
||||
*/
|
||||
public long getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setDuration(Long duration) {
|
||||
if (duration != null && duration.longValue() < 0) duration = null;
|
||||
this.duration = duration;
|
||||
/**
|
||||
* Value correspond soit à la durée de la sanction appliquée (en secondes), soit à la valeur de l'amende appliquée
|
||||
* @param value
|
||||
*/
|
||||
public void setValue(Long value) {
|
||||
if (value != null && value.longValue() < 0) value = null;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +134,7 @@ public class ModoHistoryElement extends SQLElement {
|
||||
|
||||
|
||||
public enum ActionType{
|
||||
TEMPBAN, MUTE, JAIL, REPORT, KICK, MONEY
|
||||
BAN, UNBAN, MUTE, UNMUTE, JAIL, UNJAIL, REPORT, KICK, MONEY
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,10 +17,10 @@ public class ModoHistoryTable extends SQLTable<ModoHistoryElement> {
|
||||
protected String createTableParameters() {
|
||||
return "id INT AUTO_INCREMENT PRIMARY KEY,"
|
||||
+ "modoName VARCHAR(16) NOT NULL,"
|
||||
+ "actionType ENUM('TEMPBAN', 'MUTE', 'JAIL', 'REPORT', 'KICK', 'MONEY') NOT NULL,"
|
||||
+ "actionType ENUM('BAN', 'UNBAN', 'MUTE', 'UNMUTE', 'JAIL', 'UNJAIL', 'REPORT', 'KICK', 'MONEY') NOT NULL,"
|
||||
+ "time BIGINT NOT NULL,"
|
||||
+ "playerName VARCHAR(16) NOT NULL,"
|
||||
+ "duration BIGINT NULL,"
|
||||
+ "value BIGINT NULL,"
|
||||
+ "message VARCHAR(512) NOT NULL";
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ public class ModoHistoryTable extends SQLTable<ModoHistoryElement> {
|
||||
sqlResult.getInt("id"),
|
||||
sqlResult.getString("modoName"),
|
||||
ActionType.valueOf(sqlResult.getString("actionType")),
|
||||
sqlResult.getLong("time"),
|
||||
sqlResult.getString("playerName"),
|
||||
sqlResult.getString("message"));
|
||||
el.setDuration(sqlResult.getLong("duration"));
|
||||
el.setValue(sqlResult.getLong("value"));
|
||||
el.setTime(sqlResult.getLong("time"));
|
||||
return el;
|
||||
}
|
||||
|
||||
|
@@ -64,6 +64,7 @@ public abstract class SQLElement {
|
||||
}
|
||||
|
||||
st.executeUpdate();
|
||||
st.close();
|
||||
}
|
||||
else
|
||||
{ // ajouter dans la base
|
||||
@@ -84,6 +85,7 @@ public abstract class SQLElement {
|
||||
}
|
||||
|
||||
id = st.executeUpdate();
|
||||
st.close();
|
||||
saved = true;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
Reference in New Issue
Block a user