Список изменений
ValoCraft 1.6.0 → 1.6.1 — Bug-fix patch
This patch fixes the 3 reported issues, plus 2 side bugs found while digging through the same code. Nothing else was touched (no rewrite, no new feature beyond what's needed to fix firing).
1. "Pistols don't fire"
Real cause: WeaponPlayerListener — the class meant to handle firing —
existed but was a completely empty stub, and wasn't even registered as a
listener in ValoCraft.onEnable(). As a result, no weapon ever "fired";
only direct melee (touching the enemy while standing right next to them)
dealt damage, via DamageSystem listening to EntityDamageByEntityEvent.
Fix:
listeners/WeaponPlayerListener.javanow implements real firing: right-click → raytrace along the player's look direction (blocked by blocks, so no shooting through walls) → if a player is hit within the weapon's range, they take damage.- A fire-rate cooldown (
Weapon.getFireRate()) prevents click-spamming. - Actual damage is still computed by
DamageSystem(headshot/leg multipliers included) — this listener only determines who gets hit. - Ranges per weapon type: Pistol 30, SMG 25, Shotgun 12, Rifle 60, Heavy 45, Sniper 120 blocks (the knife stays melee-only).
- Firing is only possible during the
ROUNDphase (not during the buy phase). - Registered in
ValoCraft.onEnable().
2. "Abilities aren't shown with items"
Real cause: AgentManager already routes clicks on hotbar slots 3-6
(index 2-5) to useAbility1/2/Signature/Ultimate, but nothing ever
filled those slots — they stayed empty (air). Players had to "guess"
which slot corresponded to which ability.
Fix: new AgentManager.giveAbilityItems(Player) method that creates one
item per ability (C = Emerald, Q = Diamond, E = Lapis, X = Amethyst) with
the agent's real ability name/description (pulled from AgentCatalog), and
places them in slots SLOT_C..SLOT_X. It's called at the start of every buy
phase in RoundManager, alongside the knife.
3. "The shop isn't on the 9th slot, it wastes an ability slot"
Real cause — directly linked to bug #2: RoundManager was placing the
shop item at slot 4 (p.getInventory().setItem(4, shopItem)), which is
exactly AgentManager.SLOT_E (the signature [E] ability slot). The shop
item was therefore systematically overwriting that ability's slot.
Fix:
- The shop is now placed at slot 8 (9th slot), a documented
RoundManager.SHOP_SLOT = 8constant to prevent this regression in the future. AgentManager.SLOT_C/Q/E/Xare nowpublic static finalso this kind of collision is visible/avoidable from other classes.- The player's inventory is cleared (
clear()) before handing out knife + abilities + shop at each buy phase, to make sure no leftover item can slip into one of these reserved slots.
Bonus (found along the way, fixed while I was in there)
ValoCraft.getMvpManager()always returnednullinstead of the actualmvpManager(a copy-paste miss). Consequence: the round MVP announcement never fired (RoundManager.endRounddoesif (mvpManager != null) ...). Fixed in one line.WeaponManager.getHeldWeaponDamage()had an off-by-one (line.substring(4)instead ofsubstring(5)to strip the"§8id:"prefix), which would have always failed the weapon lookup (":knife"instead of"knife"). This method wasn't used anywhere else in the code yet, so no visible impact today, but fixed to avoid a surprise bug later.
Intentionally left untouched
abilities/AbilityManager.java (the old credit-based ability-purchase
system, independent from agents) and the shop that still uses it
(UnifiedShopGUI/UnifiedShopListener) are a parallel, redundant
system alongside the hard-coded agent abilities. It doesn't cause the 3
reported bugs, but it's worth cleaning up separately if you want to unify
the two systems — I can do that in a follow-up patch if you'd like.

