mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-01 01:19:57 +02:00
Added "Given" row to Server page litebans table #643
This commit is contained in:
parent
03268b464b
commit
8867189b65
|
@ -13,13 +13,15 @@ public class LiteBansDBObj {
|
||||||
private final String bannedBy;
|
private final String bannedBy;
|
||||||
private final long expiry;
|
private final long expiry;
|
||||||
private final boolean active;
|
private final boolean active;
|
||||||
|
private final long time;
|
||||||
|
|
||||||
public LiteBansDBObj(UUID uuid, String reason, String bannedBy, long expiry, boolean active) {
|
public LiteBansDBObj(UUID uuid, String reason, String bannedBy, long expiry, boolean active, long time) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
this.bannedBy = bannedBy;
|
this.bannedBy = bannedBy;
|
||||||
this.expiry = expiry;
|
this.expiry = expiry;
|
||||||
this.active = active;
|
this.active = active;
|
||||||
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getUuid() {
|
public UUID getUuid() {
|
||||||
|
@ -41,4 +43,8 @@ public class LiteBansDBObj {
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,11 +133,7 @@ public class LiteBansData extends PluginData implements BanData {
|
||||||
private TableContainer getBanTable() {
|
private TableContainer getBanTable() {
|
||||||
String banned = getWithIcon("Banned", Icon.called("ban"));
|
String banned = getWithIcon("Banned", Icon.called("ban"));
|
||||||
String by = getWithIcon("Banned By", Icon.called("gavel"));
|
String by = getWithIcon("Banned By", Icon.called("gavel"));
|
||||||
String reason = getWithIcon("Reason", Icon.called("balance-scale"));
|
TableContainer banTable = createTableContainer(banned, by);
|
||||||
String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR));
|
|
||||||
String active = getWithIcon("Active", Icon.called("hourglass"));
|
|
||||||
|
|
||||||
TableContainer banTable = new TableContainer(banned, by, reason, date, active);
|
|
||||||
banTable.useJqueryDataTables();
|
banTable.useJqueryDataTables();
|
||||||
addRows(banTable, db.getBans());
|
addRows(banTable, db.getBans());
|
||||||
return banTable;
|
return banTable;
|
||||||
|
@ -146,11 +142,7 @@ public class LiteBansData extends PluginData implements BanData {
|
||||||
private TableContainer getMuteTable() {
|
private TableContainer getMuteTable() {
|
||||||
String muted = getWithIcon("Muted", Icon.called("bell-slash").of(Family.REGULAR));
|
String muted = getWithIcon("Muted", Icon.called("bell-slash").of(Family.REGULAR));
|
||||||
String by = getWithIcon("Muted By", Icon.called("gavel"));
|
String by = getWithIcon("Muted By", Icon.called("gavel"));
|
||||||
String reason = getWithIcon("Reason", Icon.called("balance-scale"));
|
TableContainer muteTable = createTableContainer(muted, by);
|
||||||
String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR));
|
|
||||||
String active = getWithIcon("Active", Icon.called("hourglass"));
|
|
||||||
|
|
||||||
TableContainer muteTable = new TableContainer(muted, by, reason, date, active);
|
|
||||||
muteTable.useJqueryDataTables();
|
muteTable.useJqueryDataTables();
|
||||||
addRows(muteTable, db.getMutes());
|
addRows(muteTable, db.getMutes());
|
||||||
return muteTable;
|
return muteTable;
|
||||||
|
@ -159,11 +151,7 @@ public class LiteBansData extends PluginData implements BanData {
|
||||||
private TableContainer getWarningTable() {
|
private TableContainer getWarningTable() {
|
||||||
String warned = getWithIcon("Warned", Icon.called("exclamation-triangle"));
|
String warned = getWithIcon("Warned", Icon.called("exclamation-triangle"));
|
||||||
String by = getWithIcon("Warned By", Icon.called("gavel"));
|
String by = getWithIcon("Warned By", Icon.called("gavel"));
|
||||||
String reason = getWithIcon("Reason", Icon.called("balance-scale"));
|
TableContainer warnTable = createTableContainer(warned, by);
|
||||||
String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR));
|
|
||||||
String active = getWithIcon("Active", Icon.called("hourglass"));
|
|
||||||
|
|
||||||
TableContainer warnTable = new TableContainer(warned, by, reason, date, active);
|
|
||||||
warnTable.useJqueryDataTables();
|
warnTable.useJqueryDataTables();
|
||||||
addRows(warnTable, db.getWarnings());
|
addRows(warnTable, db.getWarnings());
|
||||||
return warnTable;
|
return warnTable;
|
||||||
|
@ -172,16 +160,21 @@ public class LiteBansData extends PluginData implements BanData {
|
||||||
private TableContainer getKickTable() {
|
private TableContainer getKickTable() {
|
||||||
String kicked = getWithIcon("Kicked", Icon.called("user-times"));
|
String kicked = getWithIcon("Kicked", Icon.called("user-times"));
|
||||||
String by = getWithIcon("Kicked By", Icon.called("gavel"));
|
String by = getWithIcon("Kicked By", Icon.called("gavel"));
|
||||||
String reason = getWithIcon("Reason", Icon.called("balance-scale"));
|
TableContainer kickTable = createTableContainer(kicked, by);
|
||||||
String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR));
|
|
||||||
String active = getWithIcon("Active", Icon.called("hourglass"));
|
|
||||||
|
|
||||||
TableContainer kickTable = new TableContainer(kicked, by, reason, date, active);
|
|
||||||
kickTable.useJqueryDataTables();
|
kickTable.useJqueryDataTables();
|
||||||
addRows(kickTable, db.getKicks());
|
addRows(kickTable, db.getKicks());
|
||||||
return kickTable;
|
return kickTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TableContainer createTableContainer(String who, String by) {
|
||||||
|
String reason = getWithIcon("Reason", Icon.called("balance-scale"));
|
||||||
|
String given = getWithIcon("Given", Icon.called("clock").of(Family.REGULAR));
|
||||||
|
String expiry = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR));
|
||||||
|
String active = getWithIcon("Active", Icon.called("hourglass"));
|
||||||
|
|
||||||
|
return new TableContainer(who, by, reason, given, expiry, active);
|
||||||
|
}
|
||||||
|
|
||||||
private void addRows(TableContainer table, List<LiteBansDBObj> objects) {
|
private void addRows(TableContainer table, List<LiteBansDBObj> objects) {
|
||||||
if (objects.isEmpty()) {
|
if (objects.isEmpty()) {
|
||||||
table.addRow("No Data");
|
table.addRow("No Data");
|
||||||
|
@ -192,11 +185,14 @@ public class LiteBansData extends PluginData implements BanData {
|
||||||
String name = playerNames.getOrDefault(uuid, uuid.toString());
|
String name = playerNames.getOrDefault(uuid, uuid.toString());
|
||||||
long expiry = object.getExpiry();
|
long expiry = object.getExpiry();
|
||||||
String expires = expiry <= 0 ? "Never" : FormatUtils.formatTimeStampSecond(expiry);
|
String expires = expiry <= 0 ? "Never" : FormatUtils.formatTimeStampSecond(expiry);
|
||||||
|
long time = object.getTime();
|
||||||
|
String given = time <= 0 ? "Unknown" : FormatUtils.formatTimeStampSecond(time);
|
||||||
|
|
||||||
table.addRow(
|
table.addRow(
|
||||||
Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name),
|
Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name),
|
||||||
Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(object.getBannedBy()), object.getBannedBy()),
|
Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(object.getBannedBy()), object.getBannedBy()),
|
||||||
object.getReason(),
|
object.getReason(),
|
||||||
|
given,
|
||||||
expires,
|
expires,
|
||||||
object.isActive() ? "Yes" : "No"
|
object.isActive() ? "Yes" : "No"
|
||||||
);
|
);
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class LiteBansDatabaseQueries extends Table {
|
||||||
mutesTable = tablePrefix + "mutes";
|
mutesTable = tablePrefix + "mutes";
|
||||||
warningsTable = tablePrefix + "warnings";
|
warningsTable = tablePrefix + "warnings";
|
||||||
kicksTable = tablePrefix + "kicks";
|
kicksTable = tablePrefix + "kicks";
|
||||||
selectSQL = "SELECT uuid, reason, banned_by_name, until, active FROM ";
|
selectSQL = "SELECT uuid, reason, banned_by_name, until, active, time FROM ";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,9 +92,10 @@ public class LiteBansDatabaseQueries extends Table {
|
||||||
}
|
}
|
||||||
String reason = set.getString("reason");
|
String reason = set.getString("reason");
|
||||||
String bannedBy = set.getString("banned_by_name");
|
String bannedBy = set.getString("banned_by_name");
|
||||||
long time = set.getLong("until");
|
long until = set.getLong("until");
|
||||||
|
long time = set.getLong("time");
|
||||||
boolean active = set.getBoolean("active");
|
boolean active = set.getBoolean("active");
|
||||||
objs.add(new LiteBansDBObj(uuid, reason, bannedBy, time, active));
|
objs.add(new LiteBansDBObj(uuid, reason, bannedBy, until, active, time));
|
||||||
}
|
}
|
||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user