Skip to content

Vibe coded#70

Open
LotusRPG wants to merge 1 commit into
magemonkeystudio:devfrom
LotusRPG:lotus-changes-plugin
Open

Vibe coded#70
LotusRPG wants to merge 1 commit into
magemonkeystudio:devfrom
LotusRPG:lotus-changes-plugin

Conversation

@LotusRPG

@LotusRPG LotusRPG commented May 15, 2026

Copy link
Copy Markdown

Copied from copilot:

1. Fuel System (NEW)

  • FuelManager.java – Global server fuel counter with persistent storage (fuel.yml)
    • addFuel() / consumeFuel() / setFuel() methods
    • addFuelFromInventory() – consume fuel items from player inventory, get return items
    • Clamped to [0, max] range
  • FuelItem.java – Represents one fuel type (coal, coal_block, blaze_rod, etc.)
    • Material, fuel amount per item, optional return material
    • createDisplayItem() for GUI rendering
  • FuelGUI.java (NEW) – Interactive GUI to add fuel from inventory
    • Displays fuel items and current/max tank status
    • Color-coded status bar (red/yellow/green)
    • Sound feedback on success/failure
  • Config integration – Loaded in Cfg.java with defaults for coal, coal_block, blaze_rod
  • Commands/craft fuel [add|remove|set|check|gui] with admin-only access

2. Divinity Module Items (Major Enhancement)

Added comprehensive support for Divinity's module-prefixed items (not just plain DIVINITY_):

  • New prefixes: DIV_ITEMGEN_, DIV_GEM_, DIV_ESSENCE_, DIV_RUNE_, DIV_EXTRACTOR_, DIV_ARROW_, DIV_CONSUMABLE_, DIV_CUSTOM_, DIV_FORTIFY_, DIV_IDENTIFY_, DIV_DUST_, DIV_REPAIR_, DIV_DISMANTLE_, DIV_REFINE_
  • DivinityModuleItemType.java (NEW) – Wraps module items with optional enchantment stripping (_NOENCH suffix for generators)
  • RecipeItem.java – Massively refactored to parse DIV_ formats:
    • Backward-compat: old ~level:N:AMT format
    • New format: DIV_MODULE_ID:AMT[:LVL[:TYPE]] with flexible parameter parsing
    • Level wildcard (lvl=-1) for items without level constraints
    • Tab completion hints for all module item types
  • RecipeCustomItem.java – Added originalKey and displayCache to avoid re-generating random stats on every GUI render
  • RecipeTagItem.java (NEW) – Support for Bukkit tags (e.g., TAG_PLANKS:4) – accept any material in a tag

3. Recipe Station & Fuel Cost (NEW Recipe Conditions)

  • ProfessionConditions.java – Added station and fuelCost fields
    • Serialization/deserialization support
  • Recipe.java – Added station field
  • CalculatedRecipe.java – Integrated station check:
    • StationChecker.hasStation() – validates player has access to required station
    • Displays station requirement in lore (with pretty Divinity name formatting)
    • Prevents crafting if station missing
  • CraftingRequirementsCfg.java – New getStationLine() method with station-specific formatting
  • FusionEditorCommand.java – Two new editor criteria:
    • Profession_Recipe_Edit_Station – command to set station
    • Profession_Recipe_Edit_FuelCost – command to set fuel cost

4. Recipe Ingredient Matching (Smart Item Comparison)

  • CalculatedRecipe.java – Refactored ingredient checking:
    • IngredientFingerprint.forRequired() – build fingerprints for Divinity items without forcing a level generation
    • Level wildcard (-1) allows matching any level version of the same item
    • sumMatchingEntries() / drainFromMap() – handle wildcard matching across inventory
    • Proper support for tag items (sum/drain logic for tagged materials)
  • CommandMechanics.java – Fixed showIngredientUsage() and forceShow() to detect DIV module items correctly (don't use isSimilar() for generated items)

5. Category & Editor Improvements

  • Category.java – Added slot field for explicit category positioning in GUI
    • serialize()/deserialization updated
    • getDisplayIcon() – use displayName if present, else fall back to category name
  • CategoryGui.java – Rewritten slot logic to handle explicit slots + auto-placement
    • Categories with slot >= 0 placed at that index
    • Remaining categories auto-placed in free slots
  • CraftingTable.java – New copyForEditor() method to deduplicate ItemGen pseudo-recipes (name::material format) for faster editor loading
  • EditorRegistry.java – Added Inventory → Editor mapping to track which inventory is open
    • registerInventory() / unregisterInventory() / getEditorByInventory()
    • Prevents editor state confusion with nested GUIs
  • FusionEditorCommand.java – Major refactoring:
    • Better command syntax hints (show DIV item list on /craft editor itemgen)
    • Fixed tab completion for DIV items with level/material parameters
    • Improved editor cleanup on command failure
    • buildItemConfigString() helper to construct full config strings

6. Bug Fixes & Quality of Life

  • PlayerLoader.java – Changed TreeMapConcurrentHashMap (thread-safe)
    • Replaced manual containsKey + put with computeIfAbsent()
    • Safer for concurrent access
  • FusionPlayer.java – Fixed shutdown save race condition:
    • Now checks !isEnabled() to run save synchronously during plugin disable
    • Prevents scheduler from canceling async task mid-save
    • Added finally block to unlock player even if save fails
  • ShowRecipesCfg.java – Fixed template placeholder replacement:
    • Changed from MessageUtil.getReplacement() calls to direct $<placeholder> and <placeholder> replacement
    • More robust handling of template variables
  • RecipeEditorCfg.java – Safe null check for recipe result items
    • Falls back to PAPER if result is null/air
    • Added station and fuel cost to lore display
  • ProfessionLevelCfg.java – Safe map access with getOrDefault()
  • BrowseProfessionCfg.java – Fixed variable name bug (itempatternItem)
  • Cfg.java – Fixed auto-join profession logic:
    • Check if profession table exists before joining
    • Use FusionAPI service instead of deprecated BrowseGUI method
  • ProfessionsCfg.java – Call TabCacher.clearAllCaches() after reloading
  • ProfessionResults.java – Fixed hasCommandsOrItems() to NOT require exp (only commands/items)
  • CraftingTable.java – Better error messages for duplicate category names and unknown category references

7. Dependency Update

  • pom.xml – Updated Divinity dependency: 1.0.2-R0.47-SNAPSHOT1.0.2-R0.57-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant