-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5.2.0.2 #1143
Conversation
WalkthroughThis pull request primarily updates the version of Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 3
Files ignored due to filter (36)
- crowdin/lang/af-ZA/messages.yml
- crowdin/lang/ar-SA/messages.yml
- crowdin/lang/bg-BG/messages.yml
- crowdin/lang/ca-ES/messages.yml
- crowdin/lang/cs-CZ/messages.yml
- crowdin/lang/da-DK/messages.yml
- crowdin/lang/de-DE/messages.yml
- crowdin/lang/el-GR/messages.yml
- crowdin/lang/en-US/messages.yml
- crowdin/lang/es-ES/messages.yml
- crowdin/lang/fi-FI/messages.yml
- crowdin/lang/fr-FR/messages.yml
- crowdin/lang/he-IL/messages.yml
- crowdin/lang/hi-IN/messages.yml
- crowdin/lang/hu-HU/messages.yml
- crowdin/lang/it-IT/messages.yml
- crowdin/lang/ja-JP/messages.yml
- crowdin/lang/ko-KR/messages.yml
- crowdin/lang/lt-LT/messages.yml
- crowdin/lang/nl-NL/messages.yml
- crowdin/lang/no-NO/messages.yml
- crowdin/lang/pl-PL/messages.yml
- crowdin/lang/pt-BR/messages.yml
- crowdin/lang/pt-PT/messages.yml
- crowdin/lang/ro-RO/messages.yml
- crowdin/lang/ru-RU/messages.yml
- crowdin/lang/sr-SP/messages.yml
- crowdin/lang/sv-SE/messages.yml
- crowdin/lang/th-TH/messages.yml
- crowdin/lang/tr-TR/messages.yml
- crowdin/lang/uk-UA/messages.yml
- crowdin/lang/vi-VN/messages.yml
- crowdin/lang/zh-CN/messages.yml
- crowdin/lang/zh-HK/messages.yml
- crowdin/lang/zh-TW/messages.yml
- quickshop-bukkit/src/main/resources/lang/messages.yml
Files selected for processing (32)
- addon/bluemap/pom.xml (1 hunks)
- addon/bluemap/src/main/java/com/ghostchu/quickshop/addon/bluemap/Main.java (6 hunks)
- addon/discordsrv/pom.xml (1 hunks)
- addon/discordsrv/src/main/java/com/ghostchu/quickshop/addon/discordsrv/listener/QuickShopEventListener.java (1 hunks)
- addon/discordsrv/src/main/java/com/ghostchu/quickshop/addon/discordsrv/message/MessageManager.java (1 hunks)
- addon/discordsrv/src/main/java/com/ghostchu/quickshop/addon/discordsrv/message/MessageRepository.java (1 hunks)
- addon/discount/pom.xml (1 hunks)
- addon/discount/src/main/java/com/ghostchu/quickshop/addon/discount/command/DiscountCommand.java (1 hunks)
- addon/discount/src/main/java/com/ghostchu/quickshop/addon/discount/listener/MainListener.java (1 hunks)
- addon/displaycontrol/pom.xml (1 hunks)
- addon/dynmap/pom.xml (1 hunks)
- addon/dynmap/src/main/java/com/ghostchu/quickshop/addon/dynmap/Main.java (1 hunks)
- addon/limited/pom.xml (1 hunks)
- addon/limited/src/main/java/com/ghostchu/quickshop/addon/limited/command/SubCommand_Limit.java (1 hunks)
- addon/list/pom.xml (1 hunks)
- addon/plan/pom.xml (2 hunks)
- addon/reremake-migrator/pom.xml (4 hunks)
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/Main.java (3 hunks)
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/command/SubCommand_ReremakeMigrate.java (2 hunks)
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/AbstractMigrateComponent.java (2 hunks)
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/ConfigMigrate.java (5 hunks)
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/MigrateComponent.java (1 hunks)
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/ShopMigrate.java (4 hunks)
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/TranslationMigrateComponent.java (1 hunks)
- addon/shopitemonly/pom.xml (1 hunks)
- compatibility/advancedregionmarket/pom.xml (2 hunks)
- compatibility/angelchest/pom.xml (2 hunks)
- compatibility/bentobox/pom.xml (2 hunks)
- compatibility/bungeecord-geyser/pom.xml (2 hunks)
- compatibility/bungeecord/pom.xml (2 hunks)
- compatibility/chestprotect/pom.xml (2 hunks)
- compatibility/clearlag/pom.xml (2 hunks)
Files not processed due to max files limit (101)
- compatibility/common/pom.xml
- compatibility/ecoenchants/pom.xml
- compatibility/elitemobs/pom.xml
- compatibility/griefprevention/pom.xml
- compatibility/lands/pom.xml
- compatibility/openinv/pom.xml
- compatibility/plotsquared/pom.xml
- compatibility/reforges/pom.xml
- compatibility/residence/pom.xml
- compatibility/superiorskyblock/pom.xml
- compatibility/towny/pom.xml
- compatibility/velocity/pom.xml
- compatibility/worldedit/pom.xml
- compatibility/worldguard/pom.xml
- platform/quickshop-platform-interface/pom.xml
- platform/quickshop-platform-interface/src/main/java/com/ghostchu/quickshop/platform/Platform.java
- platform/quickshop-platform-paper/pom.xml
- platform/quickshop-platform-spigot-abstract/pom.xml
- platform/quickshop-platform-spigot-abstract/src/main/java/com/ghostchu/quickshop/platform/spigot/AbstractSpigotPlatform.java
- platform/quickshop-platform-spigot-v1_18_R1/pom.xml
- platform/quickshop-platform-spigot-v1_18_R2/pom.xml
- platform/quickshop-platform-spigot-v1_19_R1/pom.xml
- platform/quickshop-platform-spigot-v1_19_R2/pom.xml
- platform/quickshop-platform-spigot-v1_19_R3/pom.xml
- platform/quickshop-platform-spigot-v1_20_R1/pom.xml
- platform/quickshop-platform-spigot-v1_20_R2/pom.xml
- pom.xml
- quickshop-api/pom.xml
- quickshop-api/src/main/java/com/ghostchu/quickshop/api/command/CommandHandler.java
- quickshop-api/src/main/java/com/ghostchu/quickshop/api/command/CommandParser.java
- quickshop-api/src/main/java/com/ghostchu/quickshop/api/database/DatabaseHelper.java
- quickshop-api/src/main/java/com/ghostchu/quickshop/api/database/ShopMetricRecord.java
- quickshop-api/src/main/java/com/ghostchu/quickshop/api/economy/EconomyCore.java
- quickshop-api/src/main/java/com/ghostchu/quickshop/api/event/ShopPreCreateEvent.java
- quickshop-api/src/main/java/com/ghostchu/quickshop/api/shop/PlayerFinder.java
- quickshop-api/src/main/java/com/ghostchu/quickshop/api/shop/ShopInfoStorage.java
- quickshop-bukkit/pom.xml
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/QuickShop.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/QuickShopBukkit.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/SimpleCommandManager.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/subcommand/SubCommand_Debug.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/subcommand/SubCommand_FetchMessage.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/subcommand/SubCommand_Lookup.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/subcommand/SubCommand_Paste.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/subcommand/SubCommand_Price.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/subcommand/SubCommand_Staff.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/subcommand/SubCommand_SuperCreate.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/command/subcommand/SubCommand_TaxAccount.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/converter/HikariConfigConverter.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/converter/HikariConverter.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/converter/HikariConverterInterface.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/converter/HikariDatabaseConverter.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/DataTables.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/DatabaseIOUtil.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV1.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/SimpleDatabaseHelperV2.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/database/bean/SimpleDataRecord.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/economy/Economy_TNE.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/economy/SimpleEconomyTransaction.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/eventmanager/QSEventManager.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/listener/AbstractProtectionListener.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/listener/ChunkListener.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/listener/PlayerListener.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/localization/text/SimpleTextManager.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/papi/PAPISubHandler.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/papi/impl/MetadataPAPI.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/papi/impl/PurchasesPAPI.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/papi/impl/TransactionAmountPAPI.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopLoader.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/ShopPurger.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/SimpleInventoryTransaction.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/SimplePriceLimiter.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/SimpleShopChunk.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/SimpleShopItemBlackList.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/SimpleShopManager.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/cache/SimpleShopCache.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/display/AbstractDisplayItem.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/display/RealDisplayItem.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/display/virtual/VirtualDisplayItemManager.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/display/virtual/packetfactory/v1_19_R2_TO_v1_20_R1.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/shop/display/virtual/packetfactory/v1_20_R2.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/ExpiringSet.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/FastPlayerFinder.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/MsgUtil.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/ProgressMonitor.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/Util.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/config/ConfigUpdateScript.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/config/ConfigurationUpdater.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/envcheck/EnvironmentChecker.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/logger/Log.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/logging/container/EconomyTransactionLog.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/metric/MetricCollectEntry.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/metric/MetricManager.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/item/PerformanceLogsItem.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/item/PermissionLogsItem.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/item/TimingsLogsItem.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/item/TransactionLogsItem.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/paste/util/HTMLTable.java
- quickshop-bukkit/src/main/java/com/ghostchu/quickshop/util/reporter/error/RollbarErrorReporter.java
- quickshop-common/pom.xml
- quickshop-common/src/main/java/com/ghostchu/quickshop/common/util/QuickExecutor.java
Files skipped from review due to trivial changes (28)
- addon/bluemap/pom.xml
- addon/bluemap/src/main/java/com/ghostchu/quickshop/addon/bluemap/Main.java
- addon/discordsrv/pom.xml
- addon/discordsrv/src/main/java/com/ghostchu/quickshop/addon/discordsrv/listener/QuickShopEventListener.java
- addon/discordsrv/src/main/java/com/ghostchu/quickshop/addon/discordsrv/message/MessageManager.java
- addon/discordsrv/src/main/java/com/ghostchu/quickshop/addon/discordsrv/message/MessageRepository.java
- addon/discount/pom.xml
- addon/discount/src/main/java/com/ghostchu/quickshop/addon/discount/command/DiscountCommand.java
- addon/discount/src/main/java/com/ghostchu/quickshop/addon/discount/listener/MainListener.java
- addon/displaycontrol/pom.xml
- addon/dynmap/pom.xml
- addon/dynmap/src/main/java/com/ghostchu/quickshop/addon/dynmap/Main.java
- addon/limited/pom.xml
- addon/limited/src/main/java/com/ghostchu/quickshop/addon/limited/command/SubCommand_Limit.java
- addon/list/pom.xml
- addon/plan/pom.xml
- addon/reremake-migrator/pom.xml
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/Main.java
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/ConfigMigrate.java
- addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/ShopMigrate.java
- addon/shopitemonly/pom.xml
- compatibility/advancedregionmarket/pom.xml
- compatibility/angelchest/pom.xml
- compatibility/bentobox/pom.xml
- compatibility/bungeecord-geyser/pom.xml
- compatibility/bungeecord/pom.xml
- compatibility/chestprotect/pom.xml
- compatibility/clearlag/pom.xml
Additional comments (Suppressed): 6
addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/AbstractMigrateComponent.java (2)
15-20: The constructor of
AbstractMigrateComponent
has been updated to include a new parameterCommandSender sender
. Ensure that all calls to this constructor throughout the codebase have been updated to match the new signature.33-49: A new method
getSender()
is added to return theCommandSender
object. Also, a new methodtext(String modulePath, Object... objects)
is introduced which seems to be used for localization or internationalization purposes. Make sure that the usage of these methods is consistent across the codebase and they are properly tested.addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/command/SubCommand_ReremakeMigrate.java (2)
8-8: A new import statement has been added for the
TranslationMigrateComponent
class. Ensure that this class is properly implemented and available in the project.49-49: A new instance of
TranslationMigrateComponent
is being added to themigrateComponentList
. Make sure that themigrate()
method ofTranslationMigrateComponent
is implemented correctly and doesn't introduce any side effects or performance issues.addon/reremake-migrator/src/main/java/com/ghostchu/quickshop/addon/reremakemigrator/migratecomponent/TranslationMigrateComponent.java (2)
40-43: When an exception is caught, it's logged but the execution continues. If a file fails to migrate, the rest of the files will still be processed. Depending on the use case, you might want to stop the entire process if a single file fails to migrate. Please verify the desired behavior.
88-93: Similar to the previous comment, there's no handling for the scenario where the file creation fails. If
targetLangFile.createNewFile()
returnsfalse
, a warning is logged, but the execution continues. Depending on the use case, you might want to stop the entire process if a file can't be created. Please verify the desired behavior.
text("modules.translation.start-migrate").send(); | ||
File reremakeOverrideFolder = new File(getReremake().getDataFolder(), "overrides"); | ||
if (!reremakeOverrideFolder.exists()) return true; | ||
File[] fileTree = reremakeOverrideFolder.listFiles(); | ||
if (fileTree == null) { | ||
getHikari().logger().warn("Skipping translation migrate (no file tree)"); | ||
return true; | ||
} | ||
|
||
for (File langFolder : new ProgressMonitor<>(fileTree, (triple) -> text("modules.translation.migrate-entry", triple.getRight().getName(), triple.getLeft(), triple.getMiddle()))) { | ||
File langJsonFile = new File(langFolder, "messages.json"); | ||
if (!langJsonFile.exists()) continue; | ||
try { | ||
migrateFile(langFolder, langJsonFile); | ||
} catch (Exception exception) { | ||
getHikari().logger().warn("Failed migrate lang file " + langJsonFile.getName() + ".", exception); | ||
} | ||
} | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The migrate
method always returns true
, regardless of whether the migration was successful or not. This could lead to misleading results, as a failure in the migration process would still be reported as a success. Consider returning false
when an error occurs during the migration process.
private void migrateFile(File langFolder, File langJsonFile) throws IOException { | ||
File hikariOverrideFolder = new File(getHikari().getDataFolder(), "overrides"); | ||
File targetLangFolder = new File(hikariOverrideFolder, langFolder.getName()); | ||
if (!targetLangFolder.exists()) { | ||
if (!targetLangFolder.mkdirs()) { | ||
throw new IOException("Failed to create lang " + langFolder.getName() + " directory."); | ||
} | ||
} | ||
JsonConfiguration jsonConfiguration = JsonConfiguration.loadConfiguration(langJsonFile); | ||
YamlConfiguration yamlConfiguration = new YamlConfiguration(); | ||
File targetLangFile = new File(targetLangFolder, langJsonFile.getName().replace(".json", ".yml")); | ||
if (targetLangFile.exists()) { | ||
yamlConfiguration = YamlConfiguration.loadConfiguration(targetLangFile); | ||
} | ||
getHikari().logger().info("Migrating the Reremake language file: " + langJsonFile.getAbsolutePath() + "..."); | ||
Set<String> keys = jsonConfiguration.getKeys(true); | ||
text("modules.translation.copy-values", targetLangFolder.getName(), keys.size()).send(); | ||
for (String key : new ProgressMonitor<>(keys, (triple) -> text("modules.translation.copying-value", triple.getRight(), triple.getLeft(), triple.getMiddle()).send())) { | ||
if (key.equals("_comment")) continue; | ||
if (jsonConfiguration.isConfigurationSection(key)) continue; | ||
if (jsonConfiguration.isString(key)) { | ||
String originalValue = jsonConfiguration.getString(key); | ||
Component component = MineDown.parse(originalValue).compact(); | ||
String convertedValue = MiniMessage.miniMessage().serialize(component); | ||
yamlConfiguration.set(key, convertedValue); | ||
} else { | ||
if (jsonConfiguration.isList(key)) { | ||
List<String> list = jsonConfiguration.getStringList(key); | ||
List<String> convert = new ArrayList<>(); | ||
list.forEach(s -> { | ||
Component component = MineDown.parse(s).compact(); | ||
String convertedValue = MiniMessage.miniMessage().serialize(component); | ||
convert.add(convertedValue); | ||
}); | ||
yamlConfiguration.set(key, convert); | ||
} else { | ||
yamlConfiguration.set(key, jsonConfiguration.get(key)); | ||
} | ||
} | ||
} | ||
if (!targetLangFile.exists()) { | ||
if (!targetLangFile.createNewFile()) { | ||
getHikari().logger().warn("Couldn't save converted data to file: file creation failed"); | ||
return; | ||
} | ||
} | ||
yamlConfiguration.save(targetLangFile); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The migrateFile
method is quite long and does several things: it creates directories if they don't exist, loads configurations, migrates data from JSON to YAML, and saves the result. Consider breaking this method down into smaller, more manageable methods each with a single responsibility. This will improve readability and maintainability.
File hikariOverrideFolder = new File(getHikari().getDataFolder(), "overrides"); | ||
File targetLangFolder = new File(hikariOverrideFolder, langFolder.getName()); | ||
if (!targetLangFolder.exists()) { | ||
if (!targetLangFolder.mkdirs()) { | ||
throw new IOException("Failed to create lang " + langFolder.getName() + " directory."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no handling for the scenario where the directory creation fails. If targetLangFolder.mkdirs()
returns false
, an IOException
is thrown, but it's not caught anywhere. This could lead to unexpected termination of the program. Consider adding error handling for this scenario.
Qodana Community for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
Summary by CodeRabbit
TranslationMigrateComponent
for migrating language files from JSON to YAML format.quickshop-hikari
library version from5.2.0.1
to5.2.0.2
across multiple modules, indicating bug fixes and updates in the library.Main
,DiscountCommand
,MainListener
, andShopMigrate
.