diff --git a/Plan/common/build.gradle b/Plan/common/build.gradle index 766f71514..52df07866 100644 --- a/Plan/common/build.gradle +++ b/Plan/common/build.gradle @@ -13,6 +13,8 @@ dependencies { compile "org.slf4j:slf4j-api:$slf4jVersion" compile "com.maxmind.geoip2:geoip2:$geoIpVersion" compileOnly "com.google.guava:guava:$guavaVersion" + + testCompile project(path: ":api", configuration: 'shadow') } shadowJar { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionProviderTable.java b/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionProviderTable.java index 9e2abff91..a1277bfc4 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionProviderTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionProviderTable.java @@ -73,7 +73,7 @@ public class ExtensionProviderTable { .column(IS_PLAYER_NAME, BOOL).notNull().defaultValue(false) .column(PLUGIN_ID, INT).notNull() .column(ICON_ID, INT).notNull() - .column(TAB_ID, INT).notNull() + .column(TAB_ID, INT) .foreignKey(PLUGIN_ID, ExtensionPluginTable.TABLE_NAME, ExtensionPluginTable.ID) .foreignKey(ICON_ID, ExtensionIconTable.TABLE_NAME, ExtensionIconTable.ID) .foreignKey(TAB_ID, ExtensionTabTable.TABLE_NAME, ExtensionTabTable.ID) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java index cfe7e8c35..d75b84c21 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java @@ -92,12 +92,13 @@ public class ExtensionServiceImplementation implements ExtensionService { gatherer.storeExtensionInformation(); extensionGatherers.put(pluginName, gatherer); - logger.getDebugLogger().logOn(DebugChannels.DATA_EXTENSIONS, pluginName + " extension disabled in the config."); + logger.getDebugLogger().logOn(DebugChannels.DATA_EXTENSIONS, pluginName + " extension registered."); } private boolean shouldNotAllowRegistration(String pluginName) { PluginsConfigSection pluginsConfig = config.getPluginsConfigSection(); - if (pluginsConfig.hasSection(pluginName)) { + + if (!pluginsConfig.hasSection(pluginName)) { try { pluginsConfig.createSection(pluginName); } catch (IOException e) { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreBooleanProviderTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreBooleanProviderTransaction.java index 24839eb0a..eb9854853 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreBooleanProviderTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreBooleanProviderTransaction.java @@ -27,6 +27,7 @@ import com.djrapitops.plan.extension.implementation.providers.DataProvider; import java.sql.PreparedStatement; import java.sql.SQLException; +import java.sql.Types; import java.util.UUID; import static com.djrapitops.plan.db.sql.parsing.Sql.AND; @@ -81,14 +82,26 @@ public class StoreBooleanProviderTransaction extends Transaction { @Override public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, providerInformation.getText()); - statement.setString(2, providerInformation.getDescription().orElse(null)); + if (providerInformation.getDescription().isPresent()) { + statement.setString(2, providerInformation.getDescription().get()); + } else { + statement.setNull(2, Types.VARCHAR); + } statement.setInt(3, providerInformation.getPriority()); - statement.setString(4, providerInformation.getCondition().orElse(null)); - statement.setString(5, providedCondition); - ExtensionTabTable.set3TabValuesToStatement(statement, 6, providerInformation.getTab().orElse(null), providerInformation.getPluginName(), serverUUID); + if (providerInformation.getCondition().isPresent()) { + statement.setString(4, providerInformation.getCondition().orElse(null)); + } else { + statement.setNull(4, Types.VARCHAR); + } + if (providedCondition != null) { + statement.setString(5, providedCondition); + } else { + statement.setNull(5, Types.VARCHAR); + } + ExtensionTabTable.set3TabValuesToStatement(statement, 6, providerInformation.getTab().orElse("No Tab"), providerInformation.getPluginName(), serverUUID); ExtensionIconTable.set3IconValuesToStatement(statement, 9, providerInformation.getIcon()); - ExtensionPluginTable.set2PluginValuesToStatement(statement, 11, providerInformation.getPluginName(), serverUUID); - statement.setString(13, providerInformation.getName()); + ExtensionPluginTable.set2PluginValuesToStatement(statement, 12, providerInformation.getPluginName(), serverUUID); + statement.setString(14, providerInformation.getName()); } }; } @@ -113,13 +126,25 @@ public class StoreBooleanProviderTransaction extends Transaction { public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, providerInformation.getName()); statement.setString(2, providerInformation.getText()); - statement.setString(3, providerInformation.getDescription().orElse(null)); + if (providerInformation.getDescription().isPresent()) { + statement.setString(3, providerInformation.getDescription().get()); + } else { + statement.setNull(3, Types.VARCHAR); + } statement.setInt(4, providerInformation.getPriority()); - statement.setString(5, providerInformation.getCondition().orElse(null)); - statement.setString(6, providedCondition); - ExtensionTabTable.set3TabValuesToStatement(statement, 7, providerInformation.getTab().orElse(null), providerInformation.getPluginName(), serverUUID); + if (providerInformation.getCondition().isPresent()) { + statement.setString(5, providerInformation.getCondition().orElse(null)); + } else { + statement.setNull(5, Types.VARCHAR); + } + if (providedCondition != null) { + statement.setString(6, providedCondition); + } else { + statement.setNull(6, Types.VARCHAR); + } + ExtensionTabTable.set3TabValuesToStatement(statement, 7, providerInformation.getTab().orElse("No Tab"), providerInformation.getPluginName(), serverUUID); ExtensionIconTable.set3IconValuesToStatement(statement, 10, providerInformation.getIcon()); - ExtensionPluginTable.set2PluginValuesToStatement(statement, 12, providerInformation.getPluginName(), serverUUID); + ExtensionPluginTable.set2PluginValuesToStatement(statement, 13, providerInformation.getPluginName(), serverUUID); } }; } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreDoubleProviderTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreDoubleProviderTransaction.java index 9fdb68082..1a84eb119 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreDoubleProviderTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreDoubleProviderTransaction.java @@ -27,6 +27,7 @@ import com.djrapitops.plan.extension.implementation.providers.DataProvider; import java.sql.PreparedStatement; import java.sql.SQLException; +import java.sql.Types; import java.util.UUID; import static com.djrapitops.plan.db.sql.parsing.Sql.AND; @@ -82,12 +83,20 @@ public class StoreDoubleProviderTransaction extends Transaction { @Override public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, providerInformation.getText()); - statement.setString(2, providerInformation.getDescription().orElse(null)); + if (providerInformation.getDescription().isPresent()) { + statement.setString(2, providerInformation.getDescription().get()); + } else { + statement.setNull(2, Types.VARCHAR); + } statement.setInt(3, providerInformation.getPriority()); - statement.setString(4, providerInformation.getCondition().orElse(null)); - ExtensionTabTable.set3TabValuesToStatement(statement, 5, providerInformation.getTab().orElse(null), providerInformation.getPluginName(), serverUUID); + if (providerInformation.getCondition().isPresent()) { + statement.setString(4, providerInformation.getCondition().orElse(null)); + } else { + statement.setNull(4, Types.VARCHAR); + } + ExtensionTabTable.set3TabValuesToStatement(statement, 5, providerInformation.getTab().orElse("No Tab"), providerInformation.getPluginName(), serverUUID); ExtensionIconTable.set3IconValuesToStatement(statement, 8, providerInformation.getIcon()); - ExtensionPluginTable.set2PluginValuesToStatement(statement, 10, providerInformation.getPluginName(), serverUUID); + ExtensionPluginTable.set2PluginValuesToStatement(statement, 11, providerInformation.getPluginName(), serverUUID); statement.setString(13, providerInformation.getName()); } }; @@ -103,7 +112,7 @@ public class StoreDoubleProviderTransaction extends Transaction { TAB_ID + "," + ICON_ID + "," + PLUGIN_ID + - ") VALUES (?,?,?,?,?,?," + + ") VALUES (?,?,?,?,?," + ExtensionTabTable.STATEMENT_SELECT_TAB_ID + "," + ExtensionIconTable.STATEMENT_SELECT_ICON_ID + "," + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID + ")"; @@ -112,12 +121,20 @@ public class StoreDoubleProviderTransaction extends Transaction { public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, providerInformation.getName()); statement.setString(2, providerInformation.getText()); - statement.setString(3, providerInformation.getDescription().orElse(null)); + if (providerInformation.getDescription().isPresent()) { + statement.setString(3, providerInformation.getDescription().get()); + } else { + statement.setNull(3, Types.VARCHAR); + } statement.setInt(4, providerInformation.getPriority()); - statement.setString(5, providerInformation.getCondition().orElse(null)); - ExtensionTabTable.set3TabValuesToStatement(statement, 6, providerInformation.getTab().orElse(null), providerInformation.getPluginName(), serverUUID); + if (providerInformation.getCondition().isPresent()) { + statement.setString(5, providerInformation.getCondition().get()); + } else { + statement.setNull(5, Types.VARCHAR); + } + ExtensionTabTable.set3TabValuesToStatement(statement, 6, providerInformation.getTab().orElse("No Tab"), providerInformation.getPluginName(), serverUUID); ExtensionIconTable.set3IconValuesToStatement(statement, 9, providerInformation.getIcon()); - ExtensionPluginTable.set2PluginValuesToStatement(statement, 11, providerInformation.getPluginName(), serverUUID); + ExtensionPluginTable.set2PluginValuesToStatement(statement, 12, providerInformation.getPluginName(), serverUUID); } }; } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreNumberProviderTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreNumberProviderTransaction.java index 943e058a6..b14a08607 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreNumberProviderTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreNumberProviderTransaction.java @@ -28,6 +28,7 @@ import com.djrapitops.plan.extension.implementation.providers.DataProvider; import java.sql.PreparedStatement; import java.sql.SQLException; +import java.sql.Types; import java.util.UUID; import static com.djrapitops.plan.db.sql.parsing.Sql.AND; @@ -39,6 +40,7 @@ import static com.djrapitops.plan.db.sql.tables.ExtensionProviderTable.*; * * @author Rsl1122 */ +@SuppressWarnings("Duplicates") public class StoreNumberProviderTransaction extends Transaction { private final FormatType formatType; @@ -66,8 +68,7 @@ public class StoreNumberProviderTransaction extends Transaction { } private Executable updateProvider() { - String sql = "UPDATE " + TABLE_NAME + - " SET " + + String sql = "UPDATE " + TABLE_NAME + " SET " + TEXT + "=?," + DESCRIPTION + "=?," + PRIORITY + "=?," + @@ -82,14 +83,22 @@ public class StoreNumberProviderTransaction extends Transaction { @Override public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, providerInformation.getText()); - statement.setString(2, providerInformation.getDescription().orElse(null)); + if (providerInformation.getDescription().isPresent()) { + statement.setString(2, providerInformation.getDescription().get()); + } else { + statement.setNull(2, Types.VARCHAR); + } statement.setInt(3, providerInformation.getPriority()); - statement.setString(4, providerInformation.getCondition().orElse(null)); + if (providerInformation.getCondition().isPresent()) { + statement.setString(4, providerInformation.getCondition().orElse(null)); + } else { + statement.setNull(4, Types.VARCHAR); + } statement.setString(5, formatType.name()); - ExtensionTabTable.set3TabValuesToStatement(statement, 6, providerInformation.getTab().orElse(null), providerInformation.getPluginName(), serverUUID); + ExtensionTabTable.set3TabValuesToStatement(statement, 6, providerInformation.getTab().orElse("No Tab"), providerInformation.getPluginName(), serverUUID); ExtensionIconTable.set3IconValuesToStatement(statement, 9, providerInformation.getIcon()); - ExtensionPluginTable.set2PluginValuesToStatement(statement, 11, providerInformation.getPluginName(), serverUUID); - statement.setString(13, providerInformation.getName()); + ExtensionPluginTable.set2PluginValuesToStatement(statement, 12, providerInformation.getPluginName(), serverUUID); + statement.setString(14, providerInformation.getName()); } }; } @@ -114,13 +123,21 @@ public class StoreNumberProviderTransaction extends Transaction { public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, providerInformation.getName()); statement.setString(2, providerInformation.getText()); - statement.setString(3, providerInformation.getDescription().orElse(null)); + if (providerInformation.getDescription().isPresent()) { + statement.setString(3, providerInformation.getDescription().get()); + } else { + statement.setNull(3, Types.VARCHAR); + } statement.setInt(4, providerInformation.getPriority()); - statement.setString(5, providerInformation.getCondition().orElse(null)); + if (providerInformation.getCondition().isPresent()) { + statement.setString(5, providerInformation.getCondition().orElse(null)); + } else { + statement.setNull(5, Types.VARCHAR); + } statement.setString(6, formatType.name()); - ExtensionTabTable.set3TabValuesToStatement(statement, 7, providerInformation.getTab().orElse(null), providerInformation.getPluginName(), serverUUID); + ExtensionTabTable.set3TabValuesToStatement(statement, 7, providerInformation.getTab().orElse("No Tab"), providerInformation.getPluginName(), serverUUID); ExtensionIconTable.set3IconValuesToStatement(statement, 10, providerInformation.getIcon()); - ExtensionPluginTable.set2PluginValuesToStatement(statement, 12, providerInformation.getPluginName(), serverUUID); + ExtensionPluginTable.set2PluginValuesToStatement(statement, 13, providerInformation.getPluginName(), serverUUID); } }; } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreStringProviderTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreStringProviderTransaction.java index a5eca3bd8..fde05ea9f 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreStringProviderTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/providers/StoreStringProviderTransaction.java @@ -27,6 +27,7 @@ import com.djrapitops.plan.extension.implementation.providers.DataProvider; import java.sql.PreparedStatement; import java.sql.SQLException; +import java.sql.Types; import java.util.UUID; import static com.djrapitops.plan.db.sql.parsing.Sql.AND; @@ -81,14 +82,22 @@ public class StoreStringProviderTransaction extends Transaction { @Override public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, providerInformation.getText()); - statement.setString(2, providerInformation.getDescription().orElse(null)); + if (providerInformation.getDescription().isPresent()) { + statement.setString(2, providerInformation.getDescription().get()); + } else { + statement.setNull(2, Types.VARCHAR); + } statement.setInt(3, providerInformation.getPriority()); - statement.setString(4, providerInformation.getCondition().orElse(null)); + if (providerInformation.getCondition().isPresent()) { + statement.setString(4, providerInformation.getCondition().orElse(null)); + } else { + statement.setNull(4, Types.VARCHAR); + } statement.setBoolean(5, playerName); - ExtensionTabTable.set3TabValuesToStatement(statement, 6, providerInformation.getTab().orElse(null), providerInformation.getPluginName(), serverUUID); + ExtensionTabTable.set3TabValuesToStatement(statement, 6, providerInformation.getTab().orElse("No Tab"), providerInformation.getPluginName(), serverUUID); ExtensionIconTable.set3IconValuesToStatement(statement, 9, providerInformation.getIcon()); - ExtensionPluginTable.set2PluginValuesToStatement(statement, 11, providerInformation.getPluginName(), serverUUID); - statement.setString(13, providerInformation.getName()); + ExtensionPluginTable.set2PluginValuesToStatement(statement, 12, providerInformation.getPluginName(), serverUUID); + statement.setString(14, providerInformation.getName()); } }; } @@ -113,13 +122,21 @@ public class StoreStringProviderTransaction extends Transaction { public void prepare(PreparedStatement statement) throws SQLException { statement.setString(1, providerInformation.getName()); statement.setString(2, providerInformation.getText()); - statement.setString(3, providerInformation.getDescription().orElse(null)); + if (providerInformation.getDescription().isPresent()) { + statement.setString(3, providerInformation.getDescription().get()); + } else { + statement.setNull(3, Types.VARCHAR); + } statement.setInt(4, providerInformation.getPriority()); - statement.setString(5, providerInformation.getCondition().orElse(null)); + if (providerInformation.getCondition().isPresent()) { + statement.setString(5, providerInformation.getCondition().orElse(null)); + } else { + statement.setNull(5, Types.VARCHAR); + } statement.setBoolean(6, playerName); - ExtensionTabTable.set3TabValuesToStatement(statement, 7, providerInformation.getTab().orElse(null), providerInformation.getPluginName(), serverUUID); + ExtensionTabTable.set3TabValuesToStatement(statement, 7, providerInformation.getTab().orElse("No Tab"), providerInformation.getPluginName(), serverUUID); ExtensionIconTable.set3IconValuesToStatement(statement, 10, providerInformation.getIcon()); - ExtensionPluginTable.set2PluginValuesToStatement(statement, 12, providerInformation.getPluginName(), serverUUID); + ExtensionPluginTable.set2PluginValuesToStatement(statement, 13, providerInformation.getPluginName(), serverUUID); } }; } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/PlanSystem.java b/Plan/common/src/main/java/com/djrapitops/plan/system/PlanSystem.java index 68c9d3667..b4933f345 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/PlanSystem.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/PlanSystem.java @@ -19,6 +19,7 @@ package com.djrapitops.plan.system; import com.djrapitops.plan.api.PlanAPI; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.data.plugin.HookHandler; +import com.djrapitops.plan.extension.ExtensionService; import com.djrapitops.plan.extension.ExtensionServiceImplementation; import com.djrapitops.plan.system.cache.CacheSystem; import com.djrapitops.plan.system.database.DBSystem; @@ -253,4 +254,8 @@ public class PlanSystem implements SubSystem { public boolean isEnabled() { return enabled; } + + public ExtensionService getExtensionService() { + return extensionService; + } } \ No newline at end of file diff --git a/Plan/common/src/test/java/com/djrapitops/plan/db/CommonDBTest.java b/Plan/common/src/test/java/com/djrapitops/plan/db/CommonDBTest.java index 0bb1e3b0f..1d06e497e 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/db/CommonDBTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/db/CommonDBTest.java @@ -30,6 +30,7 @@ import com.djrapitops.plan.data.store.objects.Nickname; import com.djrapitops.plan.data.time.GMTimes; import com.djrapitops.plan.data.time.WorldTimes; import com.djrapitops.plan.db.access.Executable; +import com.djrapitops.plan.db.access.HasMoreThanZeroQueryStatement; import com.djrapitops.plan.db.access.Query; import com.djrapitops.plan.db.access.queries.*; import com.djrapitops.plan.db.access.queries.containers.ContainerFetchQueries; @@ -44,12 +45,17 @@ import com.djrapitops.plan.db.access.transactions.init.CleanTransaction; import com.djrapitops.plan.db.access.transactions.init.CreateIndexTransaction; import com.djrapitops.plan.db.access.transactions.init.CreateTablesTransaction; import com.djrapitops.plan.db.patches.Patch; +import com.djrapitops.plan.db.sql.tables.ExtensionPlayerValueTable; +import com.djrapitops.plan.extension.DataExtension; +import com.djrapitops.plan.extension.ExtensionServiceImplementation; +import com.djrapitops.plan.extension.annotation.*; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.config.Config; import com.djrapitops.plan.system.settings.config.PlanConfig; +import com.djrapitops.plan.system.settings.paths.DatabaseSettings; import com.djrapitops.plan.system.settings.paths.WebserverSettings; import com.djrapitops.plan.utilities.SHA256Hash; import com.djrapitops.plan.utilities.comparators.DateHolderRecentComparator; @@ -69,6 +75,8 @@ import java.io.File; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; import java.security.NoSuchAlgorithmException; +import java.sql.PreparedStatement; +import java.sql.SQLException; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -104,7 +112,9 @@ public abstract class CommonDBTest { static void handleSetup(String dbName) throws Exception { system = component.getPlanSystem(); - system.getConfigSystem().getConfig().set(WebserverSettings.PORT, TEST_PORT_NUMBER); + PlanConfig config = system.getConfigSystem().getConfig(); + config.set(WebserverSettings.PORT, TEST_PORT_NUMBER); + config.set(DatabaseSettings.TYPE, dbName); system.enable(); dbSystem = system.getDatabaseSystem(); @@ -1015,4 +1025,48 @@ public abstract class CommonDBTest { Map result = db.query(ServerAggregateQueries.serverUserCounts()); assertEquals(expected, result); } + + @Test + public void extensionValuesAreStored() { + ExtensionServiceImplementation extensionService = (ExtensionServiceImplementation) system.getExtensionService(); + + extensionService.register(new TestExtension()); + extensionService.updatePlayerValues(playerUUID, TestConstants.PLAYER_ONE_NAME); + + assertTrue(db.query(new HasMoreThanZeroQueryStatement("SELECT COUNT(1) as c FROM " + ExtensionPlayerValueTable.TABLE_NAME + + " WHERE " + ExtensionPlayerValueTable.USER_UUID + "=?") { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setString(1, playerUUID.toString()); + } + })); + } + + @PluginInfo(name = "TestExtension") + public class TestExtension implements DataExtension { + @NumberProvider(text = "a number") + public long value(UUID playerUUD) { + return 5L; + } + + @BooleanProvider(text = "a boolean") + public boolean boolVal(UUID playerUUID) { + return false; + } + + @DoubleProvider(text = "a double") + public double doubleVal(UUID playerUUID) { + return 0.5; + } + + @PercentageProvider(text = "a percentage") + public double percentageVal(UUID playerUUID) { + return 0.5; + } + + @StringProvider(text = "a string") + public String stringVal(UUID playerUUID) { + return ""; + } + } } diff --git a/Plan/common/src/test/java/com/djrapitops/plan/system/webserver/JSErrorRegressionTest.java b/Plan/common/src/test/java/com/djrapitops/plan/system/webserver/JSErrorRegressionTest.java index 552460fda..148407540 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/system/webserver/JSErrorRegressionTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/system/webserver/JSErrorRegressionTest.java @@ -23,6 +23,7 @@ import com.djrapitops.plan.db.access.transactions.events.SessionEndTransaction; import com.djrapitops.plan.db.access.transactions.events.WorldNameStoreTransaction; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.database.DBSystem; +import com.djrapitops.plan.system.locale.lang.ErrorPageLang; import com.djrapitops.plan.system.settings.config.PlanConfig; import com.djrapitops.plan.system.settings.paths.WebserverSettings; import com.djrapitops.plan.system.webserver.cache.PageId; @@ -113,7 +114,7 @@ public class JSErrorRegressionTest { System.out.println("Testing Player Page via UUID"); WebDriver driver = seleniumDriver.getDriver(); driver.get("http://localhost:" + TEST_PORT_NUMBER + "/player/" + TestConstants.PLAYER_ONE_UUID); - assertFalse(driver.getPageSource(), driver.getPageSource().contains("404 ")); + assertFalse(driver.getPageSource(), driver.getPageSource().contains(ErrorPageLang.NOT_PLAYED_404.getDefault())); } @Test