mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 19:47:49 +01:00
Removed non-main server plugin data from query results
This commit is contained in:
parent
2cd5cf9564
commit
0b187ef20c
@ -28,6 +28,7 @@ import com.djrapitops.plan.delivery.web.resolver.exception.BadRequestException;
|
||||
import com.djrapitops.plan.delivery.web.resolver.request.Request;
|
||||
import com.djrapitops.plan.delivery.web.resolver.request.WebUser;
|
||||
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionQueryResultTableDataQuery;
|
||||
import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.DisplaySettings;
|
||||
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
||||
@ -61,6 +62,7 @@ public class QueryJSONResolver implements Resolver {
|
||||
|
||||
private final PlanConfig config;
|
||||
private final DBSystem dbSystem;
|
||||
private final ServerInfo serverInfo;
|
||||
private final JSONStorage jsonStorage;
|
||||
private final GraphJSONCreator graphJSONCreator;
|
||||
private final Locale locale;
|
||||
@ -71,7 +73,7 @@ public class QueryJSONResolver implements Resolver {
|
||||
QueryFilters filters,
|
||||
PlanConfig config,
|
||||
DBSystem dbSystem,
|
||||
JSONStorage jsonStorage,
|
||||
ServerInfo serverInfo, JSONStorage jsonStorage,
|
||||
GraphJSONCreator graphJSONCreator,
|
||||
Locale locale,
|
||||
Formatters formatters
|
||||
@ -79,6 +81,7 @@ public class QueryJSONResolver implements Resolver {
|
||||
this.filters = filters;
|
||||
this.config = config;
|
||||
this.dbSystem = dbSystem;
|
||||
this.serverInfo = serverInfo;
|
||||
this.jsonStorage = jsonStorage;
|
||||
this.graphJSONCreator = graphJSONCreator;
|
||||
this.locale = locale;
|
||||
@ -205,7 +208,7 @@ public class QueryJSONResolver implements Resolver {
|
||||
Database database = dbSystem.getDatabase();
|
||||
return new PlayersTableJSONCreator(
|
||||
database.query(new QueryTablePlayersQuery(playerUUIDs, after, before, config.get(TimeSettings.ACTIVE_PLAY_THRESHOLD))),
|
||||
database.query(new ExtensionQueryResultTableDataQuery(playerUUIDs)),
|
||||
database.query(new ExtensionQueryResultTableDataQuery(serverInfo.getServerUUID(), playerUUIDs)),
|
||||
config.get(DisplaySettings.OPEN_PLAYER_LINKS_IN_NEW_TAB),
|
||||
formatters, locale
|
||||
).toJSONMap();
|
||||
|
@ -23,7 +23,6 @@ import com.djrapitops.plan.extension.icon.Icon;
|
||||
import com.djrapitops.plan.extension.implementation.results.*;
|
||||
import com.djrapitops.plan.storage.database.SQLDB;
|
||||
import com.djrapitops.plan.storage.database.queries.Query;
|
||||
import com.djrapitops.plan.storage.database.queries.QueryAllStatement;
|
||||
import com.djrapitops.plan.storage.database.queries.QueryStatement;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.*;
|
||||
import org.apache.commons.text.TextStringBuilder;
|
||||
@ -48,9 +47,11 @@ import static com.djrapitops.plan.storage.database.sql.building.Sql.*;
|
||||
*/
|
||||
public class ExtensionQueryResultTableDataQuery implements Query<Map<UUID, ExtensionTabData>> {
|
||||
|
||||
private final UUID serverUUID;
|
||||
private final Collection<UUID> playerUUIDs;
|
||||
|
||||
public ExtensionQueryResultTableDataQuery(Collection<UUID> playerUUIDs) {
|
||||
public ExtensionQueryResultTableDataQuery(UUID serverUUID, Collection<UUID> playerUUIDs) {
|
||||
this.serverUUID = serverUUID;
|
||||
this.playerUUIDs = playerUUIDs;
|
||||
}
|
||||
|
||||
@ -97,13 +98,15 @@ public class ExtensionQueryResultTableDataQuery implements Query<Map<UUID, Exten
|
||||
WHERE + "v1." + ExtensionPlayerValueTable.USER_UUID + " IN ('" +
|
||||
new TextStringBuilder().appendWithSeparators(playerUUIDs, "','").build() + "')" +
|
||||
AND + "p1." + ExtensionProviderTable.SHOW_IN_PLAYERS_TABLE + "=?" +
|
||||
AND + "p1." + ExtensionProviderTable.IS_PLAYER_NAME + "=?";
|
||||
AND + "p1." + ExtensionProviderTable.IS_PLAYER_NAME + "=?" +
|
||||
AND + "e1." + ExtensionPluginTable.SERVER_UUID + "=?";
|
||||
|
||||
return new QueryStatement<Map<UUID, ExtensionTabData>>(sql, 1000) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setBoolean(1, true); // Select only values that should be shown
|
||||
statement.setBoolean(2, false); // Don't select player_name String values
|
||||
statement.setString(3, serverUUID.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -126,9 +129,15 @@ public class ExtensionQueryResultTableDataQuery implements Query<Map<UUID, Exten
|
||||
INNER_JOIN + ExtensionPluginTable.TABLE_NAME + " e1 on e1." + ExtensionPluginTable.ID + "=p1." + ExtensionProviderTable.PLUGIN_ID +
|
||||
LEFT_JOIN + ExtensionIconTable.TABLE_NAME + " i1 on i1." + ExtensionIconTable.ID + "=p1." + ExtensionProviderTable.ICON_ID +
|
||||
WHERE + "v1." + ExtensionPlayerValueTable.USER_UUID + " IN ('" +
|
||||
new TextStringBuilder().appendWithSeparators(playerUUIDs, "','").build() + "')";
|
||||
new TextStringBuilder().appendWithSeparators(playerUUIDs, "','").build() + "')" +
|
||||
AND + "e1." + ExtensionPluginTable.SERVER_UUID + "=?";
|
||||
|
||||
return new QueryStatement<Map<UUID, ExtensionTabData>>(sql, 1000) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setString(1, serverUUID.toString());
|
||||
}
|
||||
|
||||
return new QueryAllStatement<Map<UUID, ExtensionTabData>>(sql, 1000) {
|
||||
@Override
|
||||
public Map<UUID, ExtensionTabData> processResults(ResultSet set) throws SQLException {
|
||||
return extractDataByPlayer(set);
|
||||
|
Loading…
Reference in New Issue
Block a user