From 4fd9059efb871901980af6ee24e3c3f6e98f1bcf Mon Sep 17 00:00:00 2001 From: Daniel V Date: Tue, 16 Jul 2024 20:38:45 -0400 Subject: [PATCH 01/11] update translations manually to reset crowdin --- crowdin/lang/cs-CZ/messages.yml | 4 +- crowdin/lang/es-ES/messages.yml | 100 ++++++++++++++++---------------- crowdin/lang/fa-IR/example.yml | 2 +- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/crowdin/lang/cs-CZ/messages.yml b/crowdin/lang/cs-CZ/messages.yml index fe6b0b40a7..6909b1fdf7 100644 --- a/crowdin/lang/cs-CZ/messages.yml +++ b/crowdin/lang/cs-CZ/messages.yml @@ -88,7 +88,7 @@ reloading-status: scheduled: Obnovení dokončeno. (Může chvíli trvat, než se změny projeví) require-restart: Obnovení dokončeno. (Změny vyžadují restartování serveru) failed: Obnovení selhalo, zkontrolujte konzoli serveru -player-bought-from-your-store-tax: {0} purchased {1} {2} from your shop and you earned {3} ({4} in taxes). +player-bought-from-your-store-tax: {0} koupil {1} {2} z vašeho obchodu a vy jste vydělali {3} ({4} daně). not-enough-space: Zbývá ti jen {0} volných míst! shop-name-success: Název obchodu byl úspěšně nastaven na {0}. shop-staff-added: Uživatel {0} byl úspěšně přidán do vašeho obchodu. @@ -243,7 +243,7 @@ tableformat: quickshop-gui-preview: Náhled GUI položky v QuickShopu translate-not-completed-yet-click: Překlad jazyka {0} ještě nebyl dokončen uživatelem {1}. Chcete nám pomoci zlepšit překlad? Klikněte zde! taxaccount-invalid: Cílový účet není platný, zadejte prosím platné jméno hráče nebo uuid(s pomlčkami). -player-bought-from-your-store: System {0} zakoupil {1} {2} z tvého obchodu a ty jsi zaplatil {3} na daních. +player-bought-from-your-store: {0} si koupil {1} {2} z vašeho obchodu a získali jste {3}. reached-maximum-can-create: System Již jste vytvořili maximum {0}/{1} obchodů! reached-maximum-create-limit: Dosáhli jste maximálního počtu obchodů, které můžete vytvořit translation-version: 'Verze podpory: Hikari' diff --git a/crowdin/lang/es-ES/messages.yml b/crowdin/lang/es-ES/messages.yml index cea10c9669..ec7d81b2c2 100644 --- a/crowdin/lang/es-ES/messages.yml +++ b/crowdin/lang/es-ES/messages.yml @@ -53,7 +53,7 @@ quick-fill: entry-cooperation: ' - [co] {0} {1}' 3rd-plugin-build-check-failed-admin: '(AdminOnly) {0} denegó las comprobaciones de permisos, si esto no está excepcionado, intente añadir {1} a la lista negra de escucha. Configurar Guía: https://github.com/Ghost-chu/QuickShop-Hikari/wiki/Use-protection-listener-filter' average-price-nearby: 'Precio medio en esta zona: {0}' -inventory-check-global-alert: "[Inventory Check] Warning! Found a QuickShop display item {2} in inventory at {0} [{1}], which it shouldn't happened, This usually means that someone is maliciously exploiting the exploit to duplicating the display item." +inventory-check-global-alert: "[[Inventory Check] ¡Aviso! Encontró un elemento de QuickShop {2} en inventario en {0} [{1}], que no debería ocurrir, Esto generalmente significa que alguien está explotando malintencionadamente el exploit para duplicar el elemento de visualización." digits-reach-the-limit: Has alcanzado el límite de decimales en el precio. currency-unset: Divisa de la tienda ha sido removida con éxito. Usando la configuración predeterminada ahora. you-cant-create-shop-in-there: No tienes permiso para crear una tienda en este lugar. @@ -88,14 +88,14 @@ reloading-status: scheduled: Recarga completada. (Algunos cambios requieren un tiempo para hacer efecto) require-restart: Recarga completada. (Algunos cambios requieren un reinicio del servidor para hacer efecto) failed: Recarga fallida, comprueba la consola del servidor -player-bought-from-your-store-tax: {0} purchased {1} {2} from your shop and you earned {3} ({4} in taxes). +player-bought-from-your-store-tax: {0} Comprado {1} {2} de tu tienda y ganaste {3} ({4} en impuestos). not-enough-space: ¡Sólo tienes sitio para {0} más! shop-name-success: Nombre de la tienda establecido a {0}. shop-staff-added: Agregado a {0} como personal de tu tienda con éxito. -shop-staff-empty: This shop have no staff members. +shop-staff-empty: Esta tienda no tiene personal. shops-recovering: Recuperando tiendas desde la copia de seguridad... -virtual-player-component-hover: "This is a virtual player.\nRefers to a system account of this name with the same name.\nUUID: {0}\nUsername: {1}\nDisplay as: {2}" -real-player-component-hover: "This is a real exists player.\nUUID: {0}\nUsername: {1}\nDisplay as: {2}\nIf you wish to use a virtual system account with the same name, add \"[]\" to the both side of the username: [{1}]." +virtual-player-component-hover: "Este es un jugador virtual.\nHace referencia a una cuenta del sistema con este nombre con el mismo nombre.\nUUID: {0}\nNombre de usuario: {1}\nMostrar como: {2}" +real-player-component-hover: "Este es un jugador que existe realmente.\nUUID: {0}\nNombre de usuario: {1}\nMostrar como: {2}\nSi desea utilizar una cuenta de sistema virtual con el mismo nombre, agregue \"[]\" a ambos lados del nombre de usuario: [{1}]." menu: sell-tax: Pagaste {0} en impuestos. owner: 'Propietario: {0}' @@ -123,7 +123,7 @@ menu: total-value-of-chest: 'Valor total del cofre: {0}' currency-not-exists: No se puede encontrar la divisa que quieres establecer, tal vez sea mala ortografía o esa moneda no está disponible en este mundo. no-nearby-shop: No hay ninguna tienda en la zona que coincida con {0}. -translation-author: 'Ghost_chu, Andre_601' +translation-author: 'Ghost_chu, Andre_601, alexbm0' integrations-check-failed-trade: La integración {0} impide la creación de la tienda shop-transaction-failed: Sorry, but an internal error occurred while processing your purchase. The purchase has been cancelled and any operation has been rollback. Please contact the server administrators if it keeping occurred. success-change-owner-to-server: Establecido exitosamente el dueño de la tienda al Servidor. @@ -175,8 +175,8 @@ unknown-player: Dicho jugador no existe, por favor revisa el nombre de usua player-offline: The target player currently is offline. player-profile-format: {0}({1}) shop-type: - selling: SELLING - buying: BUYING + selling: VENTA + buying: COMPRA language: qa-issues: 'Problemas de garantía de calidad: {0}%' code: 'Código: {0}' @@ -252,9 +252,9 @@ price-too-cheap: El precio debe ser mayor a ${0} shop-not-exist: No hay ninguna tienda. bad-command-usage: ¡Argumentos incorrectos! cleanghost-warning: This command will purge all shops if the shop is corrupted, was created in not allowed worlds, is selling/buying not allowed items or EXISTS IN A UNLOADED WORLD. Make sure to create a full backup of your shop data first and use /qs cleanghost confirm to continue. -cleanghost-starting: Starting to check for ghost shops (missing container blocks). All non-existing shops will be removed... -cleanghost-deleting: Found a corrupted shop {0} because {1}, mark it to delete... -cleanghost-deleted: Total {0} shops have been deleted. +cleanghost-starting: Empezando a comprobar si hay tiendas fantasma (faltan bloques de contenedores). Se eliminarán todas las tiendas que no existan... +cleanghost-deleting: Has encontrado una tienda corrupta {0} porque {1}, márcalo para eliminarlo... +cleanghost-deleted: Total {0} Las tiendas han sido eliminadas. shop-purchase-cancelled: Compra cancelada. bypassing-lock: ¡Omitiendo el bloqueo de una QuickShop! bungee-cross-server-msg: 'Tienda Rápida CSM: {0}' @@ -362,39 +362,39 @@ controlpanel: mode-selling-hover: Click para cambiar a modo de COMPRA. empty-hover: Click para limpiar el inventario de la tienda. toggledisplay: 'Display-Item: {0} [Toggle]' - history: 'History: [View]' - history-hover: Click to view shop history logs + history: 'Historial: [Ver]' + history-hover: Haga clic para ver los registros del historial de la tienda timeunit: - behind: behind - week: "{0} week" - weeks: "{0} weeks" - year: "{0} year" - before: before - scheduled: scheduled - years: "{0} years" - scheduled-in: scheduled in {0} - second: "{0} second" - std-past-format: '{5}{4}{3}{2}{1}{0}ago' + behind: atrás + week: "{0} semana" + weeks: "{0} Semanas" + year: "{0} año" + before: antes + scheduled: programado + years: "{0} años" + scheduled-in: programado en {0} + second: "{0} segundo" + std-past-format: '{5}{4}{3}{2}{1}{0}hace' std-time-format: HH:mm:ss - seconds: "{0} seconds" - hour: "{0} hour" - scheduled-at: scheduled at {0} - after: after - day: "{0} day" - recent: recent - between: between - hours: "{0} hours" - months: "{0} months" - longtimeago: long time ago - between-format: between {0} and {1} - minutes: "{0} minutes" + seconds: "{0} segundos" + hour: "{0} hora" + scheduled-at: programado en {0} + after: después + day: "{0} día" + recent: reciente + between: entre + hours: "{0} horas" + months: "{0} meses" + longtimeago: hace mucho tiempo + between-format: entre {0} y {1} + minutes: "{0} minutos" justnow: justo ahora - minute: "{0} minute" + minute: "{0} minuto" std-format: MM/dd/yyyy HH:mm:ss - future-plain-text: future - month: "{0} month" + future-plain-text: futuro + month: "{0} mes" future: en {0} - days: "{0} days" + days: "{0} días" command: reloading: 'Configuration reloaded. Some changes may require reboot to affect. (Notice: Reloading behavior has been changed after 4.0.9.10, we now only reload configuration but not whole plugin to ensure the server won''t crashed.)' description: @@ -433,7 +433,7 @@ command: unban: Banear a un jugador de la tienda transfer: Transferir TODAS las tiendas de alguien a otros transferall: Transferir TODAS las tiendas de alguien a otros - transferownership: Transfer the shop you're looking at to someone else + transferownership: Transfiere la tienda que estás viendo a otra persona size: Cambiar cantidad de artículos por stack de una tienda supercreate: '&Crear una tienda circunvalando todas las comprobaciones de seguridad' taxaccount: Configure la cuenta de impuestos que compra usando @@ -442,11 +442,11 @@ command: permission: Gestión de permisos de la tienda lookup: Administrar tabla de elementos consultables database: View and maintain QuickShop database - benefit: Settings of divide benefits between shop owner and other players - tag: Add, remove or query tags of a shop - suggestprice: Suggest a recommend price for looking shop, based on other shops - history: View the history transactions of a shop - sign: Change the sign material of a shop + benefit: Configuración de dividir los beneficios entre el dueño de la tienda y otros jugadores + tag: Añadir, eliminar o consultar etiquetas de una tienda + suggestprice: Sugerir un precio recomendado para mostrar en la tienda, basado en otras tiendas + history: Ver el historial de transacciones de una tienda + sign: Cambiar el material de señal de una tienda bulk-size-not-set: 'Usa: /qs size ' no-type-given: 'Uso: /qs find ' feature-not-enabled: La característica no está habilitada en la configuración. @@ -519,8 +519,8 @@ permission: set-stack-amount: Permiso para permitir a los usuarios que tienen esto establecer la cantidad de la pila de la tienda. set-currency: Permiso para permitir a los usuarios que tienen esto establecer la moneda de la tienda. set-name: Permiso para permitir a los usuarios que tienen esto establecer el nombre de la tienda. - set-sign-type: Change the sign material that attached on the shop. - view-purchase-logs: Permission to view shop purchase logs. + set-sign-type: Cambia la etiqueta del material que se asignó a la tienda. + view-purchase-logs: Permiso para ver los registros de compras de la tienda. group: everyone: Default group for all users excepted shop owner. staff: System group for shop staffs. @@ -547,14 +547,14 @@ successfully-set-player-group: Se ha establecido correctamente el grupo d successfully-unset-player-group: Successfully remove player group in this shop. successfully-set-player-permission: Se ha establecido correctamente el permiso {1} al jugador{0} en la tienda {2}. lookup-item-created: An item named {0} has been created in the lookup table. You can refer this item in configurations now. -lookup-item-exists: An item named {0} already exists in the lookup table, delete it or pick another name. +lookup-item-exists: Un elemento llamado {0} ya existe en la tabla de búsqueda, elimínela o elija otro nombre. lookup-item-not-found: An item named {0} not exists. lookup-item-name-illegal: Item name illegal. Only alphanumeric characters and underscores are allowed. -lookup-item-name-regex: 'The name must match this regex: {0}.' +lookup-item-name-regex: 'El nombre debe coincidir con esta expresión regular: {0}.' lookup-item-test-not-found: 'Test: The item in your hand not registered in lookup table.' lookup-item-test-found: 'Test: The item in your hand was registered as name {0} in lookup table.' lookup-item-removed: The specified item {0} has been successfully removed from lookup table. -internal-error: An internal error occurred, please contact the server administrator. +internal-error: Se ha producido un error interno, póngase en contacto con el administrador del servidor. argument-cannot-be: The argument {0} cannot be {1}. argument-must-between: The argument {0} value must between {1} and {2} invalid-percentage: Percentage invalid, you must add '%' after the number of percentage. diff --git a/crowdin/lang/fa-IR/example.yml b/crowdin/lang/fa-IR/example.yml index 59f4891a27..a9e8c4c273 100644 --- a/crowdin/lang/fa-IR/example.yml +++ b/crowdin/lang/fa-IR/example.yml @@ -1,3 +1,3 @@ example1: example2: - test: "This is a test file for testing the REST response of Crowdin distribution feature, please ignore this file!" + test: "این یک فایل ازمایشی برای ازمایش پاسخ REST از ویژگی توزیع Crowdin است، لطفا این فایل را نادیده بگیرید!" From 31887e3527eebe1a0c2d87c9f066e937efc1c671 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Fri, 23 Aug 2024 20:22:20 -0400 Subject: [PATCH 02/11] Update typo in worldguard compatibility. --- .../com/ghostchu/quickshop/compatibility/worldguard/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compatibility/worldguard/src/main/java/com/ghostchu/quickshop/compatibility/worldguard/Main.java b/compatibility/worldguard/src/main/java/com/ghostchu/quickshop/compatibility/worldguard/Main.java index 57ccb546e2..6ac3b0e552 100644 --- a/compatibility/worldguard/src/main/java/com/ghostchu/quickshop/compatibility/worldguard/Main.java +++ b/compatibility/worldguard/src/main/java/com/ghostchu/quickshop/compatibility/worldguard/Main.java @@ -60,7 +60,7 @@ public void onLoad() { Bukkit.getPluginManager().disablePlugin(this); return; } - existing = registry.get("quickshophikari-reade"); + existing = registry.get("quickshophikari-trade"); if (existing instanceof StateFlag tradeFlag) { this.tradeFlag = tradeFlag; } else { From 165ac083fd20907af4914b64f6a562b6db365fb9 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Sun, 25 Aug 2024 08:43:40 -0400 Subject: [PATCH 03/11] Remove outdated platform spec. --- .../pom.xml | 132 ------------------ .../spigot/v1_21_1/Spigot1211Platform.java | 132 ------------------ pom.xml | 1 - 3 files changed, 265 deletions(-) delete mode 100644 platform/quickshop-platform-spigot-v1_21_1_R1/pom.xml delete mode 100644 platform/quickshop-platform-spigot-v1_21_1_R1/src/main/java/com/ghostchu/quickshop/platform/spigot/v1_21_1/Spigot1211Platform.java diff --git a/platform/quickshop-platform-spigot-v1_21_1_R1/pom.xml b/platform/quickshop-platform-spigot-v1_21_1_R1/pom.xml deleted file mode 100644 index b28128e74b..0000000000 --- a/platform/quickshop-platform-spigot-v1_21_1_R1/pom.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - 4.0.0 - - - com.ghostchu - quickshop-hikari - 6.2.0.7 - ../../pom.xml - - - quickshop-platform-spigot-v1_21_1_R1 - takari-jar - - quickshop-platform-spigot-v1_21_1_R1 - - - - - - net.md-5 - specialsource-maven-plugin - 2.0.3 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:1.21.1-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:1.21.1-R0.1-SNAPSHOT:jar:remapped-mojang - - true - remapped-obf - - - - package - - remap - - remap-spigot - - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - - org.spigotmc:minecraft-server:1.21.1-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.21.1-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.13.0 - - true - true - 21 - 21 - - - - io.takari.maven.plugins - takari-lifecycle-plugin - 2.1.6 - true - - proc - 21 - 21 - true - - - - - - src/main/resources - true - - - - - - - nms-repo - https://repo.codemc.io/repository/nms/ - - - CodeMC - https://repo.codemc.io/repository/maven-public/ - - - - - - com.ghostchu - quickshop-platform-spigot-abstract - ${project.parent.version} - compile - - - org.spigotmc - spigot - 1.21.1-R0.1-SNAPSHOT - remapped-mojang - provided - true - - - de.tr7zw - item-nbt-api-plugin - 2.13.1 - provided - - - * - * - - - - - diff --git a/platform/quickshop-platform-spigot-v1_21_1_R1/src/main/java/com/ghostchu/quickshop/platform/spigot/v1_21_1/Spigot1211Platform.java b/platform/quickshop-platform-spigot-v1_21_1_R1/src/main/java/com/ghostchu/quickshop/platform/spigot/v1_21_1/Spigot1211Platform.java deleted file mode 100644 index c72a251d23..0000000000 --- a/platform/quickshop-platform-spigot-v1_21_1_R1/src/main/java/com/ghostchu/quickshop/platform/spigot/v1_21_1/Spigot1211Platform.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.ghostchu.quickshop.platform.spigot.v1_21_1; - -import com.ghostchu.quickshop.platform.Platform; -import com.ghostchu.quickshop.platform.spigot.AbstractSpigotPlatform; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.event.HoverEvent; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; -import net.minecraft.core.component.DataComponents; -import net.minecraft.world.item.component.ItemLore; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.command.Command; -import org.bukkit.craftbukkit.v1_21_R1.CraftServer; -import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Collection; -import java.util.List; - -public class Spigot1211Platform extends AbstractSpigotPlatform implements Platform { - - public Spigot1211Platform(@NotNull Plugin plugin) { - super(plugin); - } - - @Override - public @NotNull Component setItemStackHoverEvent(@NotNull Component oldComponent, @NotNull ItemStack stack) { - return oldComponent.hoverEvent(HoverEvent.showText(Component.text("Click to preview the item") - .appendNewline() - .append(Component.text("× Item hover preview are not available at this time (Spigot 1.20.5+) due major item nbt related changes.").color(NamedTextColor.RED)) - .appendNewline() - .append(Component.text("💡 Consider switch to Paper to use PaperAPI instead.").color(NamedTextColor.GRAY)))); - - } - - @Override - public @NotNull String getMinecraftVersion() { - try { - return ((CraftServer) Bukkit.getServer()).getServer().getServerVersion(); - } catch (Exception e) { - return super.getMinecraftVersion(); - } - } - - @Override - public void registerCommand(@NotNull String prefix, @NotNull Command command) { - ((CraftServer) Bukkit.getServer()).getCommandMap().register(prefix, command); - command.register(((CraftServer) Bukkit.getServer()).getCommandMap()); - ((CraftServer) Bukkit.getServer()).syncCommands(); - } - - @Override - public @NotNull String getTranslationKey(@NotNull Material material) { - return postProcessingTranslationKey(material.getTranslationKey()); - } - - @Override - public void setDisplayName(@NotNull ItemStack stack, @Nullable Component component) { - net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(stack); - if (component == null) { - nmsItemStack.remove(DataComponents.CUSTOM_NAME); - return; - } - String json = GsonComponentSerializer.gson().serialize(component); - nmsItemStack.set(DataComponents.CUSTOM_NAME, - net.minecraft.network.chat.Component.Serializer - .fromJson(json, - ((CraftServer) Bukkit.getServer()) - .getServer() - .registryAccess())); - stack.setItemMeta(CraftItemStack.asBukkitCopy(nmsItemStack).getItemMeta()); - } - - - @Override - public void setLore(@NotNull ItemStack stack, @NotNull Collection components) { - net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(stack); - if (components.isEmpty()) { - nmsItemStack.remove(DataComponents.LORE); - } else { - List componentsList = components.stream() - .map(c -> GsonComponentSerializer.gson().serialize(c)) - .map(json -> (net.minecraft.network.chat.Component) - net.minecraft.network.chat.Component.Serializer - .fromJson(json, - ((CraftServer) Bukkit.getServer()) - .getServer() - .registryAccess())) - .toList(); - nmsItemStack.set(DataComponents.LORE, new ItemLore(componentsList)); - } - stack.setItemMeta(CraftItemStack.asBukkitCopy(nmsItemStack).getItemMeta()); - } - - private String postProcessingTranslationKey(String key) { - return this.translationMapping.getOrDefault(key, key); - } - - @Override - public @NotNull String getTranslationKey(@NotNull EntityType type) { - //noinspection deprecation - return postProcessingTranslationKey(type.getTranslationKey()); -// Optional> op = net.minecraft.world.entity.EntityType.byString(type.getKey().toString()); -// if (op.isPresent()) { -// return postProcessingTranslationKey(op.get().getDescriptionId()); -// } else { -// return postProcessingTranslationKey("entity." + type.getKey()); -// } - } - - @Override - public @NotNull String getTranslationKey(@NotNull PotionEffectType potionEffectType) { - return postProcessingTranslationKey(potionEffectType.getTranslationKey()); - } - - @Override - public @NotNull String getTranslationKey(@NotNull Enchantment enchantment) { - return postProcessingTranslationKey(enchantment.getTranslationKey()); - } - - @Override - public @NotNull String getTranslationKey(@NotNull ItemStack stack) { - return postProcessingTranslationKey(stack.getTranslationKey()); - } -} diff --git a/pom.xml b/pom.xml index 013970860e..bbe64e8343 100644 --- a/pom.xml +++ b/pom.xml @@ -407,7 +407,6 @@ platform/quickshop-platform-spigot-v1_20_R3 platform/quickshop-platform-spigot-v1_20_R4 platform/quickshop-platform-spigot-v1_21_R1 - platform/quickshop-platform-spigot-v1_21_1_R1 platform/quickshop-platform-spigot-v1_21_R2 platform/quickshop-platform-paper quickshop-bukkit From 4b3c1c33634fa70450f425e0774fde503167bab1 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 2 Nov 2024 01:28:17 -0400 Subject: [PATCH 04/11] Start fully implementing encoded column to overhaul serialization of items. --- .../api/database/bean/DataRecord.java | 3 +++ .../quickshop/database/DataTables.java | 2 +- .../database/SimpleDatabaseHelperV2.java | 15 ++++++++------- .../database/bean/SimpleDataRecord.java | 19 +++++++++++++++---- .../quickshop/shop/ContainerShop.java | 15 ++++++++------- .../ghostchu/quickshop/shop/ShopLoader.java | 17 +++++++++++------ 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/quickshop-api/src/main/java/com/ghostchu/quickshop/api/database/bean/DataRecord.java b/quickshop-api/src/main/java/com/ghostchu/quickshop/api/database/bean/DataRecord.java index 1538832c65..927776e6bf 100644 --- a/quickshop-api/src/main/java/com/ghostchu/quickshop/api/database/bean/DataRecord.java +++ b/quickshop-api/src/main/java/com/ghostchu/quickshop/api/database/bean/DataRecord.java @@ -26,6 +26,9 @@ public interface DataRecord { @NotNull String getItem(); + @NotNull + String getEncoded(); + @Nullable String getName(); diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/DataTables.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/DataTables.java index 395d130401..1e584e766f 100644 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/DataTables.java +++ b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/DataTables.java @@ -27,7 +27,7 @@ public enum DataTables { table.addColumn("owner", "VARCHAR(128) NOT NULL"); // SHOP DATA OWNER (ALL-ZERO if this is a server shop) table.addColumn("item", "TEXT NOT NULL"); // SHOP DATA ITEM INFO - //table.addColumn("new_item", "TEXT NOT NULL"); // SHOP DATA ITEM INFO + table.addColumn("encoded", "TEXT NOT NULL"); // SHOP DATA ITEM INFO table.addColumn("name", "TEXT"); // SHOP NAME table.addColumn("type", "INT NOT NULL DEFAULT 0"); // SHOP TYPE (see ShopType enum) diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java index ab27125b72..a9c9d11ccc 100644 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java +++ b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java @@ -59,7 +59,7 @@ public class SimpleDatabaseHelperV2 implements DatabaseHelper { @NotNull private final String prefix; - private final int LATEST_DATABASE_VERSION = 16; + private final int LATEST_DATABASE_VERSION = 17; public SimpleDatabaseHelperV2(@NotNull final QuickShop plugin, @NotNull final SQLManager manager, @NotNull final String prefix) throws Exception { @@ -213,14 +213,14 @@ private void upgradeBenefit() { return manager; } - private void addNewItemColumn() { + private void addEncodedColumn() { fastBackup(); try { getManager().alterTable(DataTables.DATA.getName()) - .addColumn("new_item", "TEXT NOT NULL") + .addColumn("encoded", "TEXT NOT NULL") .execute(); } catch(final SQLException e) { - Log.debug("Failed to add new_item " + DataTables.DATA.getName() + "! Err:" + e.getMessage()); + Log.debug("Failed to add encoded " + DataTables.DATA.getName() + "! Err:" + e.getMessage()); } } @@ -990,11 +990,12 @@ public void upgrade() { parent.makeBackup(); currentDatabaseVersion = 16; } - /*if(currentDatabaseVersion == 16) { + + if(currentDatabaseVersion == 16) { logger.info("Data upgrading: Creating a new column... new_item for enhanced item storage."); - parent.addNewItemColumn(); + parent.addEncodedColumn(); currentDatabaseVersion = 17; - }*/ + } parent.setDatabaseVersion(currentDatabaseVersion).join(); } diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/bean/SimpleDataRecord.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/bean/SimpleDataRecord.java index 3572b96caf..4f7a42a756 100644 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/bean/SimpleDataRecord.java +++ b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/bean/SimpleDataRecord.java @@ -20,6 +20,7 @@ public class SimpleDataRecord implements DataRecord { private final QUser owner; private final String item; + private final String encoded; private final String name; private final int type; private final String currency; @@ -35,11 +36,15 @@ public class SimpleDataRecord implements DataRecord { private final String benefit; - public SimpleDataRecord(final QUser owner, final String item, final String name, final int type, final String currency, final double price, final boolean unlimited, final boolean hologram, final QUser taxAccount, final String permissions, final String extra, final String inventoryWrapper, final String inventorySymbolLink, final Date createTime, final String benefit) { + public SimpleDataRecord(final QUser owner, final String item, final String encoded, final String name, + final int type, final String currency, final double price, final boolean unlimited, + final boolean hologram, final QUser taxAccount, final String permissions, + final String extra, final String inventoryWrapper, final String inventorySymbolLink, + final Date createTime, final String benefit) { this.owner = owner; this.item = item; - //this.newItem = newItem; + this.encoded = encoded; this.name = name; this.type = type; this.currency = currency; @@ -59,7 +64,7 @@ public SimpleDataRecord(final PlayerFinder finder, final ResultSet set) throws S this.owner = QUserImpl.deserialize(finder, set.getString("owner"), QuickExecutor.getSecondaryProfileIoExecutor()); this.item = set.getString("item"); - //this.newItem = set.getString("new_item"); + this.encoded = set.getString("encoded"); this.name = set.getString("name"); this.type = set.getInt("type"); this.currency = set.getString("currency"); @@ -90,7 +95,7 @@ public Map generateParams() { final Map map = new LinkedHashMap<>(); map.put("owner", owner.serialize()); map.put("item", item); - //map.put("new_item", newItem); + map.put("encoded", encoded); map.put("name", name); map.put("type", type); map.put("currency", currency); @@ -147,6 +152,12 @@ public String getCurrency() { return item; } + @Override + public @NotNull String getEncoded() { + + return encoded; + } + @Override public String getName() { diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ContainerShop.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ContainerShop.java index c98be6116d..b8da49ffb9 100644 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ContainerShop.java +++ b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ContainerShop.java @@ -4,18 +4,18 @@ import com.ghostchu.quickshop.QuickShop; import com.ghostchu.quickshop.ServiceInjector; import com.ghostchu.quickshop.api.economy.Benefit; -import com.ghostchu.quickshop.api.event.modification.ShopAuthorizeCalculateEvent; -import com.ghostchu.quickshop.api.event.modification.ShopClickEvent; -import com.ghostchu.quickshop.api.event.inventory.ShopInventoryCalculateEvent; -import com.ghostchu.quickshop.api.event.inventory.ShopInventoryChangedEvent; import com.ghostchu.quickshop.api.event.details.ShopItemChangeEvent; -import com.ghostchu.quickshop.api.event.modification.ShopLoadEvent; import com.ghostchu.quickshop.api.event.details.ShopOwnerNameGettingEvent; import com.ghostchu.quickshop.api.event.details.ShopPlayerGroupSetEvent; -import com.ghostchu.quickshop.api.event.general.ShopSignUpdateEvent; +import com.ghostchu.quickshop.api.event.details.ShopTypeChangeEvent; import com.ghostchu.quickshop.api.event.economy.ShopTaxAccountChangeEvent; import com.ghostchu.quickshop.api.event.economy.ShopTaxAccountGettingEvent; -import com.ghostchu.quickshop.api.event.details.ShopTypeChangeEvent; +import com.ghostchu.quickshop.api.event.general.ShopSignUpdateEvent; +import com.ghostchu.quickshop.api.event.inventory.ShopInventoryCalculateEvent; +import com.ghostchu.quickshop.api.event.inventory.ShopInventoryChangedEvent; +import com.ghostchu.quickshop.api.event.modification.ShopAuthorizeCalculateEvent; +import com.ghostchu.quickshop.api.event.modification.ShopClickEvent; +import com.ghostchu.quickshop.api.event.modification.ShopLoadEvent; import com.ghostchu.quickshop.api.event.modification.ShopUnloadEvent; import com.ghostchu.quickshop.api.event.modification.ShopUpdateEvent; import com.ghostchu.quickshop.api.inventory.InventoryWrapper; @@ -1629,6 +1629,7 @@ public void setShopBenefit(@NotNull final Benefit benefit) { return new SimpleDataRecord( getOwner(), Util.serialize(getItem()), + plugin.getPlatform().encodeStack(getItem()), getShopName(), getShopType().toID(), getCurrency(), diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java index 9c9f9855e0..236e03a136 100644 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java +++ b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java @@ -107,7 +107,7 @@ public void loadShops(@Nullable final String worldName) { Util.mainThreadRun(()->shopsLoadInNextTick.forEach(shop->{ try { plugin.getShopManager().loadShop(shop); - } catch(Throwable e) { + } catch(final Throwable e) { plugin.logger().error("Failed to load shop {}.", shop.getShopId(), e); } })); @@ -188,7 +188,7 @@ private ShopLoadResult loadSingleShop(final InfoRecord infoRecord, final DataRec rawInfo.getName(), rawInfo.getPermissions(), rawInfo.getBenefits()); - } catch(Exception e) { + } catch(final Exception e) { if(e instanceof IllegalStateException) { plugin.logger().warn("Failed to load the shop, skipping...", e); } @@ -310,6 +310,7 @@ public static class DataRawDatabaseInfo { private String invSymbolLink; private long createTime; private ItemStack item; + private ItemStack newItem; private boolean needUpdate = false; private Benefit benefits; @@ -342,6 +343,10 @@ public static class DataRawDatabaseInfo { this.permissions = new HashMap<>(); } this.item = deserializeItem(dataRecord.getItem()); + + if(!dataRecord.getEncoded().isEmpty()) { + this.newItem = QuickShop.getInstance().getPlatform().decodeStack(dataRecord.getEncoded()); + } this.extra = deserializeExtra(extraStr); } @@ -349,7 +354,7 @@ public static class DataRawDatabaseInfo { try { return Util.deserialize(itemConfig); - } catch(Exception e) { + } catch(final Exception e) { QuickShop.getInstance().logger().warn("Failed load shop data, because target config can't deserialize the ItemStack", e); Log.debug("Failed to load data to the ItemStack: " + itemConfig); return null; @@ -364,7 +369,7 @@ public static class DataRawDatabaseInfo { YamlConfiguration yamlConfiguration = new YamlConfiguration(); try { yamlConfiguration.loadFromString(extraString); - } catch(InvalidConfigurationException e) { + } catch(final InvalidConfigurationException e) { yamlConfiguration = new YamlConfiguration(); needUpdate = true; } @@ -391,7 +396,7 @@ public static class ShopDatabaseInfo { try { this.shopId = origin.getInt("id"); this.dataId = origin.getInt("data"); - } catch(Exception ex) { + } catch(final Exception ex) { ex.printStackTrace(); } } @@ -415,7 +420,7 @@ public static class ShopMappingInfo { this.y = origin.getInt("y"); this.z = origin.getInt("z"); this.world = origin.getString("world"); - } catch(Exception ex) { + } catch(final Exception ex) { ex.printStackTrace(); } } From 60f590f2bf22ba1deb9fc5e9194e16922c8a6ab1 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 2 Nov 2024 01:48:00 -0400 Subject: [PATCH 05/11] Start fully implementing encoded column to overhaul serialization of items. --- .../src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java index 236e03a136..8f6c2d3a7d 100644 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java +++ b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java @@ -170,12 +170,14 @@ private ShopLoadResult loadSingleShop(final InfoRecord infoRecord, final DataRec final Shop shop; final DataRawDatabaseInfo rawInfo = new DataRawDatabaseInfo(dataRecord); final Location location = new Location(Bukkit.getWorld(infoRecord.getWorld()), x, y, z); + + final ItemStack stack = (rawInfo.getNewItem() == null)? rawInfo.getItem() : rawInfo.getNewItem(); try { shop = new ContainerShop(plugin, infoRecord.getShopId(), location, rawInfo.getPrice(), - rawInfo.getItem(), + stack, rawInfo.getOwner(), rawInfo.isUnlimited(), rawInfo.getType(), From 7d56d5c9c165252931952f74be92f2e9989a7b00 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 12 Nov 2024 19:24:10 -0500 Subject: [PATCH 06/11] Adjust grief protection to not go through all chunks. --- .../compatibility/griefprevention/Main.java | 110 +++++++----------- 1 file changed, 43 insertions(+), 67 deletions(-) diff --git a/compatibility/griefprevention/src/main/java/com/ghostchu/quickshop/compatibility/griefprevention/Main.java b/compatibility/griefprevention/src/main/java/com/ghostchu/quickshop/compatibility/griefprevention/Main.java index 0a18e0c0b5..84b734d18e 100644 --- a/compatibility/griefprevention/src/main/java/com/ghostchu/quickshop/compatibility/griefprevention/Main.java +++ b/compatibility/griefprevention/src/main/java/com/ghostchu/quickshop/compatibility/griefprevention/Main.java @@ -112,15 +112,11 @@ public void onClaimExpired(final ClaimExpirationEvent event) { // If it is the main claim, then we will delete all the shops that were inside of it. private void handleMainClaimUnclaimedOrExpired(final Claim claim, final String logMessage) { - for(final Chunk chunk : claim.getChunks()) { - final Map shops = getApi().getShopManager().getShops(chunk); - if(shops != null) { - for(final Shop shop : shops.values()) { - if(claim.contains(shop.getLocation(), false, false)) { - getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [System] Claim/SubClaim Unclaimed/Expired: " + logMessage, this.getName(), shop), shop.saveToInfoStorage())); - getApi().getShopManager().deleteShop(shop); - } - } + final List shops = getApi().getShopManager().getAllShops(); + for(final Shop shop : shops) { + if(claim.contains(shop.getLocation(), false, false)) { + getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [System] Claim/SubClaim Unclaimed/Expired: " + logMessage, this.getName(), shop), shop.saveToInfoStorage())); + getApi().getShopManager().deleteShop(shop); } } } @@ -130,16 +126,12 @@ private void handleMainClaimUnclaimedOrExpired(final Claim claim, final String l // A shop will be removed if the old claim contains it but the new claim doesn't. private void handleMainClaimResized(final Claim oldClaim, final Claim newClaim) { - for(final Chunk chunk : oldClaim.getChunks()) { - final Map shops = getApi().getShopManager().getShops(chunk); - if(shops != null) { - for(final Shop shop : shops.values()) { - if(oldClaim.contains(shop.getLocation(), false, false) && - !newClaim.contains(shop.getLocation(), false, false)) { - getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [Single] Claim Resized: ", this.getName(), shop), shop.saveToInfoStorage())); - getApi().getShopManager().deleteShop(shop); - } - } + final List shops = getApi().getShopManager().getAllShops(); + for(final Shop shop : shops) { + if(oldClaim.contains(shop.getLocation(), false, false) && + !newClaim.contains(shop.getLocation(), false, false)) { + getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [Single] Claim Resized: ", this.getName(), shop), shop.saveToInfoStorage())); + getApi().getShopManager().deleteShop(shop); } } } @@ -156,17 +148,13 @@ private void handleSubClaimResized(final Claim oldClaim, final Claim newClaim) { private void handleSubClaimResizedHelper(final Claim claimVerifyChunks, final Claim claimVerifyShop) { - for(final Chunk chunk : claimVerifyChunks.getChunks()) { - final Map shops = getApi().getShopManager().getShops(chunk); - if(shops != null) { - for(final Shop shop : shops.values()) { - if(!claimVerifyChunks.getOwnerID().equals(shop.getOwner().getUniqueId()) && - claimVerifyChunks.contains(shop.getLocation(), false, false) && - !claimVerifyShop.contains(shop.getLocation(), false, false)) { - getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [Single] SubClaim Resized: ", this.getName(), shop), shop.saveToInfoStorage())); - getApi().getShopManager().deleteShop(shop); - } - } + final List shops = getApi().getShopManager().getAllShops(); + for(final Shop shop : shops) { + if(!claimVerifyChunks.getOwnerID().equals(shop.getOwner().getUniqueId()) && + claimVerifyChunks.contains(shop.getLocation(), false, false) && + !claimVerifyShop.contains(shop.getLocation(), false, false)) { + getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [Single] SubClaim Resized: ", this.getName(), shop), shop.saveToInfoStorage())); + getApi().getShopManager().deleteShop(shop); } } } @@ -197,25 +185,20 @@ private void handleClaimTrustChanged(final Claim claim, final TrustChangedEvent if(event.isGiven()) { return; } - for(final Chunk chunk : claim.getChunks()) { - final Map shops = getApi().getShopManager().getShops(chunk); - if(shops == null) { + final List shops = getApi().getShopManager().getAllShops(); + for(final Shop shop : shops) { + if(claim.getOwnerID().equals(shop.getOwner().getUniqueId())) { continue; } - for(final Shop shop : shops.values()) { - if(claim.getOwnerID().equals(shop.getOwner().getUniqueId())) { - continue; - } - if(event.getIdentifier().equals(shop.getOwner().getUniqueIdIfRealPlayer().orElse(CommonUtil.getNilUniqueId()).toString())) { - getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(event.getChanger()), String.format("[%s Integration]Shop %s deleted caused by [Single] Claim/SubClaim Trust Changed", this.getName(), shop), shop.saveToInfoStorage())); - getApi().getShopManager().deleteShop(shop); - } else if(event.getIdentifier().contains(shop.getOwner().getUniqueIdIfRealPlayer().orElse(CommonUtil.getNilUniqueId()).toString())) { - getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(event.getChanger()), String.format("[%s Integration]Shop %s deleted caused by [Group] Claim/SubClaim Trust Changed", this.getName(), shop), shop.saveToInfoStorage())); - getApi().getShopManager().deleteShop(shop); - } else if("all".equals(event.getIdentifier()) || "public".equals(event.getIdentifier())) { - getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(event.getChanger()), String.format("[%s Integration]Shop %s deleted caused by [All/Public] Claim/SubClaim Trust Changed", this.getName(), shop), shop.saveToInfoStorage())); - getApi().getShopManager().deleteShop(shop); - } + if(event.getIdentifier().equals(shop.getOwner().getUniqueIdIfRealPlayer().orElse(CommonUtil.getNilUniqueId()).toString())) { + getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(event.getChanger()), String.format("[%s Integration]Shop %s deleted caused by [Single] Claim/SubClaim Trust Changed", this.getName(), shop), shop.saveToInfoStorage())); + getApi().getShopManager().deleteShop(shop); + } else if(event.getIdentifier().contains(shop.getOwner().getUniqueIdIfRealPlayer().orElse(CommonUtil.getNilUniqueId()).toString())) { + getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(event.getChanger()), String.format("[%s Integration]Shop %s deleted caused by [Group] Claim/SubClaim Trust Changed", this.getName(), shop), shop.saveToInfoStorage())); + getApi().getShopManager().deleteShop(shop); + } else if("all".equals(event.getIdentifier()) || "public".equals(event.getIdentifier())) { + getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(event.getChanger()), String.format("[%s Integration]Shop %s deleted caused by [All/Public] Claim/SubClaim Trust Changed", this.getName(), shop), shop.saveToInfoStorage())); + getApi().getShopManager().deleteShop(shop); } } } @@ -239,16 +222,12 @@ public void onClaimUnclaimed(final ClaimDeletedEvent event) { // But we will remove all the others. private void handleSubClaimUnclaimed(final Claim subClaim) { - for(final Chunk chunk : subClaim.getChunks()) { - final Map shops = getApi().getShopManager().getShops(chunk); - if(shops != null) { - for(final Shop shop : shops.values()) { - if(!subClaim.getOwnerID().equals(shop.getOwner().getUniqueId()) && - subClaim.contains(shop.getLocation(), false, false)) { - getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [Single] SubClaim Unclaimed", this.getName(), shop), shop.saveToInfoStorage())); - getApi().getShopManager().deleteShop(shop); - } - } + final List shops = getApi().getShopManager().getAllShops(); + for(final Shop shop : shops) { + if(!subClaim.getOwnerID().equals(shop.getOwner().getUniqueId()) && + subClaim.contains(shop.getLocation(), false, false)) { + getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [Single] SubClaim Unclaimed", this.getName(), shop), shop.saveToInfoStorage())); + getApi().getShopManager().deleteShop(shop); } } } @@ -308,16 +287,13 @@ public void onSubClaimCreated(final ClaimCreatedEvent event) { if(event.getClaim().parent == null) { return; } - for(final Chunk chunk : event.getClaim().getChunks()) { - final Map shops = getApi().getShopManager().getShops(chunk); - if(shops != null) { - for(final Shop shop : shops.values()) { - if(!event.getClaim().getOwnerID().equals(shop.getOwner().getUniqueId()) && - event.getClaim().contains(shop.getLocation(), false, false)) { - getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [Single] SubClaim Created", this.getName(), shop), shop.saveToInfoStorage())); - getApi().getShopManager().deleteShop(shop); - } - } + + final List shops = getApi().getShopManager().getAllShops(); + for(final Shop shop : shops) { + if(!event.getClaim().getOwnerID().equals(shop.getOwner().getUniqueId()) && + event.getClaim().contains(shop.getLocation(), false, false)) { + getApi().logEvent(new ShopRemoveLog(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "GriefPrevention", false), String.format("[%s Integration]Shop %s deleted caused by [Single] SubClaim Created", this.getName(), shop), shop.saveToInfoStorage())); + getApi().getShopManager().deleteShop(shop); } } } From 031b3d9496688a1f6f1019cb55b5f358e7f45a55 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 12 Nov 2024 19:42:18 -0500 Subject: [PATCH 07/11] Adjust ARM compat. --- .../advancedregionmarket/Main.java | 34 +++++-------------- .../compatibility/bentobox/Main.java | 1 + 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/compatibility/advancedregionmarket/src/main/java/com/ghostchu/quickshop/compatibility/advancedregionmarket/Main.java b/compatibility/advancedregionmarket/src/main/java/com/ghostchu/quickshop/compatibility/advancedregionmarket/Main.java index 8182609195..c3d20ff174 100644 --- a/compatibility/advancedregionmarket/src/main/java/com/ghostchu/quickshop/compatibility/advancedregionmarket/Main.java +++ b/compatibility/advancedregionmarket/src/main/java/com/ghostchu/quickshop/compatibility/advancedregionmarket/Main.java @@ -1,7 +1,10 @@ package com.ghostchu.quickshop.compatibility.advancedregionmarket; import com.ghostchu.quickshop.api.shop.Shop; +import com.ghostchu.quickshop.common.util.CommonUtil; import com.ghostchu.quickshop.compatibility.CompatibilityModule; +import com.ghostchu.quickshop.obj.QUserImpl; +import com.ghostchu.quickshop.util.logging.container.ShopRemoveLog; import net.alex9849.arm.events.RemoveRegionEvent; import net.alex9849.arm.events.RestoreRegionEvent; import net.alex9849.arm.regions.Region; @@ -15,6 +18,7 @@ import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; @@ -33,33 +37,13 @@ public void onShopNeedDeletion(final RemoveRegionEvent event) { private void handleDeletion(final Region region) { - final Vector minPoint = region.getRegion().getMinPoint(); - final Vector maxPoint = region.getRegion().getMaxPoint(); - final World world = region.getRegionworld(); - final Set chuckLocations = new HashSet<>(); + final List shops = getApi().getShopManager().getAllShops(); + for(final Shop shop : shops) { - for(int x = minPoint.getBlockX(); x <= maxPoint.getBlockX() + 16; x += 16) { - for(int z = minPoint.getBlockZ(); z <= maxPoint.getBlockZ() + 16; z += 16) { - chuckLocations.add(world.getChunkAt(x >> 4, z >> 4)); - } - } - - - final HashMap shopMap = new HashMap<>(); - - for(final Chunk chunk : chuckLocations) { - final Map shopsInChunk = getApi().getShopManager().getShops(chunk); - if(shopsInChunk != null) { - shopMap.putAll(shopsInChunk); - } - } - for(final Map.Entry shopEntry : shopMap.entrySet()) { - final Location shopLocation = shopEntry.getKey(); + final Location shopLocation = shop.getLocation(); if(region.getRegion().contains(shopLocation.getBlockX(), shopLocation.getBlockY(), shopLocation.getBlockZ())) { - final Shop shop = shopEntry.getValue(); - if(shop != null) { - getApi().getShopManager().deleteShop(shop); - } + + getApi().getShopManager().deleteShop(shop); } } } diff --git a/compatibility/bentobox/src/main/java/com/ghostchu/quickshop/compatibility/bentobox/Main.java b/compatibility/bentobox/src/main/java/com/ghostchu/quickshop/compatibility/bentobox/Main.java index 7cbe0da198..116a57e190 100644 --- a/compatibility/bentobox/src/main/java/com/ghostchu/quickshop/compatibility/bentobox/Main.java +++ b/compatibility/bentobox/src/main/java/com/ghostchu/quickshop/compatibility/bentobox/Main.java @@ -53,6 +53,7 @@ public void onIslandKick(final world.bentobox.bentobox.api.events.team.TeamKickE if(!deleteShopOnLeave) { return; } + getShops(event.getIsland()).forEach(shop->{ if(event.getPlayerUUID().equals(shop.getOwner().getUniqueId())) { recordDeletion(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "BentoBox", false), shop, "Player " + event.getPlayerUUID() + " was kicked from the island"); From 66886a30ced14cb77d5756fb152f083f23e77760 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 12 Nov 2024 20:03:47 -0500 Subject: [PATCH 08/11] Remove unused compat projects. --- addon/webui/pom.xml | 85 ------ .../ghostchu/quickshop/addon/webui/Main.java | 73 ----- .../addon/webui/handler/GeneralHandler.java | 5 - .../addon/webui/handler/global/Recent.java | 11 - .../handler/shop/ServerShopsListing.java | 11 - .../addon/webui/handler/shop/ShopDetails.java | 11 - .../addon/webui/handler/shop/ShopHistory.java | 11 - .../addon/webui/handler/user/UserHistory.java | 11 - .../webui/handler/user/UserShopsListing.java | 11 - .../webui/handler/user/UserTransaction.java | 11 - addon/webui/src/main/resources/config.yml | 4 - addon/webui/src/main/resources/plugin.yml | 7 - compatibility/advancedchests/.gitignore | 113 ------- compatibility/advancedchests/pom.xml | 75 ----- .../AdvancedChestsInventoryManager.java | 72 ----- .../advancedchests/AdvancedChestsWrapper.java | 275 ------------------ .../compatibility/advancedchests/Main.java | 114 -------- .../src/main/resources/config.yml | 4 - .../src/main/resources/plugin.yml | 9 - compatibility/nocheatplus/.gitignore | 113 ------- compatibility/nocheatplus/pom.xml | 67 ----- .../compatibility/nocheatplus/Main.java | 26 -- .../nocheatplus/src/main/resources/plugin.yml | 7 - compatibility/nova/.gitignore | 113 ------- compatibility/nova/pom.xml | 69 ----- .../quickshop/compatibility/nova/Main.java | 103 ------- .../nova/src/main/resources/config.yml | 0 .../nova/src/main/resources/plugin.yml | 5 - pom.xml | 2 - 29 files changed, 1418 deletions(-) delete mode 100644 addon/webui/pom.xml delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/Main.java delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/GeneralHandler.java delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/global/Recent.java delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ServerShopsListing.java delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ShopDetails.java delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ShopHistory.java delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserHistory.java delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserShopsListing.java delete mode 100644 addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserTransaction.java delete mode 100644 addon/webui/src/main/resources/config.yml delete mode 100644 addon/webui/src/main/resources/plugin.yml delete mode 100644 compatibility/advancedchests/.gitignore delete mode 100644 compatibility/advancedchests/pom.xml delete mode 100644 compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/AdvancedChestsInventoryManager.java delete mode 100644 compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/AdvancedChestsWrapper.java delete mode 100644 compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/Main.java delete mode 100644 compatibility/advancedchests/src/main/resources/config.yml delete mode 100644 compatibility/advancedchests/src/main/resources/plugin.yml delete mode 100644 compatibility/nocheatplus/.gitignore delete mode 100644 compatibility/nocheatplus/pom.xml delete mode 100644 compatibility/nocheatplus/src/main/java/com/ghostchu/quickshop/compatibility/nocheatplus/Main.java delete mode 100644 compatibility/nocheatplus/src/main/resources/plugin.yml delete mode 100644 compatibility/nova/.gitignore delete mode 100644 compatibility/nova/pom.xml delete mode 100644 compatibility/nova/src/main/java/com/ghostchu/quickshop/compatibility/nova/Main.java delete mode 100644 compatibility/nova/src/main/resources/config.yml delete mode 100644 compatibility/nova/src/main/resources/plugin.yml diff --git a/addon/webui/pom.xml b/addon/webui/pom.xml deleted file mode 100644 index b3531e248c..0000000000 --- a/addon/webui/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 4.0.0 - - com.ghostchu - quickshop-hikari - 6.0.0.0-SNAPSHOT - ../../pom.xml - - com.ghostchu.quickshop.addon - webui - takari-jar - - Addon-WebUI - - An web interface to showcase your QuickShop-Hikari activities - - 17 - UTF-8 - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - org.apache.maven.plugins - maven-shade-plugin - - - - - src/main/resources - true - - - - - - - - org.spigotmc - spigot-api - - - com.ghostchu - quickshop-bukkit - ${project.parent.version} - provided - - - - org.apache.commons - commons-lang3 - 3.14.0 - provided - - - - - - - - - io.vertx - vertx-core - 4.5.3 - - - io.vertx - vertx-web - 4.4.0 - - - - diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/Main.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/Main.java deleted file mode 100644 index fe2103d086..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/Main.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ghostchu.quickshop.addon.webui; - -import com.ghostchu.quickshop.QuickShop; -import com.ghostchu.quickshop.addon.webui.handler.global.Recent; -import com.ghostchu.quickshop.addon.webui.handler.shop.ServerShopsListing; -import com.ghostchu.quickshop.addon.webui.handler.shop.ShopDetails; -import com.ghostchu.quickshop.addon.webui.handler.shop.ShopHistory; -import com.ghostchu.quickshop.addon.webui.handler.user.UserHistory; -import com.ghostchu.quickshop.addon.webui.handler.user.UserShopsListing; -import io.vertx.core.Vertx; -import io.vertx.core.VertxOptions; -import io.vertx.core.http.HttpServer; -import io.vertx.ext.web.Router; -import io.vertx.ext.web.RoutingContext; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.java.JavaPlugin; - -public final class Main extends JavaPlugin implements Listener { - - static Main instance; - private QuickShop plugin; - private Vertx vertx; - - @Override - public void onLoad() { - - instance = this; - } - - @Override - public void onDisable() { - - HandlerList.unregisterAll((Plugin)this); - } - - @Override - - public void onEnable() { - - saveDefaultConfig(); - plugin = QuickShop.getInstance(); - vertx = Vertx.vertx(new VertxOptions().setUseDaemonThread(true)); - HttpServer server = vertx.createHttpServer(); - Router restAPI = Router.router(vertx); - registerRoute(restAPI); - server.requestHandler(restAPI).listen(plugin.getConfig().getInt("httpd.port")); - } - - @SuppressWarnings("ResultOfMethodCallIgnored") - private void registerRoute(Router restAPI) { - - restAPI.get("/static/*").handler(this::handleStaticAssets); - restAPI.get("/localized").handler(this::handleFrontendRequestLocalizedFiles); - restAPI.get("/global/recent").handler(Recent::new); - restAPI.get("/user/shops").handler(UserShopsListing::new); - restAPI.get("/user/history").handler(UserHistory::new); - restAPI.get("/user/transaction").handler(UserHistory::new); - restAPI.get("/shops").handler(ServerShopsListing::new); - restAPI.get("/shop/:id").handler(ShopDetails::new); - restAPI.get("/shop/:id/history").handler(ShopHistory::new); - } - - - private void handleFrontendRequestLocalizedFiles(RoutingContext routingContext) { - - } - - private void handleStaticAssets(RoutingContext ctx) { - - } -} diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/GeneralHandler.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/GeneralHandler.java deleted file mode 100644 index 774b9e9fbf..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/GeneralHandler.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.ghostchu.quickshop.addon.webui.handler; - -public interface GeneralHandler { - -} diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/global/Recent.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/global/Recent.java deleted file mode 100644 index 98d2723a05..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/global/Recent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ghostchu.quickshop.addon.webui.handler.global; - -import com.ghostchu.quickshop.addon.webui.handler.GeneralHandler; -import io.vertx.ext.web.RoutingContext; - -public class Recent implements GeneralHandler { - - public Recent(RoutingContext ctx) { - - } -} diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ServerShopsListing.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ServerShopsListing.java deleted file mode 100644 index d786ae2332..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ServerShopsListing.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ghostchu.quickshop.addon.webui.handler.shop; - -import com.ghostchu.quickshop.addon.webui.handler.GeneralHandler; -import io.vertx.ext.web.RoutingContext; - -public class ServerShopsListing implements GeneralHandler { - - public ServerShopsListing(RoutingContext ctx) { - - } -} diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ShopDetails.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ShopDetails.java deleted file mode 100644 index 7e920478c0..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ShopDetails.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ghostchu.quickshop.addon.webui.handler.shop; - -import com.ghostchu.quickshop.addon.webui.handler.GeneralHandler; -import io.vertx.ext.web.RoutingContext; - -public class ShopDetails implements GeneralHandler { - - public ShopDetails(RoutingContext ctx) { - - } -} diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ShopHistory.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ShopHistory.java deleted file mode 100644 index f3cfeb4222..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/shop/ShopHistory.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ghostchu.quickshop.addon.webui.handler.shop; - -import com.ghostchu.quickshop.addon.webui.handler.GeneralHandler; -import io.vertx.ext.web.RoutingContext; - -public class ShopHistory implements GeneralHandler { - - public ShopHistory(RoutingContext ctx) { - - } -} diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserHistory.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserHistory.java deleted file mode 100644 index 5f1269dcef..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserHistory.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ghostchu.quickshop.addon.webui.handler.user; - -import com.ghostchu.quickshop.addon.webui.handler.GeneralHandler; -import io.vertx.ext.web.RoutingContext; - -public class UserHistory implements GeneralHandler { - - public UserHistory(RoutingContext ctx) { - - } -} diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserShopsListing.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserShopsListing.java deleted file mode 100644 index 81ec3d7f3b..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserShopsListing.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ghostchu.quickshop.addon.webui.handler.user; - -import com.ghostchu.quickshop.addon.webui.handler.GeneralHandler; -import io.vertx.ext.web.RoutingContext; - -public class UserShopsListing implements GeneralHandler { - - public UserShopsListing(RoutingContext ctx) { - - } -} diff --git a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserTransaction.java b/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserTransaction.java deleted file mode 100644 index ee9d9f5cc3..0000000000 --- a/addon/webui/src/main/java/com/ghostchu/quickshop/addon/webui/handler/user/UserTransaction.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ghostchu.quickshop.addon.webui.handler.user; - -import com.ghostchu.quickshop.addon.webui.handler.GeneralHandler; -import io.vertx.ext.web.RoutingContext; - -public class UserTransaction implements GeneralHandler { - - public UserTransaction(RoutingContext ctx) { - - } -} diff --git a/addon/webui/src/main/resources/config.yml b/addon/webui/src/main/resources/config.yml deleted file mode 100644 index 6206eb4627..0000000000 --- a/addon/webui/src/main/resources/config.yml +++ /dev/null @@ -1,4 +0,0 @@ -config-version: 1 -httpd: - port: 55608 - workerPoolSize: \ No newline at end of file diff --git a/addon/webui/src/main/resources/plugin.yml b/addon/webui/src/main/resources/plugin.yml deleted file mode 100644 index de66a9429c..0000000000 --- a/addon/webui/src/main/resources/plugin.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: qsaddon-${project.artifactId} -version: '${project.version}' -main: com.ghostchu.quickshop.addon.${project.artifactId}.Main -api-version: 1.18 -depend: - - QuickShop-Hikari -authors: [ Ghost_chu ] \ No newline at end of file diff --git a/compatibility/advancedchests/.gitignore b/compatibility/advancedchests/.gitignore deleted file mode 100644 index 4788b4b454..0000000000 --- a/compatibility/advancedchests/.gitignore +++ /dev/null @@ -1,113 +0,0 @@ -# User-specific stuff -.idea/ - -*.iml -*.ipr -*.iws - -# IntelliJ -out/ - -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -target/ - -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next - -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar -.flattened-pom.xml - -# Common working directory -run/ diff --git a/compatibility/advancedchests/pom.xml b/compatibility/advancedchests/pom.xml deleted file mode 100644 index dc57c1da19..0000000000 --- a/compatibility/advancedchests/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - 4.0.0 - - com.ghostchu - quickshop-hikari - 5.0.0.0 - ../../pom.xml - - com.ghostchu.quickshop.compatibility - advancedchests - takari-jar - - Compat-AdvancedChests - - - 17 - UTF-8 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - org.apache.maven.plugins - maven-shade-plugin - - - - - src/main/resources - true - - - - - - - jitpack.io - https://jitpack.io - - - - - - org.spigotmc - spigot-api - - - com.github.DeadSilenceIV - AdvancedChestsAPI - 3.2-BETA - provided - - - com.ghostchu.quickshop.compatibility - common - ${project.parent.version} - compile - - - com.ghostchu - quickshop-bukkit - ${project.parent.version} - provided - - - diff --git a/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/AdvancedChestsInventoryManager.java b/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/AdvancedChestsInventoryManager.java deleted file mode 100644 index 8b2a10f95a..0000000000 --- a/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/AdvancedChestsInventoryManager.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ghostchu.quickshop.compatibility.advancedchests; - -import com.ghostchu.quickshop.api.inventory.InventoryWrapper; -import com.ghostchu.quickshop.api.inventory.InventoryWrapperManager; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.jetbrains.annotations.NotNull; -import us.lynuxcraft.deadsilenceiv.advancedchests.AdvancedChestsAPI; -import us.lynuxcraft.deadsilenceiv.advancedchests.chest.AdvancedChest; - -import java.util.UUID; - -public class AdvancedChestsInventoryManager implements InventoryWrapperManager { - - private final Main plugin; - - public AdvancedChestsInventoryManager(Main plugin) { - - this.plugin = plugin; - } - - /** - * Locate an Inventory with symbol link NOTICE: This can be call multiple times, and maybe - * multiple InventoryWrapper will exist in same time. You must be sure all wrapper can be process - * any request in any time. - * - * @param symbolLink symbol link that created by InventoryWrapperManager#mklink - * - * @return Symbol link - * - * @throws IllegalArgumentException If symbol link invalid - */ - @Override - public @NotNull InventoryWrapper locate(@NotNull String symbolLink) throws IllegalArgumentException { - - String[] spilt = symbolLink.split(";"); - if(spilt.length < 5) { - throw new IllegalArgumentException("Invalid symbol link: " + symbolLink); - } - UUID aChestUniqueId = UUID.fromString(spilt[0]); - String worldName = spilt[1]; - int x = Integer.parseInt(spilt[2]); - int y = Integer.parseInt(spilt[3]); - int z = Integer.parseInt(spilt[4]); - Location location = new Location(Bukkit.getWorld(worldName), x, y, z); - AdvancedChest achest = AdvancedChestsAPI.getChestManager().getAdvancedChest(location); - if(achest == null) { - throw new IllegalArgumentException("Cannot found AdvancedChest at " + location + " with UUID " + aChestUniqueId + "."); - } - return new AdvancedChestsWrapper(achest, plugin); - } - - /** - * Create a symbol link for storage. - * - * @param wrapper Storage wrapper - * - * @return Symbol Link that used for locate the Inventory - * - * @throws IllegalArgumentException If cannot create symbol link for target Inventory. - */ - @Override - public @NotNull String mklink(@NotNull InventoryWrapper wrapper) throws IllegalArgumentException { - - if(wrapper instanceof AdvancedChestsWrapper advancedChestsWrapper) { - AdvancedChest achest = advancedChestsWrapper.getAdvancedChest(); - Location achestLoc = achest.getLocation(); - return achest.getUniqueId().toString() + ";" + achestLoc.getWorld().getName() + ";" + achestLoc.getBlockX() + ";" + achestLoc.getBlockY() + ";" + achestLoc.getBlockZ(); - } - throw new IllegalArgumentException("Cannot create symbol link for target Inventory: " + wrapper.getClass().getName()); - } -} diff --git a/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/AdvancedChestsWrapper.java b/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/AdvancedChestsWrapper.java deleted file mode 100644 index 963110cf53..0000000000 --- a/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/AdvancedChestsWrapper.java +++ /dev/null @@ -1,275 +0,0 @@ -package com.ghostchu.quickshop.compatibility.advancedchests; - -import com.ghostchu.quickshop.api.QuickShopAPI; -import com.ghostchu.quickshop.api.inventory.InventoryWrapper; -import com.ghostchu.quickshop.api.inventory.InventoryWrapperIterator; -import com.ghostchu.quickshop.api.inventory.InventoryWrapperManager; -import com.ghostchu.quickshop.api.inventory.InventoryWrapperType; -import com.ghostchu.quickshop.util.logger.Log; -import org.apache.commons.lang3.ArrayUtils; -import org.bukkit.Location; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryHolder; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import us.lynuxcraft.deadsilenceiv.advancedchests.chest.AdvancedChest; -import us.lynuxcraft.deadsilenceiv.advancedchests.chest.gui.page.ChestPage; - -import java.util.*; - -public class AdvancedChestsWrapper implements InventoryWrapper { - - private final Main plugin; - private final AdvancedChest advancedChest; - - public AdvancedChestsWrapper(AdvancedChest achest, Main plugin) { - - this.plugin = plugin; - this.advancedChest = achest; - } - - - /** - * Return the iterator for this inventory It's not thread-safe, please use that in main-thread - * - * @return the iterator for this inventory - */ - @Override - public @NotNull InventoryWrapperIterator iterator() { - - ItemStack[] stacks = new ItemStack[0]; - for(Map.Entry> entry : getAdvancedChestPages().entrySet()) { - stacks = ArrayUtils.addAll(stacks, entry.getValue().getItems()); - } - return InventoryWrapperIterator.ofItemStacks(stacks); - } - - /** - * Clear the inventory - */ - @Override - public void clear() { - - for(Map.Entry> entry : getAdvancedChestPages().entrySet()) { - ItemStack[] stacks = entry.getValue().getItems(); - Arrays.fill(stacks, null); - entry.getValue().setContent(Arrays.stream(stacks).toList()); - } - } - - @Override - public @NotNull ItemStack[] createSnapshot() { - - ItemStack[] stacks = new ItemStack[0]; - for(Map.Entry> entry : getAdvancedChestPages().entrySet()) { - int id = entry.getKey(); - ChestPage page = entry.getValue(); - int[] inputSlots = page.getInputSlots(); - ItemStack[] itemsCloneInPage = new ItemStack[inputSlots.length]; - for(int inputSlot : inputSlots) { - ItemStack stack = page.getBukkitInventory().getItem(inputSlot); - if(stack != null) { - itemsCloneInPage[inputSlot] = stack.clone(); - } else { - itemsCloneInPage[inputSlot] = null; - } - } - stacks = ArrayUtils.addAll(stacks, itemsCloneInPage); - } - return stacks; - } - - @NotNull - private Map> getAdvancedChestPages() { - //noinspection unchecked - return (Map>)advancedChest.getPages(); - } - - /** - * Gets the Inventory Wrapper Manager - * - * @return Wrapper Manager - */ - @Override - public @NotNull InventoryWrapperManager getWrapperManager() { - - return plugin.getManager(); - } - - /** - * Gets the block or entity belonging to the open inventory - * - * @return The holder of the inventory; null if it has no holder. - */ - @Override - public @Nullable InventoryHolder getHolder() { - - return new AdvancedChestsInventoryHolder(advancedChest); - } - - /** - * Gets the Inventory Type - * - * @return The Inventory Type - */ - @Override - public @NotNull InventoryWrapperType getInventoryType() { - - return InventoryWrapperType.PLUGIN; - } - - /** - * Get the location of the block or entity which corresponds to this inventory. May return null if - * this container was custom created or is a virtual / subcontainer. - * - * @return location or null if not applicable. - */ - @Override - public @Nullable Location getLocation() { - - return null; - } - - @Override - public boolean restoreSnapshot(@NotNull ItemStack[] snapshot) { - - setContents(snapshot); - return true; - } - - /** - * Set the contents of inventory - * - * @param itemStacks the contents you want to set - */ - @Override - public void setContents(ItemStack[] itemStacks) { - - Deque deque = new ArrayDeque<>(); - for(ItemStack itemStack : itemStacks) { - if(itemStack != null) { - deque.add(itemStack); - } - } - for(Map.Entry> entry : getAdvancedChestPages().entrySet()) { - ChestPage page = entry.getValue(); - int[] inputSlots = page.getInputSlots(); - for(int inputSlot : inputSlots) { - if(deque.isEmpty()) { - break; - } - ItemStack stack = deque.pop(); - if(stack.getType().isAir() || stack.getAmount() == 0) { - page.getBukkitInventory().setItem(inputSlot, null); - } else { - page.getBukkitInventory().setItem(inputSlot, stack); - } - } - } - } - - public AdvancedChest getAdvancedChest() { - - return advancedChest; - } - - @Override - public @NotNull Map addItem(ItemStack... itemStacks) { - - if(itemStacks.length == 0) { - return Collections.emptyMap(); - } - ItemStack[] contents = createSnapshot(); - InventoryWrapperIterator iterator = InventoryWrapperIterator.ofItemStacks(contents); - Map integerItemStackMap = new HashMap<>(); - AddProcess: - for(int i = 0; i < itemStacks.length; i++) { - ItemStack itemStackToAdd = itemStacks[i]; - while(iterator.hasNext()) { - ItemStack itemStack = iterator.next(); - if(itemStack == null) { - iterator.setCurrent(itemStackToAdd.clone()); - itemStackToAdd.setAmount(0); - continue AddProcess; - } else { - if(itemStack.isSimilar(itemStackToAdd)) { - int couldAdd = itemStack.getMaxStackSize() - Math.min(itemStack.getMaxStackSize(), itemStack.getAmount()); - int actuallyAdd = Math.min(itemStackToAdd.getAmount(), couldAdd); - itemStack.setAmount(itemStack.getAmount() + actuallyAdd); - int needsNow = itemStackToAdd.getAmount() - actuallyAdd; - itemStackToAdd.setAmount(needsNow); - iterator.setCurrent(itemStack); - if(needsNow == 0) { - continue AddProcess; - } - } - } - } - if(itemStackToAdd.getAmount() != 0) { - integerItemStackMap.put(i, itemStackToAdd); - } - } - setContents(contents); - return integerItemStackMap; - } - - @Override - public @NotNull Map removeItem(ItemStack... itemStacks) { - - if(itemStacks.length == 0) { - return Collections.emptyMap(); - } - ItemStack[] contents = createSnapshot(); - InventoryWrapperIterator iterator = InventoryWrapperIterator.ofItemStacks(contents); - Map integerItemStackMap = new HashMap<>(); - RemoveProcess: - for(int i = 0; i < itemStacks.length; i++) { - ItemStack itemStackToRemove = itemStacks[i]; - while(iterator.hasNext()) { - ItemStack itemStack = iterator.next(); - // TODO: Need lots of verification, it cause mismatch between items under non-Bukkit item matcher - if(itemStack != null && QuickShopAPI.getInstance().getItemMatcher().matches(itemStackToRemove, itemStack)) { - int couldRemove = itemStack.getAmount(); - int actuallyRemove = Math.min(itemStackToRemove.getAmount(), couldRemove); - itemStack.setAmount(itemStack.getAmount() - actuallyRemove); - int needsNow = itemStackToRemove.getAmount() - actuallyRemove; - Log.debug("couldRemove = " + couldRemove + " actuallyRemove = " + actuallyRemove + " needsNow = " + needsNow); - itemStackToRemove.setAmount(needsNow); - iterator.setCurrent(itemStack); - if(needsNow == 0) { - continue RemoveProcess; - } - } - } - if(itemStackToRemove.getAmount() != 0) { - integerItemStackMap.put(i, itemStackToRemove); - } - } - setContents(contents); - return integerItemStackMap; - } - - static class AdvancedChestsInventoryHolder implements InventoryHolder { - - private final AdvancedChest achest; - - public AdvancedChestsInventoryHolder(AdvancedChest achest) { - - this.achest = achest; - } - - public AdvancedChest getAdvancedChest() { - - return achest; - } - - @NotNull - @Override - public Inventory getInventory() { - - return null; - } - } - -} diff --git a/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/Main.java b/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/Main.java deleted file mode 100644 index b32ab93e91..0000000000 --- a/compatibility/advancedchests/src/main/java/com/ghostchu/quickshop/compatibility/advancedchests/Main.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.ghostchu.quickshop.compatibility.advancedchests; - -import com.ghostchu.quickshop.QuickShop; -import com.ghostchu.quickshop.api.event.ShopCreateEvent; -import com.ghostchu.quickshop.api.inventory.InventoryWrapper; -import com.ghostchu.quickshop.api.shop.Shop; -import com.ghostchu.quickshop.common.util.CommonUtil; -import com.ghostchu.quickshop.compatibility.CompatibilityModule; -import com.ghostchu.quickshop.obj.QUserImpl; -import org.bukkit.Location; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.jetbrains.annotations.Nullable; -import us.lynuxcraft.deadsilenceiv.advancedchests.AdvancedChestsAPI; -import us.lynuxcraft.deadsilenceiv.advancedchests.chest.AdvancedChest; -import us.lynuxcraft.deadsilenceiv.advancedchests.events.ChestRemoveEvent; -import us.lynuxcraft.deadsilenceiv.advancedchests.utils.ChunkLocation; - -import java.util.Map; - -public final class Main extends CompatibilityModule implements Listener { - - public AdvancedChestsInventoryManager manager; - - public AdvancedChestsInventoryManager getManager() { - - return manager; - } - - - @Override - public void onLoad() { - - super.onLoad(); - manager = new AdvancedChestsInventoryManager(this); - getApi().getInventoryWrapperRegistry().register(this, manager); - } - - @Override - public void onEnable() { - - super.onEnable(); - } - - @Override - public void init() { - // There no init stuffs need to do - } - - @Nullable - public AdvancedChest locateAdvancedChest(Location location) { - - AdvancedChest result = AdvancedChestsAPI.getChestManager().getAdvancedChest(location); - if(result == null) { - result = AdvancedChestsAPI.getChestManager().getNonLoadableChest(location); - } - return result; - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onShopCreated(ShopCreateEvent event) { - - Location createdPos = event.getShop().getLocation(); - AdvancedChest advancedChests = locateAdvancedChest(createdPos); - if(advancedChests == null) { - return; - } - - if(!QuickShop.getPermissionManager().hasPermission(event.getCreator(), "quickshop.create.advancedchests")) { - event.setCancelled(true, getApi().getTextManager().of(event.getCreator(), "compat.advancedchests.permission-denied").forLocale()); - return; - } - Shop shop = event.getShop(); - shop.setInventory(new AdvancedChestsWrapper(advancedChests, this), manager); - getApi().getTextManager().of(event.getCreator(), "compat.advancedchests.created").send(); - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onAdvancedChestRemoved(ChestRemoveEvent event) { - - AdvancedChest advancedChests = event.getChest(); - ChunkLocation chunkLocation = advancedChests.getChunkLocation(); - Map shops = getApi().getShopManager().getShops(chunkLocation.getWorld().getName(), chunkLocation.getX(), chunkLocation.getZ()); - if(shops == null) return; - for(Shop shop : shops.values()) { - InventoryWrapper inventory = shop.getInventory(); - if(inventory == null) continue; - if(inventory.getHolder() instanceof AdvancedChestsWrapper advancedChestsWrapper) { - if(advancedChestsWrapper.getAdvancedChest().getUniqueId().equals(advancedChests.getUniqueId())) { - recordDeletion(QUserImpl.createFullFilled(CommonUtil.getNilUniqueId(), "AdvancedChests", false), shop, "AdvancedChest Removed"); - getApi().getShopManager().deleteShop(shop); - } - } - } - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onInventoryClose(InventoryCloseEvent e) { - - AdvancedChest advancedChests = AdvancedChestsAPI.getInventoryManager().getAdvancedChest(e.getInventory()); - if(advancedChests == null) return; - for(Shop shop : getApi().getShopManager().getLoadedShops()) { - InventoryWrapper inventory = shop.getInventory(); - if(inventory == null) continue; - if(inventory instanceof AdvancedChestsWrapper advancedChestsWrapper) { - if(advancedChestsWrapper.getAdvancedChest().getUniqueId().equals(advancedChests.getUniqueId())) { - shop.setSignText(getApi().getTextManager().findRelativeLanguages(e.getPlayer())); - } - } - } - } -} diff --git a/compatibility/advancedchests/src/main/resources/config.yml b/compatibility/advancedchests/src/main/resources/config.yml deleted file mode 100644 index 1e42e54df5..0000000000 --- a/compatibility/advancedchests/src/main/resources/config.yml +++ /dev/null @@ -1,4 +0,0 @@ -messages: - description: Switch a shop to use owner's EnderChest inventory. - to-echest: Successfully linked this shop Inventory with your EnderChest! - to-chest: Successfully linked this shop Inventory to it's container! \ No newline at end of file diff --git a/compatibility/advancedchests/src/main/resources/plugin.yml b/compatibility/advancedchests/src/main/resources/plugin.yml deleted file mode 100644 index d4546e4ebb..0000000000 --- a/compatibility/advancedchests/src/main/resources/plugin.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: qscompat-${project.artifactId} -version: '${project.version}' -main: com.ghostchu.quickshop.compatibility.${project.artifactId}.Main -api-version: 1.18 -depend: [ AdvancedChests, QuickShop-Hikari ] -permissions: - quickshop.create.advancedchests: - description: Allows the player to create a shop on an AdvancedChests chest. - default: op \ No newline at end of file diff --git a/compatibility/nocheatplus/.gitignore b/compatibility/nocheatplus/.gitignore deleted file mode 100644 index 4788b4b454..0000000000 --- a/compatibility/nocheatplus/.gitignore +++ /dev/null @@ -1,113 +0,0 @@ -# User-specific stuff -.idea/ - -*.iml -*.ipr -*.iws - -# IntelliJ -out/ - -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -target/ - -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next - -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar -.flattened-pom.xml - -# Common working directory -run/ diff --git a/compatibility/nocheatplus/pom.xml b/compatibility/nocheatplus/pom.xml deleted file mode 100644 index b286ebf9b4..0000000000 --- a/compatibility/nocheatplus/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - 4.0.0 - - com.ghostchu - quickshop-hikari - 4.1.0.3 - ../../pom.xml - - com.ghostchu.quickshop.compatibility - nocheatplus - takari-jar - - Compat-NoCheatPlus - - - UTF-8 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-shade-plugin - - - - - - src/main/resources - true - - - - - - - org.spigotmc - spigot-api - - - fr.neatmonster - nocheatplus - 3.17-SNAPSHOT - provided - - - com.ghostchu - quickshop-bukkit - ${project.parent.version} - provided - - - com.ghostchu.quickshop.compatibility - common - ${project.parent.version} - compile - - - diff --git a/compatibility/nocheatplus/src/main/java/com/ghostchu/quickshop/compatibility/nocheatplus/Main.java b/compatibility/nocheatplus/src/main/java/com/ghostchu/quickshop/compatibility/nocheatplus/Main.java deleted file mode 100644 index 8d6f145ee5..0000000000 --- a/compatibility/nocheatplus/src/main/java/com/ghostchu/quickshop/compatibility/nocheatplus/Main.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ghostchu.quickshop.compatibility.nocheatplus; - -import com.ghostchu.quickshop.api.event.ProtectionCheckStatus; -import com.ghostchu.quickshop.api.event.ShopProtectionCheckEvent; -import com.ghostchu.quickshop.compatibility.CompatibilityModule; -import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -public final class Main extends CompatibilityModule implements Listener { - - @Override - public void init() { - - } - - @EventHandler(ignoreCancelled = true) - public void onFakeEventBegin(ShopProtectionCheckEvent event) { - - if(event.getStatus() == ProtectionCheckStatus.BEGIN) { - NCPExemptionManager.exemptPermanently(event.getPlayer().getUniqueId()); - } else if(event.getStatus() == ProtectionCheckStatus.END) { - NCPExemptionManager.unexempt(event.getPlayer().getUniqueId()); - } - } -} diff --git a/compatibility/nocheatplus/src/main/resources/plugin.yml b/compatibility/nocheatplus/src/main/resources/plugin.yml deleted file mode 100644 index 9efda81ac5..0000000000 --- a/compatibility/nocheatplus/src/main/resources/plugin.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: qscompat-${project.artifactId} -version: '${project.version}' -main: com.ghostchu.quickshop.compatibility.${project.artifactId}.Main -api-version: 1.18 -depend: - - NoCheatPlus - - QuickShop-Hikari diff --git a/compatibility/nova/.gitignore b/compatibility/nova/.gitignore deleted file mode 100644 index 4788b4b454..0000000000 --- a/compatibility/nova/.gitignore +++ /dev/null @@ -1,113 +0,0 @@ -# User-specific stuff -.idea/ - -*.iml -*.ipr -*.iws - -# IntelliJ -out/ - -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -target/ - -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next - -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar -.flattened-pom.xml - -# Common working directory -run/ diff --git a/compatibility/nova/pom.xml b/compatibility/nova/pom.xml deleted file mode 100644 index f48b7733b5..0000000000 --- a/compatibility/nova/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - 4.0.0 - - com.ghostchu - quickshop-hikari - 1.1.3.4 - ../../pom.xml - - com.ghostchu.quickshop.compatibility - nova - takari-jar - - Compat-Nova - - - 17 - UTF-8 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - org.apache.maven.plugins - maven-shade-plugin - - - - - src/main/resources - true - - - - - - - org.spigotmc - spigot-api - - - com.ghostchu - quickshop-bukkit - ${project.parent.version} - provided - - - com.ghostchu.quickshop.compatibility - common - ${project.parent.version} - compile - - - xyz.xenondevs.nova - Nova - 0.8.6 - system - ${project.basedir}/lib/Nova-0.8.6.jar - - - diff --git a/compatibility/nova/src/main/java/com/ghostchu/quickshop/compatibility/nova/Main.java b/compatibility/nova/src/main/java/com/ghostchu/quickshop/compatibility/nova/Main.java deleted file mode 100644 index c7ac2cf562..0000000000 --- a/compatibility/nova/src/main/java/com/ghostchu/quickshop/compatibility/nova/Main.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * This file is a part of project QuickShop, the name is Nova.java - * Copyright (C) Ghost_chu and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -package com.ghostchu.quickshop.compatibility.nova; - -import com.ghostchu.quickshop.api.shop.AbstractDisplayItem; -import com.ghostchu.quickshop.api.shop.Shop; -import com.ghostchu.quickshop.compatibility.CompatibilityModule; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; -import org.bukkit.event.Listener; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import xyz.xenondevs.nova.api.protection.ProtectionIntegration; - -public final class Main extends CompatibilityModule implements Listener, ProtectionIntegration { - - @Override - public boolean canBreak(@NotNull OfflinePlayer offlinePlayer, @Nullable ItemStack itemStack, @NotNull Location location) { - - Shop shop = getApi().getShopManager().getShopIncludeAttached(location); - if(shop == null) { return true; } - return shop.getOwner().equals(offlinePlayer.getUniqueId()); - } - - @Override - public boolean canHurtEntity(@NotNull OfflinePlayer offlinePlayer, @NotNull Entity entity, @Nullable ItemStack itemStack) { - - if(itemStack != null) { - if(AbstractDisplayItem.checkIsGuardItemStack(itemStack)) { return false; } - } - if(entity instanceof Item item) { - return !AbstractDisplayItem.checkIsGuardItemStack(item.getItemStack()); - } - return true; // We don't care that - } - - @Override - public boolean canInteractWithEntity(@NotNull OfflinePlayer offlinePlayer, @NotNull Entity entity, @Nullable ItemStack itemStack) { - - if(itemStack != null) { - if(AbstractDisplayItem.checkIsGuardItemStack(itemStack)) { return false; } - } - if(entity instanceof Item item) { - return !AbstractDisplayItem.checkIsGuardItemStack(item.getItemStack()); - } - return true; // We don't care that - } - - @Override - public boolean canPlace(@NotNull OfflinePlayer offlinePlayer, @NotNull ItemStack itemStack, @NotNull Location location) { - - Shop shop = getApi().getShopManager().getShopIncludeAttached(location); - if(shop == null) { return true; } - return shop.getOwner().equals(offlinePlayer.getUniqueId()); - } - - @Override - public boolean canUseBlock(@NotNull OfflinePlayer offlinePlayer, @Nullable ItemStack itemStack, @NotNull Location location) { - - Shop shop = getApi().getShopManager().getShopIncludeAttached(location); - if(shop == null) { return true; } - return shop.getOwner().equals(offlinePlayer.getUniqueId()); - } - - @Override - public boolean canUseItem(@NotNull OfflinePlayer offlinePlayer, @NotNull ItemStack itemStack, @NotNull Location location) { - - Shop shop = getApi().getShopManager().getShopIncludeAttached(location); - if(shop == null) { return true; } - return shop.getOwner().equals(offlinePlayer.getUniqueId()); - } - - public void init() { - // There no init stuffs need to do - } - - @Override - public void onEnable() { - - xyz.xenondevs.nova.api.Nova.getNova().registerProtectionIntegration(this); - super.onEnable(); - } -} diff --git a/compatibility/nova/src/main/resources/config.yml b/compatibility/nova/src/main/resources/config.yml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/compatibility/nova/src/main/resources/plugin.yml b/compatibility/nova/src/main/resources/plugin.yml deleted file mode 100644 index a789abdede..0000000000 --- a/compatibility/nova/src/main/resources/plugin.yml +++ /dev/null @@ -1,5 +0,0 @@ -name: qscompat-${project.artifactId} -version: '${project.version}' -main: com.ghostchu.quickshop.compatibility.${project.artifactId}.Main -api-version: 1.18 -depend: [ Nova, QuickShop-Hikari ] diff --git a/pom.xml b/pom.xml index a0f5975f4b..7faf0114db 100644 --- a/pom.xml +++ b/pom.xml @@ -415,7 +415,6 @@ compatibility/bungeecord compatibility/velocity compatibility/clearlag - compatibility/worldguard compatibility/worldedit compatibility/openinv @@ -446,7 +445,6 @@ addon/bluemap addon/displaycontrol addon/reremake-migrator - From cfcd54412966d2262f770a86e55eb24f61041f4e Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 12 Nov 2024 21:14:14 -0500 Subject: [PATCH 09/11] Remove classes that are no longer used. --- ...BukkitListenerDrivenInventoryListener.java | 15 --- .../BukkitListenerDrivenInventoryWrapper.java | 127 ------------------ .../InventoryWrapperUpdateManager.java | 75 ----------- .../util/paste/HelpChatPastebinPaster.java | 80 ----------- .../quickshop/util/paste/PastebinPaster.java | 51 ------- .../quickshop/util/paste/UbuntuPaster.java | 77 ----------- 6 files changed, 425 deletions(-) delete mode 100644 quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/BukkitListenerDrivenInventoryListener.java delete mode 100644 quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/BukkitListenerDrivenInventoryWrapper.java delete mode 100644 quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/InventoryWrapperUpdateManager.java delete mode 100644 quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/HelpChatPastebinPaster.java delete mode 100644 quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/PastebinPaster.java delete mode 100644 quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/UbuntuPaster.java diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/BukkitListenerDrivenInventoryListener.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/BukkitListenerDrivenInventoryListener.java deleted file mode 100644 index d2ffebbae4..0000000000 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/BukkitListenerDrivenInventoryListener.java +++ /dev/null @@ -1,15 +0,0 @@ -//package com.ghostchu.quickshop.shop.inventory; -// -//import org.bukkit.Location; -//import org.jetbrains.annotations.ApiStatus; -// -//@ApiStatus.Internal -//public interface BukkitListenerDrivenInventoryListener { -// // This listener to fix for: -// //https://discord.com/channels/942378696415797298/942378809632649256/1156394450570969089 -// //https://discord.com/channels/942378696415797298/942378809632649256/1207787041992216586 -// //https://discord.com/channels/942378696415797298/942378809632649256/1207783977352437881 -// //https://discord.com/channels/942378696415797298/942378809632649256/1208807999003562044 -// //https://discord.com/channels/942378696415797298/942378809632649256/1221584126432514110 -// boolean notify(Location updated); // May call from async thread -//} diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/BukkitListenerDrivenInventoryWrapper.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/BukkitListenerDrivenInventoryWrapper.java deleted file mode 100644 index d368e582e3..0000000000 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/BukkitListenerDrivenInventoryWrapper.java +++ /dev/null @@ -1,127 +0,0 @@ -//package com.ghostchu.quickshop.shop.inventory; -// -//import com.ghostchu.quickshop.QuickShop; -//import com.ghostchu.quickshop.api.inventory.InventoryWrapper; -//import com.ghostchu.quickshop.api.inventory.InventoryWrapperIterator; -//import com.ghostchu.quickshop.api.inventory.InventoryWrapperManager; -//import com.ghostchu.quickshop.api.inventory.InventoryWrapperType; -//import com.ghostchu.quickshop.common.util.JsonUtil; -//import org.bukkit.Location; -//import org.bukkit.inventory.Inventory; -//import org.bukkit.inventory.InventoryHolder; -//import org.bukkit.inventory.ItemStack; -//import org.jetbrains.annotations.ApiStatus; -//import org.jetbrains.annotations.NotNull; -//import org.jetbrains.annotations.Nullable; -// -//import java.util.HashMap; -//import java.util.Map; -// -//@ApiStatus.Internal -//public class BukkitListenerDrivenInventoryWrapper implements InventoryWrapper, BukkitListenerDrivenInventoryListener { -// private final Inventory inventory; -// private final InventoryWrapperManager manager; -// private final Location location; -// private boolean needUpdate; -// -// public BukkitListenerDrivenInventoryWrapper(@NotNull Inventory inventory, Location location) { -// this.inventory = inventory; -// this.manager = QuickShop.getInstance().getInventoryWrapperManager(); -// this.location = location.clone(); -// QuickShop.getInstance().getInvWrapperUpdateManager().registerListener(this); -// } -// -// @Override -// public boolean notify(Location updated) { -// if (location.equals(updated)) { -// needUpdate = true; -// return true; -// } -// return false; -// } -// -// -// @Override -// public @NotNull InventoryWrapperIterator iterator() { -// return InventoryWrapperIterator.ofBukkitInventory(inventory); -// } -// -// @Override -// public void clear() { -// inventory.clear(); -// } -// -// @Override -// public @NotNull ItemStack[] createSnapshot() { -// ItemStack[] content = this.inventory.getContents(); -// ItemStack[] snapshot = new ItemStack[content.length]; -// for (int i = 0; i < content.length; i++) { -// if (content[i] != null) { -// snapshot[i] = content[i].clone(); -// } else { -// snapshot[i] = null; -// } -// -// } -// return snapshot; -// } -// -// @Override -// public @NotNull InventoryWrapperManager getWrapperManager() { -// return this.manager; -// } -// -// @Override -// public InventoryHolder getHolder() { -// return inventory.getHolder(); -// } -// -// @Override -// public @NotNull InventoryWrapperType getInventoryType() { -// return InventoryWrapperType.BUKKIT; -// } -// -// @Override -// public @Nullable Location getLocation() { -// return inventory.getLocation(); -// } -// -// @Override -// public boolean isValid() { -// if (this.inventory.getHolder() != null) { -// return true; -// } else { -// return this.inventory instanceof InventoryHolder; -// } -// } -// -// @Override -// public boolean isNeedUpdate() { -// return needUpdate; -// } -// -// @Override -// public boolean restoreSnapshot(@NotNull ItemStack[] snapshot) { -// this.inventory.setContents(snapshot); -// return true; -// } -// -// @Override -// public @NotNull Map addItem(ItemStack... itemStacks) { -// return inventory.addItem(itemStacks); -// } -// -// @Override -// public void setContents(ItemStack[] itemStacks) { -// inventory.setStorageContents(itemStacks); -// } -// -// @Override -// public String toString() { -// Map map = new HashMap<>(); -// map.put("inventory", inventory.toString()); -// map.put("location", location.toString()); -// map.put("inventoryType", inventory.getClass().getName()); -// return JsonUtil.getGson().toJson(map); -// } -//} diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/InventoryWrapperUpdateManager.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/InventoryWrapperUpdateManager.java deleted file mode 100644 index dc3d267ebe..0000000000 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/inventory/InventoryWrapperUpdateManager.java +++ /dev/null @@ -1,75 +0,0 @@ -//package com.ghostchu.quickshop.shop.inventory; -// -//import com.ghostchu.quickshop.QuickShop; -//import com.ghostchu.quickshop.listener.AbstractQSListener; -//import com.ghostchu.quickshop.util.Util; -//import com.ghostchu.quickshop.util.logger.Log; -//import com.google.common.collect.Lists; -//import org.bukkit.Bukkit; -//import org.bukkit.Location; -//import org.bukkit.Material; -//import org.bukkit.block.Block; -//import org.bukkit.block.BlockState; -//import org.bukkit.event.EventHandler; -//import org.bukkit.event.EventPriority; -//import org.bukkit.event.block.BlockPlaceEvent; -//import org.bukkit.inventory.DoubleChestInventory; -//import org.bukkit.inventory.InventoryHolder; -// -//import java.lang.ref.WeakReference; -//import java.util.ArrayList; -//import java.util.Iterator; -//import java.util.List; -// -//public class InventoryWrapperUpdateManager extends AbstractQSListener { -// private final List checkList = Lists.newArrayList(Material.CHEST, Material.TRAPPED_CHEST); -// private final List> registeredListeners = new ArrayList<>(); -// -// public InventoryWrapperUpdateManager(QuickShop plugin) { -// super(plugin); -// } -// -// private synchronized void notifyAllListeners(Location... locs) { -// synchronized (registeredListeners) { -// Iterator> it = registeredListeners.iterator(); -// while (it.hasNext()) { -// WeakReference ref = it.next(); -// BukkitListenerDrivenInventoryListener listener = ref.get(); -// if (listener == null) { -// it.remove(); -// continue; -// } -// for (Location loc : locs) { -// try { -// if (listener.notify(loc)) { -// Log.debug("Successfully notified listener " + listener + " which need to be update"); -// } -// } catch (Throwable e) { -// plugin.logger().warn("Failed to notify inventory possible update to listener: {}", listener, e); -// } -// } -// } -// } -// } -// -// public void registerListener(BukkitListenerDrivenInventoryListener listener) { -// this.registeredListeners.add(new WeakReference<>(listener)); -// } -// -// @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) -// public void onInventoryRelatedBlockPlaced(BlockPlaceEvent event) { -// Block placed = event.getBlockPlaced(); -// if (!checkList.contains(placed.getType())) { -// return; -// } -// // Delay 1 tick to allow chest merge -// QuickShop.folia().getImpl().runLater(() -> { -// BlockState state = placed.getState(); -// if (state instanceof InventoryHolder holder) { -// if (holder.getInventory() instanceof DoubleChestInventory doubleChestInventory) { -// Util.asyncThreadRun(() -> notifyAllListeners(doubleChestInventory.getLeftSide().getLocation(), doubleChestInventory.getRightSide().getLocation())); -// } -// } -// }, 1L); -// } -//} diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/HelpChatPastebinPaster.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/HelpChatPastebinPaster.java deleted file mode 100644 index f15a79fbd7..0000000000 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/HelpChatPastebinPaster.java +++ /dev/null @@ -1,80 +0,0 @@ -///* -// * This file is a part of project QuickShop, the name is HelpChatPastebinPaster.java -// * Copyright (C) Ghost_chu and contributors -// * -// * This program is free software: you can redistribute it and/or modify it -// * under the terms of the GNU General Public License as published by the -// * Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program 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 General Public License -// * for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see . -// * -// */ -// -//package com.ghostchu.quickshop.util.paste; -// -//import com.ghostchu.quickshop.common.util.JsonUtil; -//import kong.unirest.HttpResponse; -//import kong.unirest.Unirest; -//import lombok.AllArgsConstructor; -//import lombok.Data; -//import lombok.NoArgsConstructor; -//import org.jetbrains.annotations.NotNull; -// -//import java.io.IOException; -// -///** -// * Paste the paste through https://paste.helpch.at/ -// * -// * @author Ghost_chu -// */ -//public class HelpChatPastebinPaster implements PasteInterface { -// @Override -// @NotNull -// public String pasteTheText(@NotNull String text) throws IOException { -// HttpResponse response = Unirest.post("https://paste.helpch.at/documents") -// .body(text) -// .asString(); -// if (response.isSuccess()) { -// String json = response.getBody(); -// Response resp = JsonUtil.getGson().fromJson(json, Response.class); -// return "https://paste.helpch.at/" + resp.getKey(); -// } else { -// throw new IOException(response.getStatus() + " " + response.getStatusText() + ": " + response.getBody()); -// } -// } -// -// @Override -// public String pasteTheTextJson(@NotNull String text) throws Exception { -// HttpResponse response = Unirest.post("https://paste.helpch.at/documents") -// .body(JsonUtil.getGson().toJson(new JsonPadding(text))) -// .asString(); -// if (response.isSuccess()) { -// String json = response.getBody(); -// Response resp = JsonUtil.getGson().fromJson(json, Response.class); -// return "https://paste.helpch.at/documents/" + resp.getKey(); -// } else { -// throw new IOException(response.getStatus() + " " + response.getStatusText() + ": " + response.getBody()); -// } -// } -// -// @NoArgsConstructor -// @Data -// static class Response { -// private String key; -// } -// -// @AllArgsConstructor -// @Data -// static class JsonPadding { -// private final String _paster = "QuickShop"; -// private String data; -// } -//} -// diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/PastebinPaster.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/PastebinPaster.java deleted file mode 100644 index 02c480ff66..0000000000 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/PastebinPaster.java +++ /dev/null @@ -1,51 +0,0 @@ -///* -// * This file is a part of project QuickShop, the name is PastebinPaster.java -// * Copyright (C) Ghost_chu and contributors -// * -// * This program is free software: you can redistribute it and/or modify it -// * under the terms of the GNU General Public License as published by the -// * Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program 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 General Public License -// * for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see . -// * -// */ -// -//package com.ghostchu.quickshop.util.paste; -// -//import kong.unirest.HttpResponse; -//import kong.unirest.Unirest; -//import org.jetbrains.annotations.NotNull; -// -//import java.io.IOException; -// -//public class PastebinPaster implements PasteInterface { -// private final static String DEVELOPER_KEY = "kYoezdaN6Gg9c2VnY78NcpylWRwdzQdk"; -// -// @Override -// public String pasteTheText(@NotNull String text) throws Exception { -// HttpResponse response = Unirest.post("https://pastebin.com/api/api_post.php") -// .field("api_option","paste") -// .field("api_dev_key",DEVELOPER_KEY) -// .field("api_paste_name","quickshop.paste") -// .field("api_paste_expire_date", "1Y") -// .field("api_paste_code", text) -// .asString(); -// if(response.isSuccess()){ -// return response.getBody(); -// }else{ -// throw new IOException(response.getStatus() + " " + response.getStatusText() + ": " + response.getBody()); -// } -// } -// -// @Override -// public String pasteTheTextDirect(@NotNull String text) throws Exception { -// return null; -// } -//} diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/UbuntuPaster.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/UbuntuPaster.java deleted file mode 100644 index 81341e7555..0000000000 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/UbuntuPaster.java +++ /dev/null @@ -1,77 +0,0 @@ -///* -// * This file is a part of project QuickShop, the name is UbuntuPaster.java -// * Copyright (C) Ghost_chu and contributors -// * -// * This program is free software: you can redistribute it and/or modify it -// * under the terms of the GNU General Public License as published by the -// * Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program 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 General Public License -// * for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see . -// * -// */ -// -//package com.ghostchu.quickshop.util.paste; -// -//import org.jetbrains.annotations.NotNull; -//import com.ghostchu.quickshop.util.Util; -// -//import java.io.BufferedReader; -//import java.io.IOException; -//import java.io.InputStreamReader; -//import java.io.PrintWriter; -//import java.net.URL; -//import java.net.URLConnection; -//import java.net.URLEncoder; -//import java.nio.charset.StandardCharsets; -// -//public class UbuntuPaster implements PasteInterface { -// /** -// * Paste a text to paste.ubuntu.com -// * -// * @param text The text you want paste. -// * @return Target paste URL. -// * @throws IOException the throws -// */ -// @Override -// @NotNull -// public String pasteTheText(@NotNull String text) throws IOException { -// URL url = new URL("https://paste.ubuntu.com"); -// URLConnection conn = url.openConnection(); -// conn.setRequestProperty("accept", "*/*"); -// conn.setRequestProperty("connection", "Keep-Alive"); -// conn.setRequestProperty( -// "user-agent", -// "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"); -// conn.setDoOutput(true); -// conn.setDoInput(true); -// conn.setConnectTimeout(50000); -// conn.setReadTimeout(100000); -// -// PrintWriter out = new PrintWriter(conn.getOutputStream()); -// // poster=aaaaaaa&syntax=text&expiration=&content=%21%40 -// String builder = -// "poster=" -// + "QuickShop Paster" -// + "&syntax=text" -// + "&expiration=week" -// + "&content=" -// + URLEncoder.encode(text, StandardCharsets.UTF_8); -// out.print(builder); -// out.flush(); // Drop -// -// BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); -// Log.debug("Request Completed: " + conn.getURL()); -// String link = conn.getURL().toString(); -// in.close(); -// out.close(); -// return link; -// } -// -//} From 57353a730c0ab91006ca250d76835c2b01e21428 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 22 Nov 2024 14:01:38 -0500 Subject: [PATCH 10/11] Update H2 Library in libraries.maven, fix /qs list page argument parsing. --- .../ghostchu/quickshop/addon/list/command/SubCommand_List.java | 2 +- quickshop-bukkit/pom.xml | 2 +- quickshop-bukkit/src/main/resources/libraries.maven | 2 +- quickshop-bukkit/src/main/resources/plugin.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addon/list/src/main/java/com/ghostchu/quickshop/addon/list/command/SubCommand_List.java b/addon/list/src/main/java/com/ghostchu/quickshop/addon/list/command/SubCommand_List.java index 3022bf1864..2c271339e9 100644 --- a/addon/list/src/main/java/com/ghostchu/quickshop/addon/list/command/SubCommand_List.java +++ b/addon/list/src/main/java/com/ghostchu/quickshop/addon/list/command/SubCommand_List.java @@ -48,7 +48,7 @@ public void onCommand(final Player sender, @NotNull final String commandLabel, @ quickshop.text().of(sender, "not-a-number", parser.getArgs().get(1)).send(); return; } - page = Integer.parseInt(parser.getArgs().get(2)); + page = Integer.parseInt(parser.getArgs().get(1)); } lookupOther(sender, parser.getArgs().get(0), page); } else { diff --git a/quickshop-bukkit/pom.xml b/quickshop-bukkit/pom.xml index a454fafec6..4d26db6d6b 100644 --- a/quickshop-bukkit/pom.xml +++ b/quickshop-bukkit/pom.xml @@ -333,7 +333,7 @@ com.h2database h2 - 2.1.214 + 2.2.224 provided true diff --git a/quickshop-bukkit/src/main/resources/libraries.maven b/quickshop-bukkit/src/main/resources/libraries.maven index dc37867346..dcda4d66dc 100644 --- a/quickshop-bukkit/src/main/resources/libraries.maven +++ b/quickshop-bukkit/src/main/resources/libraries.maven @@ -4,7 +4,7 @@ com.google.code.gson:gson:2.10.1@com.google.gson.Gson com.google.guava:guava:33.1.0-jre com.rollbar:rollbar-java:1.9.0@com.rollbar.notifier.Rollbar cc.carm.lib:easysql-hikaricp:0.4.7@cc.carm.lib.easysql.hikari.HikariDataSource -com.h2database:h2:2.1.214@org.h2.Driver +com.h2database:h2:2.2.224@org.h2.Driver com.konghq:unirest-java:3.14.5@kong.unirest.Unirest net.sourceforge.csvjdbc:csvjdbc:1.0.42@org.relique.jdbc.csv.CsvDriver org.dom4j:dom4j:2.1.4@org.dom4j.io.SAXReader diff --git a/quickshop-bukkit/src/main/resources/plugin.yml b/quickshop-bukkit/src/main/resources/plugin.yml index 89ebb72ead..07d73498e7 100644 --- a/quickshop-bukkit/src/main/resources/plugin.yml +++ b/quickshop-bukkit/src/main/resources/plugin.yml @@ -30,7 +30,7 @@ api-version: 1.18 # - com.rollbar:rollbar-java:1.9.0 # - commons-codec:commons-codec:1.15 # - cc.carm.lib:easysql-hikaricp:0.4.7 -# - com.h2database:h2:2.1.214 +# - com.h2database:h2:2.2.224 # - com.ghostchu:simplereloadlib:1.1.2 # - com.konghq:unirest-java:3.14.5 # - com.github.juliomarcopineda:jdbc-stream:0.1.1 From 7593ccf4f451aeed7c7a7dadcd80f711846e7788 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Thu, 26 Dec 2024 15:32:23 -0500 Subject: [PATCH 11/11] Finish some updates to revamped serialization. --- .gitignore | 1 + quickshop-bukkit/pom.xml | 2 +- .../com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java | 2 +- .../src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java | 2 ++ quickshop-bukkit/src/main/resources/libraries.maven | 2 +- quickshop-bukkit/src/main/resources/plugin.yml | 2 +- 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 915cecb3d6..a5f18b9331 100644 --- a/.gitignore +++ b/.gitignore @@ -118,3 +118,4 @@ run/ /${rootDir}/build-artifacts/quickshop-hikari-6.2.0.7-shaded.pom /${rootDir}/build-artifacts/quickshop-hikari-6.2.0.7-shaded-sources.pom /${rootDir}/build-artifacts/quickshop-hikari-6.2.0.7-shaded-test-sources.pom +.paper-nms/ diff --git a/quickshop-bukkit/pom.xml b/quickshop-bukkit/pom.xml index 4d26db6d6b..a454fafec6 100644 --- a/quickshop-bukkit/pom.xml +++ b/quickshop-bukkit/pom.xml @@ -333,7 +333,7 @@ com.h2database h2 - 2.2.224 + 2.1.214 provided true diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java index a9c9d11ccc..1c0bd8f728 100644 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java +++ b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java @@ -936,7 +936,7 @@ public void upgrade() { int currentDatabaseVersion = parent.getDatabaseVersion(); if(currentDatabaseVersion == -1) { - currentDatabaseVersion = 11; + currentDatabaseVersion = 17; } if(currentDatabaseVersion > parent.LATEST_DATABASE_VERSION) { throw new IllegalStateException("The database version is newer than this build supported."); diff --git a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java index 8f6c2d3a7d..e2657a6026 100644 --- a/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java +++ b/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java @@ -337,6 +337,7 @@ public static class DataRawDatabaseInfo { this.invWrapper = dataRecord.getInventoryWrapper(); this.benefits = SimpleBenefit.deserialize(dataRecord.getBenefit()); final String permissionJson = dataRecord.getPermissions(); + if(!StringUtils.isEmpty(permissionJson) && CommonUtil.isJson(permissionJson)) { final Type typeToken = new TypeToken>() { }.getType(); @@ -344,6 +345,7 @@ public static class DataRawDatabaseInfo { } else { this.permissions = new HashMap<>(); } + this.item = deserializeItem(dataRecord.getItem()); if(!dataRecord.getEncoded().isEmpty()) { diff --git a/quickshop-bukkit/src/main/resources/libraries.maven b/quickshop-bukkit/src/main/resources/libraries.maven index dcda4d66dc..dc37867346 100644 --- a/quickshop-bukkit/src/main/resources/libraries.maven +++ b/quickshop-bukkit/src/main/resources/libraries.maven @@ -4,7 +4,7 @@ com.google.code.gson:gson:2.10.1@com.google.gson.Gson com.google.guava:guava:33.1.0-jre com.rollbar:rollbar-java:1.9.0@com.rollbar.notifier.Rollbar cc.carm.lib:easysql-hikaricp:0.4.7@cc.carm.lib.easysql.hikari.HikariDataSource -com.h2database:h2:2.2.224@org.h2.Driver +com.h2database:h2:2.1.214@org.h2.Driver com.konghq:unirest-java:3.14.5@kong.unirest.Unirest net.sourceforge.csvjdbc:csvjdbc:1.0.42@org.relique.jdbc.csv.CsvDriver org.dom4j:dom4j:2.1.4@org.dom4j.io.SAXReader diff --git a/quickshop-bukkit/src/main/resources/plugin.yml b/quickshop-bukkit/src/main/resources/plugin.yml index 07d73498e7..89ebb72ead 100644 --- a/quickshop-bukkit/src/main/resources/plugin.yml +++ b/quickshop-bukkit/src/main/resources/plugin.yml @@ -30,7 +30,7 @@ api-version: 1.18 # - com.rollbar:rollbar-java:1.9.0 # - commons-codec:commons-codec:1.15 # - cc.carm.lib:easysql-hikaricp:0.4.7 -# - com.h2database:h2:2.2.224 +# - com.h2database:h2:2.1.214 # - com.ghostchu:simplereloadlib:1.1.2 # - com.konghq:unirest-java:3.14.5 # - com.github.juliomarcopineda:jdbc-stream:0.1.1