protectionblocks-1.0.8.jar
Curse Maven Snippet
What's new
๐ v1.0.8 โ Free time for new players & Currency polish
Post-launch polish on top of 1.0.7's currency system. Highlights: new players automatically get 24 h of free time on their first protection block (per-player, anti-cheat pool โ break & replace doesn't reset the timer). The whole "grace period" naming was renamed to "Free time" (Tiempo gratis / Freie Zeit / Temps gratuit / Tempo gratis) across the 5 mod languages. And several currency-flow bugs from 1.0.7 fixed.
๐ Free time for new players โ first block bonus
When a brand-new player places their very first protection block, they get a configurable amount of free time (default 24 h) during which the block consumes no fuel. Intended to give newcomers a safe onboarding window before they have to worry about the economy.
- Configurable duration: new admin option
newPlayerGraceHours(0โ720 h, default 24).0disables the feature. Editable in-game from the ConfigScreen โ Currency tab. - Once per player, forever: an anti-cheat pool tracks which players have ever received the bonus (persisted to
config/protectionblocks/veterans.txt). A player who has been granted the bonus never gets it again, even if they break all their protection blocks and place new ones later. - Survives break & replace within the window: the free time is anchored to the player (their UUID), not to the block. If a new player places their first block, then decides to move it โ breaks it after 14 h and places another one in a better spot โ the remaining 10 h of free time transfer to the new block automatically. No punishment for repositioning.
- Welcome message in chat on placement of the first block: "๐ Welcome โ your first protection block has 24 h of free time." (5 langs, admin-configured duration substituted in).
- Only applies when currency mode is enabled โ if the server never turned on the economy, the feature is silently a no-op.
๐ท๏ธ Renamed to "Free time" everywhere
The "grace period" mechanic (both the admin-global one from 1.0.7 and the new per-player bonus) is now presented to players as "Free time" โ a friendlier, more accurate name.
- UI labels, buttons, chat messages, badges โ all renamed in the 5 mod languages: ๐ช๐ธ Tiempo gratis ยท ๐ฌ๐ง Free time ยท ๐ฉ๐ช Freie Zeit ยท ๐ซ๐ท Temps gratuit ยท ๐ฎ๐น Tempo gratis.
- The header in the ConfigScreen went from the long warning "โ Grace period: pauses fuel consumption 24h on ALL blocks (useful after changing the currency item)." to the concise "Free time (Pause fuel consumption on all blocks)".
- Color of the header changed from amber (warning) to blue accent (informational) โ it's no longer a red-flag concept, just a mechanic.
- Java class names and NBT keys kept their
grace_*prefix internally โ the rename is user-facing only, saves from 1.0.7 load without migration.
โ๏ธ ConfigScreen โ Currency tab polish
- Live per-tier cost breakdown: the old static line "Tier multiplier: Basic ร1, Advanced ร2, ..." was replaced by 5 live lines that reflect the actual current settings, updating as you type:
โข Basic: 1 Diamond ร 10 min โข Advanced: 2 Diamonds ร 10 min โข Superior: 3 Diamonds ร 10 min โข Elite: 5 Diamonds ร 10 min โข Master: 8 Diamonds ร 10 minThe currency item's localized display name is resolved from the registry โ fallback to raw id if invalid. Refreshes every frame with no debouncing. - Live free time countdown: while a global free time period is active, the Currency tab now shows a live countdown "โฑ Free time active ยท 23h 45m 12s remaining" below the H:/M:/S: inputs. Updates every frame. When there's no free time active, shows "No free time active" in muted gray. Grant / Cancel buttons update the countdown optimistically (before the server round-trip completes) so admins get instant feedback.
- Save doesn't close the GUI anymore. Clicking Save used to close the whole ConfigScreen โ annoying if you wanted to tweak more values. Now Save just sends the update; the server responds with a fresh snapshot and the current tab is re-rendered with the actually-applied values (Forge can clamp out-of-range inputs), so the admin sees exactly what was accepted without reopening anything.
- Int inputs no longer cover their labels. Numeric input boxes were 160 px wide, hardcoded โ long labels like "Mรกx. bloques por jugador (-1 = ilimitado)" overflowed and were clipped behind the box. Now they're 80 px (enough for the 8-char max length of any numeric field), shifted right to give the label 280 px of breathing room.
๐ก๏ธ Protection block cube is always inviolable
Reverting a decision from 1.0.7: the cube itself is now always inviolable to non-owners, even when its fuel has run out.
- The zone still deactivates without fuel โ regular blocks inside can be broken and interacted with โ but the cube itself can never be broken by third parties. This means an owner who forgets to refuel can always come back later, refill the slot, and their zone is instantly restored. No more losing the whole base to a griefer during an offline weekend just because you were short on diamonds.
- The cancel is applied on both
LeftClickBlock(to prevent the block from taking damage) andBlockEvent.BreakEvent(belt-and-suspenders for creative mode / other break paths). - Admins (OP level โฅ 2) can still break any cube, unchanged.
๐ Fixed
- 4 legacy chat messages on right-click โ every time a player right-clicked their own protection block, four lines appeared in chat: "Protection Block Advanced", "Range: 15 blocks (area 31ร31)", "Owner: reaperfxx", "Shift + Right click to toggle visualization". Cause:
PlayerInteractEvent.RightClickBlockfires once per hand (MAIN_HAND + OFF_HAND); the early-return filter for MAIN_HAND was placed before thesetCanceled(true), so the OFF_HAND event was never cancelled and vanilla ended up callingProtectionBlock.use()(the legacy chat-print code path from before the modern GUI existed). Fixed by cancelling both hands and gating only the GUI-open logic on MAIN_HAND. The legacyuse()was also nuked to a no-op. - Free time badge appearing top-left of the screen the first time a block's GUI was opened. Cause:
uiFuelYwas only set insideif (fs != null && fs.currencyEnabled())โ but on first open of a block in a session, theSyncFuelStatePackethasn't arrived yet (RequestSyncPacketis asynchronous), sofsis null,uiFuelYstays at its default0, and when the packet finally arrivesrender()draws the "Free time active ยท Xh Ym Zs" label at (uiContentX, 0) โ the top-left corner. Second open worked because the cache was already populated. Fixed on two fronts:uiFuelYis now computed unconditionally ininit(), andSyncFuelStatePacket.handletriggers a widget rebuild if the currently-open Screen is the management GUI for that block position (so the fuel input + refill/withdraw buttons also appear on first open). - Item disappearing from the hotbar when trying to place any block inside another player's protected zone. The block would visually vanish from the slot until the player put a different item there, at which point the original block came back. Cause:
PlayerInteractEvent.RightClickBlockwas cancelled server-side but the client had already predicted the item consumption ("optimistic prediction"). Since we cancel the RightClickBlock event and never let vanilla place the block,EntityPlaceEvent(which had the inventory resync) never fires, so the client stayed out of sync. Fixed:resyncInventoryAfterCancel(player)now also runs in the RightClickBlock cancel path. - No consumption during free time โ but now the countdown doesn't lie either. With 1.0.7, the fuel-time-remaining shown in the GUI would suddenly jump to 0 s the moment a free time window ended, because
computeSecondsLeftusednow โ lastConsumeMs, and during hours of free timelastConsumeMsstayed frozen whilenowticked forward. The client saw an elapsed of "hours" for the current item and computedremainingCurrent = 0. Fixed by clampingeffectiveNow = lastConsumeMswhenever the block is in a free time window โ the countdown now truthfully reflects that the fuel is fully preserved until the window closes.
๐ Languages
All new labels, tooltips and chat messages translated to the 5 mod languages: ๐ช๐ธ Spanish ยท ๐ฌ๐ง English ยท ๐ฉ๐ช German ยท ๐ซ๐ท French ยท ๐ฎ๐น Italian.
๐ง Under the hood
- New persistent store:
config/protectionblocks/veterans.txtโ one line per player asuuid,graceEndMs. Auto-migrates lines from the older UUID-only format (treated as "already veteran, no time remaining"). - Free time now lives with the player, not with the block.
VeteranPlayerTracker.grantOnce(uuid, ms)is atomic (marks veteran + records timestamp in one op).ProtectionBlockEntity.getPersonalGraceUntilMs()is now a dynamic lookup on the owner's UUID โ so the same timer applies to whichever block the player currently has, and the field was dropped from NBT (legacy tag ignored silently on load). ConfigSnapshotextended with two new fields:newPlayerGraceHours(int, applied toServerConfig) andgraceUntilMs(server-authoritative timestamp echoed to the admin client for the live countdown).GrantGracePeriodPacket.handlenow sends a freshSyncConfigPacketback to the sender after grant / cancel so the countdown updates without waiting for a manual refresh.- 3
SyncFuelStatePacketemit sites (cron tick / deposit / request-sync) all now sendprot.getEffectiveGraceUntilMs()=max(globalGrace, personalGraceOfOwner), so the client-side countdown shows whichever expires later. ProtectionEventHandler.onRightClickBlockre-ordered:setCanceled(true)now runs for both hands, MAIN_HAND filter gates only the message / GUI open logic. Prevents the OFF_HAND event from slipping through to vanillause().
๐ฆ Compatibility
- Minecraft 1.20.1
- Forge 47.x (built against 47.4.8)
- Fully compatible with 1.0.7 worlds โ no world reset or config wipe needed.
ยฉ 2026 vicxelcode โ MIT License
This mod has no additional files

