mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-23 16:41:22 +01:00
[#759] Fix No enum constant errors related to AAC
This fix prevents these errors in the future if the Enum changes again.
This commit is contained in:
parent
00e543021f
commit
7d1f70e5a1
Binary file not shown.
@ -56,7 +56,7 @@ class AdvancedAntiCheatData extends PluginData {
|
||||
|
||||
for (HackObject hackObject : hackObjects) {
|
||||
String date = timestampFormatter.apply(hackObject.getDate());
|
||||
String hack = new Format(hackObject.getHackType().getName()).capitalize().toString();
|
||||
String hack = new Format(hackObject.getHackType()).capitalize().toString();
|
||||
hackTable.addRow(date, hack, hackObject.getViolationLevel());
|
||||
}
|
||||
inspectContainer.addTable("hackTable", hackTable);
|
||||
|
@ -4,8 +4,6 @@
|
||||
*/
|
||||
package com.djrapitops.pluginbridge.plan.aac;
|
||||
|
||||
import me.konsolas.aac.api.HackType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -17,10 +15,10 @@ public class HackObject {
|
||||
|
||||
private final UUID uuid;
|
||||
private final long date;
|
||||
private final HackType hackType;
|
||||
private final String hackType;
|
||||
private final int violationLevel;
|
||||
|
||||
public HackObject(UUID uuid, long date, HackType hackType, int violationLevel) {
|
||||
public HackObject(UUID uuid, long date, String hackType, int violationLevel) {
|
||||
this.uuid = uuid;
|
||||
this.date = date;
|
||||
this.hackType = hackType;
|
||||
@ -35,7 +33,7 @@ public class HackObject {
|
||||
return date;
|
||||
}
|
||||
|
||||
public HackType getHackType() {
|
||||
public String getHackType() {
|
||||
return hackType;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ import com.djrapitops.plan.system.database.databases.sql.processing.QueryAllStat
|
||||
import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement;
|
||||
import com.djrapitops.plan.system.database.databases.sql.statements.Select;
|
||||
import com.djrapitops.plan.system.database.databases.sql.tables.Table;
|
||||
import me.konsolas.aac.api.HackType;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -66,7 +65,7 @@ public class HackerTable extends Table {
|
||||
while (set.next()) {
|
||||
UUID uuid = UUID.fromString(set.getString(columnUUID));
|
||||
long date = set.getLong(columnDate);
|
||||
HackType hackType = HackType.valueOf(set.getString(columnHackType));
|
||||
String hackType = set.getString(columnHackType);
|
||||
int violationLevel = set.getInt(columnViolations);
|
||||
hackObjects.add(new HackObject(uuid, date, hackType, violationLevel));
|
||||
}
|
||||
@ -83,7 +82,7 @@ public class HackerTable extends Table {
|
||||
while (set.next()) {
|
||||
UUID uuid = UUID.fromString(set.getString(columnUUID));
|
||||
long date = set.getLong(columnDate);
|
||||
HackType hackType = HackType.valueOf(set.getString(columnHackType));
|
||||
String hackType = set.getString(columnHackType);
|
||||
int violationLevel = set.getInt(columnViolations);
|
||||
List<HackObject> list = hackObjects.getOrDefault(uuid, new ArrayList<>());
|
||||
list.add(new HackObject(uuid, date, hackType, violationLevel));
|
||||
@ -107,7 +106,7 @@ public class HackerTable extends Table {
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setString(1, hackObject.getUuid().toString());
|
||||
statement.setLong(2, hackObject.getDate());
|
||||
statement.setString(3, hackObject.getHackType().name());
|
||||
statement.setString(3, hackObject.getHackType());
|
||||
statement.setInt(4, hackObject.getViolationLevel());
|
||||
}
|
||||
});
|
||||
|
@ -41,10 +41,11 @@ class PlayerHackKickListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
HackType hackType = event.getHackType();
|
||||
String hackTypeName = hackType.getName();
|
||||
long time = System.currentTimeMillis();
|
||||
int violations = AACAPIProvider.getAPI().getViolationLevel(player, hackType);
|
||||
|
||||
HackObject hackObject = new HackObject(uuid, time, hackType, violations);
|
||||
HackObject hackObject = new HackObject(uuid, time, hackTypeName, violations);
|
||||
|
||||
processing.submitNonCritical(() -> hackerTable.insertHackRow(hackObject));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user