diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/html/structure/DynamicHtmlTable.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/html/structure/DynamicHtmlTable.java index 261297f9a..8fde3169d 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/html/structure/DynamicHtmlTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/html/structure/DynamicHtmlTable.java @@ -100,7 +100,13 @@ public class DynamicHtmlTable implements HtmlTable { if (NumberUtils.isParsable(valueString)) { builtBody.append("").append(valueString); } else { - builtBody.append("").append(valueString); + // Removes non numbers from the value + String numbersInValue = valueString.replaceAll("\\D", ""); + if (!numbersInValue.isEmpty()) { + builtBody.append("").append(valueString); + } else { + builtBody.append("").append(valueString); + } } } } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/html/structure/HtmlTable.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/html/structure/HtmlTable.java index 1b2d9842c..c9999aa39 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/html/structure/HtmlTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/html/structure/HtmlTable.java @@ -29,7 +29,7 @@ public interface HtmlTable { } static HtmlTable fromExtensionTable(Table table, Color tableColor) { - if (table.getRows().size() > 25) { + if (table.getRows().size() > 10) { return new DynamicHtmlTable(table); } else { return new HtmlTableWithColoredHeader(table, tableColor); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/SQLDB.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/SQLDB.java index 6a488233f..8bdb76262 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/SQLDB.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/SQLDB.java @@ -30,6 +30,7 @@ import com.djrapitops.plan.storage.database.transactions.Transaction; import com.djrapitops.plan.storage.database.transactions.init.CreateIndexTransaction; import com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction; import com.djrapitops.plan.storage.database.transactions.init.OperationCriticalTransaction; +import com.djrapitops.plan.storage.database.transactions.init.RemoveIncorrectTebexPackageDataPatch; import com.djrapitops.plan.storage.database.transactions.patches.*; import com.djrapitops.plan.utilities.java.ThrowableUtils; import com.djrapitops.plan.utilities.logging.ErrorContext; @@ -181,7 +182,8 @@ public abstract class SQLDB extends AbstractDatabase { new UserInfoHostnameAllowNullPatch(), new ServerTableRowPatch(), new PlayerTableRowPatch(), - new ExtensionTableProviderValuesForPatch() + new ExtensionTableProviderValuesForPatch(), + new RemoveIncorrectTebexPackageDataPatch() }; } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/transactions/init/RemoveIncorrectTebexPackageDataPatch.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/transactions/init/RemoveIncorrectTebexPackageDataPatch.java new file mode 100644 index 000000000..7f7365a52 --- /dev/null +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/transactions/init/RemoveIncorrectTebexPackageDataPatch.java @@ -0,0 +1,53 @@ +/* + * This file is part of Player Analytics (Plan). + * + * Plan is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License v3 as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Plan is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Plan. If not, see . + */ +package com.djrapitops.plan.storage.database.transactions.init; + +import com.djrapitops.plan.storage.database.queries.HasMoreThanZeroQueryStatement; +import com.djrapitops.plan.storage.database.queries.Query; +import com.djrapitops.plan.storage.database.transactions.patches.Patch; + +import java.sql.PreparedStatement; +import java.sql.SQLException; + +import static com.djrapitops.plan.storage.database.sql.building.Sql.*; + +/** + * Removes incorrectly formatted package data from the database. + */ +public class RemoveIncorrectTebexPackageDataPatch extends Patch { + + @Override + public boolean hasBeenApplied() { + return hasTable("plan_tebex_payments") && !query(hasWrongRows()); + } + + private Query hasWrongRows() { + return new HasMoreThanZeroQueryStatement( + SELECT + "COUNT(*) as c" + FROM + "plan_tebex_payments" + + WHERE + "packages LIKE 'TebexPackage%'" + ) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + } + }; + } + + @Override + protected void applyPatch() { + execute(DELETE_FROM + "plan_tebex_payments" + WHERE + "packages LIKE 'TebexPackage%'"); + } +} diff --git a/Plan/extensions/build.gradle b/Plan/extensions/build.gradle index 74a02e46a..3946728ea 100644 --- a/Plan/extensions/build.gradle +++ b/Plan/extensions/build.gradle @@ -41,7 +41,7 @@ dependencies { compile 'com.djrapitops:Extension-RedProtect:7.7.3-R0.1' compile 'com.djrapitops:Extension-Sponge-Economy:7.1.0-R0.3' compile 'com.djrapitops:Extension-SuperbVote:0.5.4-R0.1' - compile 'com.djrapitops:Extension-Tebex:R1.1' + compile 'com.djrapitops:Extension-Tebex:R1.2' compile 'com.djrapitops:Extension-Towny:0.96.7.4-R0.2' compile 'com.djrapitops:Extension-Vault:1.7-R0.3' compile 'com.djrapitops:Extension-ViaVersion:2.1.3-R1.5'