diff --git a/docs/api/version/v13.md b/docs/api/version/v13.md index b1e093f34..94fba3837 100644 --- a/docs/api/version/v13.md +++ b/docs/api/version/v13.md @@ -174,6 +174,8 @@ LookupOptions options = LookupOptions.builder() | `excludeMaterials(List materials)` | Excludes matching logged block/item materials. | | `includeEntities(List entities)` | Includes any matching entity type in `entityLookup`. | | `excludeEntities(List entities)` | Excludes matching entity types in `entityLookup`. | +| `victims(List victims)` | Includes kills of any named player in `entityLookup`. Unknown names never match. | +| `excludeVictims(List victims)` | Excludes kills of named players in `entityLookup`, retaining other entity events. | | `blockActions(List actions)` | Selects block actions. | | `entityActions(List actions)` | Selects entity actions. | | `containerActions(List actions)` | Selects container transaction actions. | @@ -194,7 +196,7 @@ Results are returned in descending event order. Limits apply after filtering; om | Lookup | User/time/limit | Spatial filters | Material filters | Additional filters | | --- | --- | --- | --- | --- | | Block | Yes | Yes; supplied `Block` overrides options | Yes | `blockActions` | -| Entity | Yes | Yes | No | `entityActions`, `includeEntities`, `excludeEntities` | +| Entity | Yes | Yes | No | `entityActions`, `includeEntities`, `excludeEntities`, `victims`, `excludeVictims` | | Container | Yes | Yes | Yes | `containerActions` | | Item | Yes | Yes | Yes | `itemActions` | | Inventory | Yes | Yes | Yes | `inventoryActions` | @@ -323,6 +325,22 @@ Material filters compare the logged material, regardless of the block currently Returns entity spawns and kills. Use `entityActions` to select `SPAWN` or `KILL`, and `includeEntities` / `excludeEntities` to filter Bukkit `EntityType` values. Empty lists select both actions and all entity types. +`EntityResult.getPlayer()` identifies the actor. `getVictim()` identifies the killed player, or returns `null` for mob kills, spawns, and player kills whose victim ID cannot be resolved. The name is resolved from the existing user record, not a snapshot of the name at the time of death. This reads the victim ID already logged by CoreProtect; it does not enable logging or recover events that were not recorded. + +Use `victims` and `excludeVictims` to filter player-kill victims in SQL before pagination. These filters combine with the actor, time, location, action, and entity filters; other lookup methods ignore them. Names use CoreProtect's case-insensitive user lookup. Empty lists impose no restriction. Blank names and special users beginning with `#` are rejected. Unknown inclusions match no events; unknown exclusions have no effect. Exclusions take precedence and preserve mob kills, spawns, and kills with unresolved victims. + +```java +LookupOptions options = LookupOptions.builder() + .users(List.of("Killer")) + .victims(List.of("Victim")) + .time(3 * 24 * 60 * 60) + .limit(0, 100) + .build(); +List kills = api.entityLookup(options); +``` + +This returns a page of recorded kills of `Victim` by `Killer`, not a total count. Continue pagination if needed. The existing `EntityResult` constructor remains available and sets the victim to `null`. + For spawn events, location/radius filters match either the original spawn location or the persisted current/final location. Whole-world filters similarly match either world. Kill events match the location where the kill was logged. Results always expose the **original event coordinates and world**, even when a tracked position matched the filter. These synchronous lookups use persisted tracking data and do not wait for a live-entity scan. Material filters and other lookup-specific action filters do not affect entity lookups. @@ -441,6 +459,7 @@ Action strings are `break`, `place`, `click`, `kill`, or `spawn` as applicable. | Additional method | Return type | Meaning | | --- | --- | --- | | `getEntityType()` | `EntityType` | Logged entity type, including `PLAYER` for player-kill records. | +| `getVictim()` | `String` | Name resolved from the recorded victim ID for player kills; `null` for other events or unresolved victims. | | `isRolledBack()` | `boolean` | Whether the entity change is currently rolled back. | Actions are `KILL` (`3`, `kill`) and `SPAWN` (`13`, `spawn`). diff --git a/src/main/java/net/coreprotect/api/EntityAPI.java b/src/main/java/net/coreprotect/api/EntityAPI.java index 5a089e236..fddf33be6 100644 --- a/src/main/java/net/coreprotect/api/EntityAPI.java +++ b/src/main/java/net/coreprotect/api/EntityAPI.java @@ -3,6 +3,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -55,7 +56,7 @@ public static List performLookup(LookupOptions options) { boolean snapshot = filter.beginDuckDBSnapshot(connection); try { - StringBuilder query = new StringBuilder("SELECT entity_rows.time,entity_rows." + ConfigHandler.databaseType.getUserColumn() + ",entity_rows.wid,entity_rows.x,entity_rows.y,entity_rows.z,entity_rows.type,entity_rows.action,entity_rows.rolled_back FROM "); + StringBuilder query = new StringBuilder("SELECT entity_rows.time,entity_rows." + ConfigHandler.databaseType.getUserColumn() + ",entity_rows.wid,entity_rows.x,entity_rows.y,entity_rows.z,entity_rows.type,entity_rows.data,entity_rows.action,entity_rows.rolled_back FROM "); query.append(filter.entityTable(connection, "entity_rows")); query.append(' '); filter.appendEntityWhere(connection, query, "entity_rows"); @@ -69,6 +70,7 @@ public static List performLookup(LookupOptions options) { if (!options.getExcludeEntities().isEmpty()) { query.append(" AND NOT ").append(entityPredicate(options.getExcludeEntities())); } + appendVictimFilters(connection, query, options); query.append(" ORDER BY ").append(ConfigHandler.getDescendingEventOrder().replace("time", "entity_rows.time").replace("rowid", "entity_rows.rowid")); filter.appendLimit(query); @@ -78,7 +80,7 @@ public static List performLookup(LookupOptions options) { while (results.next()) { result.add(new EntityResult( results.getLong("time"), UserStatement.getName(connection, results.getInt("user")), WorldUtils.getWorldName(results.getInt("wid")), - results.getInt("x"), results.getInt("y"), results.getInt("z"), results.getInt("type"), results.getInt("action"), results.getInt("rolled_back") + results.getInt("x"), results.getInt("y"), results.getInt("z"), results.getInt("type"), results.getInt("action"), results.getInt("rolled_back"), victim(connection, results) )); } } @@ -94,6 +96,50 @@ public static List performLookup(LookupOptions options) { return result; } + private static String victim(Connection connection, ResultSet results) throws SQLException { + // data holds a victim user ID only for player kills; other events reuse it. + if (results.getInt("action") != LookupActions.ENTITY_KILL || results.getInt("type") != 0 || results.wasNull()) { + return null; + } + long id = results.getLong("data"); + if (results.wasNull() || id <= 0 || id > Integer.MAX_VALUE) { + return null; + } + String name = UserStatement.getName(connection, (int) id); + return name == null || name.isEmpty() ? null : name; + } + + private static void appendVictimFilters(Connection connection, StringBuilder query, LookupOptions options) throws SQLException { + if (!options.getVictims().isEmpty()) { + String ids = victimIds(connection, options.getVictims()); + if (ids.isEmpty()) { + query.append(" AND 1 = 0"); + } + else { + query.append(" AND entity_rows.action=").append(LookupActions.ENTITY_KILL) + .append(" AND entity_rows.type=0 AND entity_rows.data IN (").append(ids).append(')'); + } + } + if (!options.getExcludeVictims().isEmpty()) { + String ids = victimIds(connection, options.getExcludeVictims()); + if (!ids.isEmpty()) { + query.append(" AND NOT (COALESCE(entity_rows.action,-1)=").append(LookupActions.ENTITY_KILL) + .append(" AND COALESCE(entity_rows.type,-1)=0 AND COALESCE(entity_rows.data,0) IN (").append(ids).append("))"); + } + } + } + + private static String victimIds(Connection connection, List names) throws SQLException { + StringJoiner ids = new StringJoiner(","); + for (String name : names) { + int id = UserStatement.findId(connection, name); + if (id > 0) { + ids.add(Integer.toString(id)); + } + } + return ids.toString(); + } + private static String entityPredicate(List entities) { StringJoiner names = new StringJoiner(","); for (EntityType entity : entities) { diff --git a/src/main/java/net/coreprotect/api/LookupOptions.java b/src/main/java/net/coreprotect/api/LookupOptions.java index f721d97a4..94cc8ce34 100644 --- a/src/main/java/net/coreprotect/api/LookupOptions.java +++ b/src/main/java/net/coreprotect/api/LookupOptions.java @@ -22,6 +22,8 @@ public final class LookupOptions { private final List excludeMaterials; private final List users; private final List excludeUsers; + private final List victims; + private final List excludeVictims; private final List textStartsWithAny; private final List textStartsWithNone; private final List containerActions; @@ -45,6 +47,8 @@ private LookupOptions(Builder builder) { this.excludeMaterials = builder.excludeMaterials; this.users = builder.users; this.excludeUsers = builder.excludeUsers; + this.victims = builder.victims; + this.excludeVictims = builder.excludeVictims; this.textStartsWithAny = builder.textStartsWithAny; this.textStartsWithNone = builder.textStartsWithNone; this.containerActions = builder.containerActions; @@ -109,6 +113,14 @@ public List getExcludeUsers() { return excludeUsers; } + public List getVictims() { + return victims; + } + + public List getExcludeVictims() { + return excludeVictims; + } + public List getTextStartsWithAny() { return textStartsWithAny; } @@ -161,6 +173,8 @@ public static final class Builder { private List excludeMaterials = List.of(); private List users = List.of(); private List excludeUsers = List.of(); + private List victims = List.of(); + private List excludeVictims = List.of(); private List textStartsWithAny = List.of(); private List textStartsWithNone = List.of(); private List containerActions = List.of(); @@ -232,6 +246,36 @@ public Builder excludeUsers(List users) { return this; } + /** + * Includes kills of any named player in entityLookup only, before pagination. + * Empty means no victim restriction; unknown names never match. + * @throws IllegalArgumentException for blank names or special users beginning with '#' + */ + public Builder victims(List victims) { + this.victims = victimNames(victims); + return this; + } + + /** + * Excludes kills of named players in entityLookup only, before pagination. + * Other entity events and kills with an unknown victim are retained. + * @throws IllegalArgumentException for blank names or special users beginning with '#' + */ + public Builder excludeVictims(List victims) { + this.excludeVictims = victimNames(victims); + return this; + } + + private static List victimNames(List victims) { + List copy = List.copyOf(victims); + for (String victim : copy) { + if (victim.isBlank() || victim.startsWith("#")) { + throw new IllegalArgumentException("Victim filters require player names"); + } + } + return copy; + } + /** * Includes chat, command and sign text matching any literal prefix. * Empty means no inclusion restriction. Other lookup types ignore this option. diff --git a/src/main/java/net/coreprotect/api/result/EntityResult.java b/src/main/java/net/coreprotect/api/result/EntityResult.java index 747170e1f..327f1443c 100644 --- a/src/main/java/net/coreprotect/api/result/EntityResult.java +++ b/src/main/java/net/coreprotect/api/result/EntityResult.java @@ -11,6 +11,7 @@ public class EntityResult implements CoreProtectResult { private final long time; private final String username; + private final String victim; private final String world; private final int x; private final int y; @@ -20,6 +21,11 @@ public class EntityResult implements CoreProtectResult { private final int rolledBack; public EntityResult(long time, String username, String world, int x, int y, int z, int type, int actionId, int rolledBack) { + this(time, username, world, x, y, z, type, actionId, rolledBack, null); + } + + public EntityResult(long time, String username, String world, int x, int y, int z, int type, int actionId, int rolledBack, String victim) { + this.victim = actionId == LookupActions.ENTITY_KILL && type == 0 ? victim : null; this.time = time; this.username = username; this.world = world; @@ -43,6 +49,14 @@ public String getPlayer() { return username; } + /** + * Returns the recorded name of the killed player, or null for other events + * and player kills whose victim cannot be resolved. + */ + public String getVictim() { + return victim; + } + public long getTimestamp() { return time * 1000L; } diff --git a/src/test/java/net/coreprotect/api/EntityVictimLookupTest.java b/src/test/java/net/coreprotect/api/EntityVictimLookupTest.java new file mode 100644 index 000000000..c6c324037 --- /dev/null +++ b/src/test/java/net/coreprotect/api/EntityVictimLookupTest.java @@ -0,0 +1,247 @@ +package net.coreprotect.api; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.mockStatic; + +import java.nio.file.Path; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.bukkit.entity.EntityType; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; +import org.mockito.MockedStatic; + +import net.coreprotect.api.result.EntityResult; +import net.coreprotect.config.Config; +import net.coreprotect.config.ConfigHandler; +import net.coreprotect.database.Database; +import net.coreprotect.database.DatabaseType; +import net.coreprotect.model.action.LookupActions; +import net.coreprotect.utility.ErrorReporter; +import net.coreprotect.utility.SystemUtils; + +class EntityVictimLookupTest { + @TempDir + Path directory; + + @ParameterizedTest + @EnumSource(value = DatabaseType.class, names = { "SQLITE", "DUCKDB" }) + void filtersActorAndVictimBeforePagination(DatabaseType backend) throws Exception { + try (Fixture ignored = fixture(backend)) { + LookupOptions first = LookupOptions.builder().time(86400).users(List.of("KillerOne")) + .victims(List.of("VictimOne")).limit(0, 1).build(); + List result = EntityAPI.performLookup(first); + assertEquals(List.of(14), rowIds(result)); + assertEquals("KillerOne", result.get(0).getPlayer()); + assertEquals("VictimOne", result.get(0).getVictim()); + assertEquals(EntityType.PLAYER, result.get(0).getEntityType()); + assertEquals("world", result.get(0).worldName()); + + LookupOptions second = LookupOptions.builder().time(86400).users(List.of("KillerOne")) + .victims(List.of("VictimOne")).limit(1, 1).build(); + assertEquals(List.of(11), rowIds(EntityAPI.performLookup(second))); + } + } + + @ParameterizedTest + @EnumSource(value = DatabaseType.class, names = { "SQLITE", "DUCKDB" }) + void resolvesVictimNamesCaseInsensitivelyAndCombinesVictims(DatabaseType backend) throws Exception { + try (Fixture ignored = fixture(backend)) { + LookupOptions options = LookupOptions.builder().time(86400) + .victims(List.of("vIcTiMoNe", "VICTIMTWO")).build(); + assertEquals(List.of(14, 13, 12, 11), rowIds(EntityAPI.performLookup(options))); + } + } + + @ParameterizedTest + @EnumSource(value = DatabaseType.class, names = { "SQLITE", "DUCKDB" }) + void excludesVictimsWithoutLosingOtherEntityEvents(DatabaseType backend) throws Exception { + try (Fixture ignored = fixture(backend)) { + LookupOptions options = LookupOptions.builder().time(86400) + .excludeVictims(List.of("VictimOne")).build(); + List result = EntityAPI.performLookup(options); + assertEquals(List.of(23, 21, 20, 19, 18, 17, 16, 15, 12), rowIds(result)); + assertEquals("VictimTwo", result.get(result.size() - 1).getVictim()); + result.subList(0, result.size() - 1).forEach(row -> assertNull(row.getVictim())); + } + } + + @ParameterizedTest + @EnumSource(value = DatabaseType.class, names = { "SQLITE", "DUCKDB" }) + void exclusionWinsAndEntityActionFiltersStillApply(DatabaseType backend) throws Exception { + try (Fixture ignored = fixture(backend)) { + LookupOptions options = LookupOptions.builder().time(86400) + .victims(List.of("VictimOne", "VictimTwo")) + .excludeVictims(List.of("VictimOne")).entityActions(List.of(EntityAction.KILL)) + .includeEntities(List.of(EntityType.PLAYER)).build(); + assertEquals(List.of(12), rowIds(EntityAPI.performLookup(options))); + assertEquals(List.of(), EntityAPI.performLookup(LookupOptions.builder().time(86400) + .victims(List.of("VictimOne")).entityActions(List.of(EntityAction.SPAWN)).build())); + } + } + + @ParameterizedTest + @EnumSource(value = DatabaseType.class, names = { "SQLITE", "DUCKDB" }) + void handlesUnknownVictimsWithoutWideningInclusion(DatabaseType backend) throws Exception { + try (Fixture fixture = fixture(backend)) { + assertEquals(List.of(), EntityAPI.performLookup(LookupOptions.builder() + .victims(List.of("NeverSeen")).build())); + assertEquals(rowIds(EntityAPI.performLookup(LookupOptions.builder().time(86400).build())), + rowIds(EntityAPI.performLookup(LookupOptions.builder().time(86400) + .excludeVictims(List.of("NeverSeen")).build()))); + assertEquals(List.of(14, 13, 11), rowIds(EntityAPI.performLookup(LookupOptions.builder() + .time(86400).victims(List.of("NeverSeen", "VictimOne")).build()))); + try (Statement statement = fixture.connection.createStatement(); + var rows = statement.executeQuery("SELECT COUNT(*) FROM co_user")) { + rows.next(); + assertEquals(4, rows.getInt(1), "Lookup must not insert unknown players"); + } + } + } + + @ParameterizedTest + @EnumSource(value = DatabaseType.class, names = { "SQLITE", "DUCKDB" }) + void onlyDecodesVictimsForPlayerKillsAndRetainsLegacyResults(DatabaseType backend) throws Exception { + try (Fixture ignored = fixture(backend)) { + List result = EntityAPI.performLookup(LookupOptions.builder().time(86400).build()); + assertEquals(List.of(23, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11), rowIds(result)); + for (EntityResult row : result) { + if (row.getX() >= 15) { + assertNull(row.getVictim(), "Invalid IDs, mob metadata and spawn data are not victims"); + } + } + assertEquals(List.of(14, 13, 12, 11), rowIds(EntityAPI.performLookup(LookupOptions.builder() + .time(86400).victims(List.of("VictimOne", "VictimTwo")).build()))); + } + } + + @Test + void victimOptionsAreImmutableAndRejectWildcards() { + List values = new ArrayList<>(List.of("VictimOne")); + LookupOptions options = LookupOptions.builder().victims(values).excludeVictims(values).build(); + values.set(0, "Other"); + assertEquals(List.of("VictimOne"), options.getVictims()); + assertEquals(List.of("VictimOne"), options.getExcludeVictims()); + assertThrows(UnsupportedOperationException.class, () -> options.getVictims().add("Other")); + assertThrows(UnsupportedOperationException.class, () -> options.getExcludeVictims().clear()); + for (String invalid : List.of("", " ", "#global", "#zombie")) { + assertThrows(IllegalArgumentException.class, () -> LookupOptions.builder().victims(List.of(invalid))); + assertThrows(IllegalArgumentException.class, () -> LookupOptions.builder().excludeVictims(List.of(invalid))); + } + assertThrows(NullPointerException.class, () -> LookupOptions.builder().victims(null)); + assertThrows(NullPointerException.class, () -> LookupOptions.builder().excludeVictims(Arrays.asList("VictimOne", null))); + assertEquals(List.of(), LookupOptions.builder().build().getVictims()); + assertEquals(List.of(), LookupOptions.builder().build().getExcludeVictims()); + } + + @Test + void keepsExistingResultConstructorAndRestrictsVictimToPlayerKills() { + EntityResult original = new EntityResult(123, "KillerOne", "world", 1, 2, 3, 0, + LookupActions.ENTITY_KILL, 0); + assertNull(original.getVictim()); + assertEquals("KillerOne", original.getPlayer()); + assertEquals(123000, original.getTimestamp()); + assertFalse(original.isRolledBack()); + assertNull(new EntityResult(123, "KillerOne", "world", 1, 2, 3, 23, + LookupActions.ENTITY_KILL, 0, "VictimOne").getVictim()); + assertNull(new EntityResult(123, "KillerOne", "world", 1, 2, 3, 0, + LookupActions.ENTITY_SPAWN, 0, "VictimOne").getVictim()); + } + + private static List rowIds(List rows) { + return rows.stream().map(EntityResult::getX).collect(Collectors.toList()); + } + + private Fixture fixture(DatabaseType backend) throws Exception { + String url = backend.isSQLite() + ? "jdbc:sqlite:file:entity-victims-" + UUID.randomUUID() + "?mode=memory&cache=shared" + : "jdbc:duckdb:" + directory.resolve("entity-victims.duckdb"); + return new Fixture(backend, url); + } + + private static final class Fixture implements AutoCloseable { + final Connection connection; + private final MockedStatic database; + private final MockedStatic errors; + private final DatabaseType previousBackend; + private final String previousPrefix; + private final boolean previousApi; + private final Map previousIds; + private final Map previousNames; + private final Map previousUuids; + private final Map previousUuidNames; + private final Map previousWorlds; + + Fixture(DatabaseType backend, String url) throws Exception { + SystemUtils.setTestMode(true); + previousBackend = ConfigHandler.databaseType; + previousPrefix = ConfigHandler.prefix; + previousApi = Config.getGlobal().API_ENABLED; + previousIds = ConfigHandler.playerIdCache; + previousNames = ConfigHandler.playerIdCacheReversed; + previousUuids = ConfigHandler.uuidCache; + previousUuidNames = ConfigHandler.uuidCacheReversed; + previousWorlds = ConfigHandler.worldsReversed; + ConfigHandler.databaseType = backend; + ConfigHandler.prefix = "co_"; + Config.getGlobal().API_ENABLED = true; + ConfigHandler.playerIdCache = new HashMap<>(); + ConfigHandler.playerIdCacheReversed = new HashMap<>(); + ConfigHandler.uuidCache = new HashMap<>(); + ConfigHandler.uuidCacheReversed = new HashMap<>(); + ConfigHandler.worldsReversed = new HashMap<>(Map.of(1, "world")); + connection = DriverManager.getConnection(url); + try (Statement statement = connection.createStatement()) { + statement.execute("CREATE TABLE co_user (rowid INTEGER PRIMARY KEY, time BIGINT, \"user\" VARCHAR, uuid VARCHAR)"); + statement.execute("INSERT INTO co_user VALUES (1,0,'KillerOne',NULL),(2,0,'OtherKiller',NULL),(3,0,'VictimOne',NULL),(4,0,'VictimTwo',NULL)"); + statement.execute("CREATE TABLE co_block (rowid BIGINT PRIMARY KEY, time BIGINT, \"user\" INTEGER, wid INTEGER, x INTEGER, y INTEGER, z INTEGER, type INTEGER, data BIGINT, action INTEGER, rolled_back INTEGER)"); + statement.execute("CREATE TABLE co_entity_map (id INTEGER, entity VARCHAR)"); + int time = (int) (System.currentTimeMillis() / 1000L); + for (String row : List.of("11,1,0,3,3", "12,1,0,4,3", "13,2,0,3,3", "14,1,0,3,3", + "15,1,23,3,13", "16,1,23,3,3", "17,1,0,NULL,3", "18,1,0,0,3", + "19,1,0,-1,3", "20,1,0,999,3", "21,1,0,4294967299,3", "23,1,NULL,3,3")) { + String[] parts = row.split(","); + statement.execute("INSERT INTO co_block VALUES (" + parts[0] + "," + time + "," + + parts[1] + ",1," + parts[0] + ",64,0," + parts[2] + "," + parts[3] + + "," + parts[4] + ",0)"); + } + statement.execute("INSERT INTO co_block VALUES (22," + (time - 200000) + ",1,1,22,64,0,0,3,3,0)"); + } + errors = mockStatic(ErrorReporter.class, invocation -> { + throw new AssertionError("Lookup swallowed a database error", (Throwable) invocation.getArgument(0)); + }); + database = mockStatic(Database.class); + database.when(() -> Database.getConnection(false, 1000)).thenAnswer(invocation -> DriverManager.getConnection(url)); + } + + @Override + public void close() throws Exception { + database.close(); + errors.close(); + connection.close(); + ConfigHandler.databaseType = previousBackend; + ConfigHandler.prefix = previousPrefix; + Config.getGlobal().API_ENABLED = previousApi; + ConfigHandler.playerIdCache = previousIds; + ConfigHandler.playerIdCacheReversed = previousNames; + ConfigHandler.uuidCache = previousUuids; + ConfigHandler.uuidCacheReversed = previousUuidNames; + ConfigHandler.worldsReversed = previousWorlds; + SystemUtils.setTestMode(false); + } + } +}