perf & fix: performance optimizations + bug fixes#88
Open
mtynnn wants to merge 6 commits intomehboss:masterfrom
Open
perf & fix: performance optimizations + bug fixes#88mtynnn wants to merge 6 commits intomehboss:masterfrom
mtynnn wants to merge 6 commits intomehboss:masterfrom
Conversation
- Added UTF-8 encoding to maven-compiler-plugin - Temporarily commented out HavenBags dependency (jitpack.io unreachable) - Key findings: Spigot 1.21.5 requires Java 17+, no tests in project
Replace direct Main.getInstance().field access with proper getters/setters (e.g. getRecipeUtil(), getCooldownManager(), isDebug()/setCrafterDebug()) across multiple managers and command classes to improve encapsulation and prepare for API changes. Fix SmithingManager behavior: ensure meta-check failures null the result, copy persistent data container when copying enchants, handle leftover inventory items by dropping them, and clean up local variables/imports. Update Maven and shaded POMs (add item-nbt-api, register SCore as a system dependency, bump some dependency versions, set compiler encoding) and update resources/plugin.yml to api-version '1.21' and simplify softdepends. Add IDE settings (.classpath/.project/.settings), include SCore-5.26.3.2.jar and build_output.txt, and add a new .github agent markdown. These changes are aimed at modernization, encapsulation, and compatibility with newer Paper/Spigot API versions.
Smithing table fix for eco plugins
Add robust handling and detailed logging for crafting result clicks and item removals. Key changes: - AmountManager: extended handling to InventoryClickEvent (result-slot tracing), dedupe rapid duplicate events, added handleResultClickInternal and traceResultSlotClicks, improved logic for computing craft counts and precise item removals, safer leftover/container handling, clamped cursor/result stack updates, and many targeted DEBUG-ITEMREMOVAL logs to diagnose removal issues. - CraftManager: safer NBT reads with try/catch, additional debug logs for validation, and sanitizeCraftingMatrix() to clamp invalid stack sizes / remove zero-or-negative stacks before recipe matching. - Main: register debug warnings about AmountManager listener and check CraftItemEvent listener counts on startup to help trace registration/dispatch issues. These changes aim to prevent ghost/duplicate crafts, NBT-related exceptions, incorrect stack arithmetic, and to make it easier to trace and debug crafting/item-removal bugs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes included
Performance (100 concurrent players)
getRecipeFromKey(): O(n) → O(1) with synchronized HashMap indexgetRecipesFromType(): O(n) + new HashMap → O(1) with EnumMap indexisCustomItem(): for-loop →Set.of().contains()EffectsManager: YAML disk read per-event → in-memory cache (critical for combat)EffectsManager: triplegetRecipeFromKey()per event → single lookupclone()to prevent shared mutation bugBug fixes
CUSTOM_ITEM_IDENTIFERfixed in 4 files (effects and block placement never worked)BlockManager/EffectsManager: stale RecipeUtil reference after/crecipe reloadfixedEffectsManager:ArrayIndexOutOfBoundsExceptionin effects loop fixedSmithingManager:setResult(null)on meta-check rejection (prevents re-use exploit)SmithingManager: items lost when inventory is full on smithing craft fixedCommandGive: negative/oversized amount exploit fixed (/crecipe give player item -1)/crecipe reloadviaeffectsManager.invalidateConfigCache()