From 63291caa3e8fc1da360499c6049bd9ab074da8c8 Mon Sep 17 00:00:00 2001 From: sandtechnology <20417547+sandtechnology@users.noreply.github.com> Date: Tue, 3 Oct 2023 21:08:56 +0800 Subject: [PATCH] 5.1.2.5 1.20.2 Support (#406) * Using varchar(128) for world name in database * Replace Rollbar token * Fix event append issue for custom item display * Add 1.20.2 Support * Fix typo for limit comment * Bump to 5.1.2.5 * Improve real display item message * Bump de.tr7zw:item-nbt-api-plugin from 2.11.3 to 2.12.0 (#403) Bumps de.tr7zw:item-nbt-api-plugin from 2.11.3 to 2.12.0. --- updated-dependencies: - dependency-name: de.tr7zw:item-nbt-api-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump me.clip:placeholderapi from 2.11.2 to 2.11.4 (#404) Bumps me.clip:placeholderapi from 2.11.2 to 2.11.4. --- updated-dependencies: - dependency-name: me.clip:placeholderapi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump org.spigotmc:spigot-api (#405) Bumps org.spigotmc:spigot-api from 1.20.1-R0.1-SNAPSHOT to 1.20.2-R0.1-SNAPSHOT. --- updated-dependencies: - dependency-name: org.spigotmc:spigot-api dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] --- pom.xml | 8 ++++---- src/main/java/org/maxgamer/quickshop/QuickShop.java | 4 ++-- .../chat/platform/minedown/BungeeQuickChat.java | 7 +++++++ .../quickshop/database/SimpleDatabaseHelper.java | 9 ++++++--- .../java/org/maxgamer/quickshop/util/GameVersion.java | 1 + .../util/reporter/error/RollbarErrorReporter.java | 2 +- .../quickshop/util/updater/impl/MavenUpdater.java | 2 +- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 3de56cff30..91e4b02630 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ QuickShop - 5.1.2.4 + 5.1.2.5 org.maxgamer.quickshop Ghost-chu UTF-8 @@ -565,7 +565,7 @@ me.clip placeholderapi - 2.11.2 + 2.11.4 provided @@ -627,7 +627,7 @@ org.spigotmc spigot-api - 1.20.1-R0.1-SNAPSHOT + 1.20.2-R0.1-SNAPSHOT provided @@ -886,7 +886,7 @@ de.tr7zw item-nbt-api-plugin - 2.11.3 + 2.12.0 provided diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index a68dfbacc3..a41d1ce4ef 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -236,7 +236,7 @@ public class QuickShop extends JavaPlugin implements QuickShopAPI { @Nullable private AbstractEconomy economy; /** - * Whether or not to limit players shop amounts + * Whether to limit players shop amounts */ private boolean limit = false; @Nullable @@ -500,7 +500,7 @@ private void load3rdParty() { } } if (AbstractDisplayItem.getNowUsing() == DisplayType.REALITEM) { - getLogger().warning("You're using Real Display system and that may cause your server lagg, switch to Virtual Display system if you can!"); + getLogger().warning("You're using Real Display system and that may cause your server lagg, switch to Virtual Display system if you can! (Checkout display-type option in config.yml)"); Plugin clearLagPlugin = Bukkit.getPluginManager().getPlugin("ClearLag"); if (clearLagPlugin != null && Util.verifyClassLoader(clearLagPlugin)) { try { diff --git a/src/main/java/org/maxgamer/quickshop/chat/platform/minedown/BungeeQuickChat.java b/src/main/java/org/maxgamer/quickshop/chat/platform/minedown/BungeeQuickChat.java index 83cfff098e..ca96abbb3c 100644 --- a/src/main/java/org/maxgamer/quickshop/chat/platform/minedown/BungeeQuickChat.java +++ b/src/main/java/org/maxgamer/quickshop/chat/platform/minedown/BungeeQuickChat.java @@ -439,6 +439,13 @@ private ComponentBuilder append(BaseComponent component, ComponentBuilder.Format if (component.isReset() && retention == ComponentBuilder.FormatRetention.ALL) { retention = ComponentBuilder.FormatRetention.EVENTS; } + + //Hacky method to replace dummy components + if (previous == null && builder.getCursor() == -1) { + previous = new TextComponent(""); + builder.append(previous); + } + if (previous != null && (!component.isReset() || retention == ComponentBuilder.FormatRetention.EVENTS)) { component.copyFormatting(previous, retention, false); parts.add(component); diff --git a/src/main/java/org/maxgamer/quickshop/database/SimpleDatabaseHelper.java b/src/main/java/org/maxgamer/quickshop/database/SimpleDatabaseHelper.java index fe97a06b4e..df98d4a618 100644 --- a/src/main/java/org/maxgamer/quickshop/database/SimpleDatabaseHelper.java +++ b/src/main/java/org/maxgamer/quickshop/database/SimpleDatabaseHelper.java @@ -81,9 +81,9 @@ private void init() throws SQLException { */ private void createShopsTable() { - String sqlString = "CREATE TABLE " + manager.getDatabase().getTablePrefix() + "shops (owner VARCHAR(255) NOT NULL, price double(32, 2) NOT NULL, itemConfig TEXT CHARSET utf8 NOT NULL, x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(32) NOT NULL, unlimited boolean, type boolean, PRIMARY KEY (x, y, z, world) );"; + String sqlString = "CREATE TABLE " + manager.getDatabase().getTablePrefix() + "shops (owner VARCHAR(255) NOT NULL, price double(32, 2) NOT NULL, itemConfig TEXT CHARSET utf8 NOT NULL, x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(128) NOT NULL, unlimited boolean, type boolean, PRIMARY KEY (x, y, z, world) );"; if (manager.getDatabase() instanceof MySQLCore) { - sqlString = "CREATE TABLE " + manager.getDatabase().getTablePrefix() + "shops (owner VARCHAR(255) NOT NULL, price double(32, 2) NOT NULL, itemConfig TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(32) NOT NULL, unlimited boolean, type boolean, PRIMARY KEY (x, y, z, world) );"; + sqlString = "CREATE TABLE " + manager.getDatabase().getTablePrefix() + "shops (owner VARCHAR(255) NOT NULL, price double(32, 2) NOT NULL, itemConfig TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(128) NOT NULL, unlimited boolean, type boolean, PRIMARY KEY (x, y, z, world) );"; } manager.runInstantTask(new DatabaseTask(sqlString)); } @@ -111,7 +111,7 @@ private void createLogsTable() { private void createExternalCacheTable() { String createTable = "CREATE TABLE " + manager.getDatabase().getTablePrefix() - + "external_cache (x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(32) NOT NULL, PRIMARY KEY (x, y, z, world));"; + + "external_cache (x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(128) NOT NULL, PRIMARY KEY (x, y, z, world));"; manager.runInstantTask(new DatabaseTask(createTable)); createColumn("external_cache", "space", new DataType(DataTypeMapping.INT, null)); createColumn("external_cache", "stock", new DataType(DataTypeMapping.INT, null)); @@ -151,6 +151,9 @@ public void onFailed(SQLException e) { manager.runInstantTask(new DatabaseTask("ALTER TABLE " + manager.getDatabase().getTablePrefix() + "shops TO CHARACTER SET uft8mb4 COLLATE utf8mb4_general_ci", checkTask)); manager.runInstantTask(new DatabaseTask("ALTER TABLE " + manager.getDatabase().getTablePrefix() + "messages TO CHARACTER SET uft8mb4 COLLATE utf8mb4_general_ci", checkTask)); manager.runInstantTask(new DatabaseTask("ALTER TABLE " + manager.getDatabase().getTablePrefix() + "history TO CHARACTER SET uft8mb4 COLLATE utf8mb4_general_ci", checkTask)); + //Using varchar 128 for world name + manager.runInstantTask(new DatabaseTask("ALTER TABLE " + manager.getDatabase().getTablePrefix() + "shops MODIFY COLUMN world VARCHAR(128)", checkTask)); + manager.runInstantTask(new DatabaseTask("ALTER TABLE " + manager.getDatabase().getTablePrefix() + "external_cache MODIFY COLUMN world VARCHAR(128)", checkTask)); } plugin.getLogger().info("Finished!"); } diff --git a/src/main/java/org/maxgamer/quickshop/util/GameVersion.java b/src/main/java/org/maxgamer/quickshop/util/GameVersion.java index cc45d980cf..958348c0e8 100644 --- a/src/main/java/org/maxgamer/quickshop/util/GameVersion.java +++ b/src/main/java/org/maxgamer/quickshop/util/GameVersion.java @@ -67,6 +67,7 @@ public enum GameVersion { v1_19_R2(true, false, true, true, true, true), v1_19_R3(true, false, true, true, true, true), v1_20_R1(true, false, true, true, true, true), + v1_20_R2(true, false, true, true, true, true), UNKNOWN(true, false, false, true, true, true); /** diff --git a/src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java b/src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java index 36840db2af..5336613454 100644 --- a/src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java +++ b/src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java @@ -68,7 +68,7 @@ public class RollbarErrorReporter implements IErrorReporter { public RollbarErrorReporter(@NotNull QuickShop plugin) { this.plugin = plugin; - Config config = ConfigBuilder.withAccessToken("164c5246fa464ae4a6a0867a856d4062") + Config config = ConfigBuilder.withAccessToken("c386df69d08440d9a3d982cf98b53ed6") .environment(Util.isDevEdition() ? "development" : "production") .platform(plugin.getServer().getVersion()) .codeVersion(QuickShop.getVersion()) diff --git a/src/main/java/org/maxgamer/quickshop/util/updater/impl/MavenUpdater.java b/src/main/java/org/maxgamer/quickshop/util/updater/impl/MavenUpdater.java index ce0de4ab5f..92ab45da7b 100644 --- a/src/main/java/org/maxgamer/quickshop/util/updater/impl/MavenUpdater.java +++ b/src/main/java/org/maxgamer/quickshop/util/updater/impl/MavenUpdater.java @@ -252,7 +252,7 @@ static class IndexMetaHandler extends DefaultHandler { @Override public void endElement(String uri, String localName, String qName) { switch (qName) { - case "latest": + case "release": latestRelease = tempStr; break; case "lastUpdated":