mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Prevented unregistered player export
Error was reported on Discord that exporting on join sometimes caused a BadRequestException A check was added to prevent exporting non-registered players.
This commit is contained in:
parent
2c714fe4e9
commit
d17a962505
@ -19,6 +19,7 @@ package com.djrapitops.plan.delivery.export;
|
||||
import com.djrapitops.plan.delivery.webserver.response.ResponseFactory;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.PlayerFetchQueries;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -49,6 +50,7 @@ public class PlayerJSONExporter extends FileExporter {
|
||||
public void export(Path toDirectory, UUID playerUUID, String playerName) throws IOException {
|
||||
Database.State dbState = dbSystem.getDatabase().getState();
|
||||
if (dbState == Database.State.CLOSED || dbState == Database.State.CLOSING) return;
|
||||
if (!dbSystem.getDatabase().query(PlayerFetchQueries.isPlayerRegistered(playerUUID))) return;
|
||||
|
||||
Path to = toDirectory.resolve("player/" + toFileName(playerName) + ".json");
|
||||
exportJSON(to, playerUUID);
|
||||
|
@ -29,6 +29,7 @@ import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.PlayerFetchQueries;
|
||||
import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
import com.djrapitops.plan.storage.file.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -79,6 +80,7 @@ public class PlayerPageExporter extends FileExporter {
|
||||
public void export(Path toDirectory, UUID playerUUID, String playerName) throws IOException, NotFoundException, ParseException {
|
||||
Database.State dbState = dbSystem.getDatabase().getState();
|
||||
if (dbState == Database.State.CLOSED || dbState == Database.State.CLOSING) return;
|
||||
if (!dbSystem.getDatabase().query(PlayerFetchQueries.isPlayerRegistered(playerUUID))) return;
|
||||
|
||||
exportPaths.put("../network", toRelativePathFromRoot("network"));
|
||||
exportPaths.put("../server", toRelativePathFromRoot("server"));
|
||||
|
Loading…
Reference in New Issue
Block a user