Skip to content

feat: homes module with HyperFactions territory integration#3

Open
ZenithDevHQ wants to merge 61 commits into
mainfrom
dev/init
Open

feat: homes module with HyperFactions territory integration#3
ZenithDevHQ wants to merge 61 commits into
mainfrom
dev/init

Conversation

@ZenithDevHQ

Copy link
Copy Markdown

Summary

  • Implement complete homes module ported from HyperHomes core: /sethome, /home, /delhome, /homes commands with manager, storage, and data model layers
  • Add HyperFactions soft dependency integration to block home usage in faction territory based on configurable relationship toggles (own/ally/neutral/enemy/wilderness)
  • Add centralized FactionTerritoryChecker with per-relationship bypass permissions

Changes

New files (8):

  • FactionTerritoryChecker — Result enum + canUseHome() reading HomesConfig toggles
  • Home record — immutable home with timestamps, factory methods, immutable updates
  • PlayerHomes — case-insensitive collection (lowercase keys, original casing preserved)
  • HomeManager — CRUD, limit enforcement (unlimited perm → limit.N perm → config default), bed sync, player cache lifecycle
  • SetHomeCommand/sethome [name] with name validation, faction check, limit check
  • HomeCommand/home [name] with faction check on destination, warmup/cooldown via WarmupManager
  • DelHomeCommand/delhome <name> with home listing on error
  • HomesCommand/homes with count/limit display

Modified files (9):

  • manifest.json — HyperFactions in SoftDependencies
  • Permissions.java — HOME_TELEPORT, HOME_LIMIT_PREFIX, BYPASS_FACTIONS hierarchy
  • HomesConfig.java — factions subsection replacing single boolean
  • Location.javafromHome() factory
  • HomeStorage.javaloadPlayerHomes/savePlayerHomes methods
  • JsonStorageProvider.java — real JsonHomeStorage inner class with atomic writes
  • HomesModule.javainitManager(), getHomeManager(), saveAll on disable
  • HyperEssentials.javagetHomesModule(), init in initModuleManagers()
  • HyperEssentialsPlugin.java — command registration, player connect/disconnect hooks

Test plan

  • Verify compilation passes (./gradlew :clean :compileJava)
  • Verify /sethome, /home, /delhome, /homes commands register and execute
  • Verify home limit enforcement (config default, permission-based, unlimited)
  • Verify faction territory checks block/allow correctly per config toggles
  • Verify bypass permissions skip faction checks
  • Verify homes persist across player disconnect/reconnect (JSON storage)
  • Verify bed sync creates/updates bed home bypassing limit
  • Verify config generates correct JSON with factions subsection

ZenithDevHQ and others added 30 commits February 22, 2026 23:02
Comprehensive design for migrating warp/spawn/teleport logic from
HyperWarps into HyperEssentials' modular architecture, plus a new
RTP module. GUI stripped — command-only at this stage.
Detailed 9-task bottom-up plan covering data models, storage layer,
warps module, spawns module, teleport module, RTP module, platform
wiring, and API/docs updates.
Add Warp, Spawn, TeleportRequest records and PlayerTeleportData class.
Update Location with fromWarp/fromSpawn/distanceSquared utilities.
Add formatRelativeTime to TimeUtil.
Flesh out WarpStorage, SpawnStorage, and PlayerDataStorage interfaces.
Implement all three in JsonStorageProvider with atomic writes and
data/ subdirectory layout for warps.json, spawns.json, and players/.
Add WarpManager with full CRUD, access control, and category support.
Add commands: /setwarp, /warp, /warps, /delwarp, /warpinfo.
Wire WarpsModule with storage initialization and lifecycle.
Implement four complete modules from empty stubs into fully functional systems:

- Kits: kit definitions, CRUD commands, cooldown/one-time tracking, inventory capture
- Moderation: ban/tempban/mute/tempmute/kick with persistence, freeze with movement
  prevention, vanish with hidden player management, punishment history
- Utility: heal, fly, god, clearchat, clearinventory, repair, near commands with
  self/other targeting and per-command permission checks
- Announcements: scheduled broadcast rotation, manual broadcast, rotation management

Also adds infrastructure: DurationParser, categorized Permissions constants,
disconnect handler system, and online player lookup utility.
Merge both feature branches, resolve conflicts in Permissions.java
and HyperEssentialsPlugin.java. Standardize on findOnlinePlayer()
across all teleport commands (was findPlayerByUsername in core-modules).
Reformat all Java files to 2-space indentation, add checkstyle linting,
merge RTP module into Teleport, upgrade Logger to HytaleLogger with
category-based debug logging, add migration framework with backup/rollback,
add VaultUnlocked economy integration, and establish standard directory
structure with backups/ and data/.version marker.
Add HyperFactions to manifest.json SoftDependencies for proper load
ordering. Add new permission constants for home teleportation
(HOME_TELEPORT), per-player home limits (HOME_LIMIT_PREFIX), and
faction territory bypass permissions (BYPASS_FACTIONS, BYPASS_FACTIONS_SETHOME,
BYPASS_FACTIONS_HOME) to support upcoming homes-factions integration.
Replace the single restrictInEnemyTerritory boolean with a full factions
subsection containing per-relationship toggles: enabled (master toggle),
allowInOwnTerritory, allowInAllyTerritory, allowInNeutralTerritory,
allowInEnemyTerritory, and allowInWilderness. This provides granular
control over where players can set and use homes relative to faction
territory ownership.
…on logic

Introduce FactionTerritoryChecker with a Result enum (ALLOWED, BLOCKED_OWN,
BLOCKED_ALLY, BLOCKED_ENEMY, BLOCKED_NEUTRAL, BLOCKED_WILDERNESS) and a
static canUseHome() method. The checker reads HomesConfig faction toggles
and delegates to the existing reflection-based HyperFactionsIntegration.
Returns ALLOWED when HyperFactions is absent or the master toggle is off.
Each Result carries a player-facing denial message for command feedback.
Create Home as an immutable record with name, world, coordinates, rotation,
and timestamps. Includes static factory create() and immutable update
methods withLastUsed() and withLocation(). PlayerHomes provides a
case-insensitive collection (lowercase keys, original casing preserved)
with CRUD operations and count(). Add Location.fromHome() factory method
for consistency with the existing fromWarp() and fromSpawn() patterns.
Expand HomeStorage with loadPlayerHomes() and savePlayerHomes() methods.
Replace the stub in JsonStorageProvider with a real JsonHomeStorage inner
class that reads/writes per-player JSON files in data/players/homes/.
Uses atomic file writes for crash safety, Gson for serialization, and
the same patterns as existing warp/spawn storage. Home keys are stored
lowercase while preserving original casing in the name field.
HomeManager provides the full homes business logic layer: player lifecycle
management (load on connect, save on disconnect, saveAll on shutdown),
CRUD operations (setHome, deleteHome, getHome, getHomes), limit enforcement
(checks unlimited perm → bypass.limit perm → home.limit.N perm → config
default), and bed sync (creates/updates a bed-named home bypassing the
limit). Uses ConcurrentHashMap for thread-safe player caching and delegates
persistence to the HomeStorage interface.
SetHomeCommand (/sethome [name]): validates name against [a-zA-Z0-9_-]{1,32},
checks faction territory via FactionTerritoryChecker (with bypass perm
support), enforces home limit, and creates/overwrites the home at the
player's current position.

HomeCommand (/home [name]): resolves the home, checks faction territory on
the destination, respects cooldowns via WarmupManager, and teleports with
warmup delay. Shows available homes when the target home is not found.

DelHomeCommand (/delhome <name>): requires a name argument, deletes the
specified home, and shows available homes on usage error.

HomesCommand (/homes): lists all homes with count/limit display (e.g.
"Your homes (2/3):") and comma-separated home names.

All commands follow the existing AbstractPlayerCommand pattern with
CommandUtil messaging.
… events

Update HomesModule with initManager() that creates the HomeManager from
HomeStorage, and saveAll() on disable. Add getHomesModule() getter to
HyperEssentials and initialize the manager in initModuleManagers() before
warps/spawns.

Register /sethome, /home, /delhome, /homes commands in
HyperEssentialsPlugin.registerCommands() following the same guarded pattern
as warps/spawns. Hook into player connect to load home data and player
disconnect to flush and unload home data from cache.
…perties

Add Hytale Maven version resolution and repository to build.gradle so the
project can build standalone with a local settings.gradle that includes
HyperPerms as a sibling project. Gitignore settings.gradle and
gradle.properties since the multi-project wiring is machine-specific.
…voidance

Rewrites the placeholder RTP system with proper heightmap scanning,
fluid-aware safety checks, faction claim buffer avoidance via
HyperFactionsIntegration, and a BorderHook for future world border
enforcement. Search now runs on the world thread with multi-attempt
retry and player feedback.
Updates README, architecture, commands, integrations, modules, storage,
and docs index to match the fully implemented state of all 10 modules.
Removes completed design/implementation plan files. Adds .serena/ to
gitignore.
…ands

Refactored all teleport commands (home, spawn, back, rtp, warp) to:
- Use executeTeleport with onComplete callback instead of inline success messages
- Add ref.isValid() guard before teleporting to prevent operating on disconnected players
- Switch from new Teleport() to Teleport.createForPlayer() for proper API usage
- Defer store retrieval to world thread execution for thread safety
Adds rtpSafetyAirAboveHead config option (default 10) to prevent RTP
from placing players underground. RtpManager now scans for solid blocks
above the landing position and rejects cave locations.
Replaced manual polling with ScheduledExecutorService for automatic
warmup completion. Added bypass.warmup and bypass.cooldown permission
checks. Cancels existing warmup before starting a new one. Added clean
shutdown lifecycle for plugin disable.
Kit items now support 4 inventory sections (hotbar, storage, armor,
utility) instead of flat slot numbering. Added inventory space
pre-check with INSUFFICIENT_SPACE result, displaced-item handling
for armor/utility slots, and backward-compatible deserialization.
New /previewkit command (aliases: vkit, viewkit) to preview kit
contents without claiming.
Switched from Creative/Adventure gamemode toggling to using
MovementManager.canFly toggle with UpdateMovementSettings packet.
Disabled cross-player fly toggle pending entity ref resolution.
Repair now checks if already at full durability before repairing and
uses withDurability() instead of withRestoredDurability(). New
/repairmax (alias: fixmax) fully restores including max durability
reset. New /durability (alias: dura) for setting or resetting max
durability on held items.
Homes: deletehome/rmhome/removehome, listhomes/homelist, createhome
Teleport: tpy, tpc, tpn, tpt, tpr
Utility: cc, fix
Warps: createwarp
Announcements: bc
Moderation: pun
Added connect handler registration pattern to HyperEssentials core,
mirroring the existing disconnect handler. HyperEssentialsPlugin now
calls onPlayerConnect with UUID and username on player join.

New permission nodes: utility.motd, utility.playtime, utility.joindate,
utility.afk, utility.invsee, utility.stamina, utility.stamina.others,
utility.trash, utility.maxstack, utility.sleeppercentage, moderation.ipban
Added enable toggles: motd, rules, discord, list, playtime, joindate,
afk, invsee, stamina, trash, maxstack, sleepPercentage. Added content
fields: motdLines, ruleLines, discordUrl. Added AFK timeout config
and sleep percentage settings with per-world overrides. Full JSON
serialization with list/map support.
New PlayerStats record (uuid, username, firstJoin, totalPlaytimeMs,
lastJoin) and PlayerStatsStorage with JSON file persistence at
data/playerstats.json. Follows the existing ModerationStorage pattern
with synchronized access and Gson serialization.
Added AFK state tracking with auto-AFK timeout detection and broadcast
notifications. Added infinite stamina enforcement via periodic stat
maximization using EntityStatsModule. Added session tracking with
PlayerStatsStorage for playtime accumulation across sessions. Uses
ScheduledExecutorService running every 1s for AFK check and stamina
enforcement. Full cleanup on player disconnect and shutdown.
Config-driven info commands: /motd shows configurable MOTD lines,
/rules shows server rules, /discord shows invite link, /list shows
sorted online player names with count.
/playtime (alias: /pt) shows total playtime including current session
using DurationParser.formatHuman(). /joindate (alias: /firstjoin) shows
first join timestamp formatted as yyyy-MM-dd HH:mm.
/afk (alias: /away) toggles AFK status and broadcasts status change
to all online players. Auto-unsets AFK on player activity (chat,
interact) via UtilityManager event tracking.
/stamina (alias: /stam) toggles infinite stamina for self or target
player. Immediately maximizes all entity stats on enable. Periodic
enforcement via UtilityManager scheduler keeps stats at max while
enabled. Supports targeting other players with stamina.others permission.
Placeholder implementations for GUI-dependent commands. /invsee
(view other player's inventory) and /trash (disposal inventory)
will be fully implemented when CustomUI GUI system is built.
/maxstack (alias: /stack) sets held item quantity to its max stack size.
/sleeppercentage (alias: /sleeppct) views or sets the global and
per-world sleep skip percentage threshold. Changes persist to config.
Merged /tempban into /ban and /tempmute into /mute with unified syntax:
/ban <player> [duration] [reason]. Uses DurationParser.parse() to detect
if second argument is a duration (temp) or reason (permanent). Added
tempban alias for /ban, tempmute/tmute aliases for /mute. Removed
standalone TempBanCommand and TempMuteCommand.
New IpBan record with expiration support. ModerationStorage extended
with ipBans JSON section for persistence. ModerationManager tracks
player IPs on connect and provides ipBan/ipUnban/isIpBanned methods
with same-IP kick on ban. ModerationListener checks IP bans at
connect time and disconnects banned IPs. New /ipban and /ipunban
commands with smart duration detection.
Added /he help subcommand with comprehensive command listing grouped
by module (homes, warps, spawns, teleport, kits, moderation, utility,
announcements, admin). Each module section only shows if the module
is enabled.
UtilityModule registers 12 new commands (motd, rules, discord, list,
playtime, joindate, afk, invsee, stamina, trash, maxstack,
sleeppercentage) with config-driven toggles. Registers AFK activity
listeners for PlayerChatEvent and PlayerInteractEvent. Initializes
UtilityManager with stats storage and connect handler.

ModerationModule registers /ipban and /ipunban, removes TempBanCommand
and TempMuteCommand registrations, adds connect handler for IP tracking.
Added comprehensive changelog entries for all new features: 15 utility
commands, IP ban system, player stats, AFK system, stamina system,
spawn auto-detection, kits overhaul, ban/mute consolidation, teleport
refactor, warmup overhaul, fly rewrite, repair improvements, command
aliases, and help expansion.
/heal now only maximizes health via DefaultEntityStatTypes.getHealth()
instead of iterating all stats (avoids regen visual side effects).
/stamina maximize uses DefaultEntityStatTypes.getStamina() for targeted
stat enforcement.
AFK detection now covers all player activity:
- Added PlayerMouseMotionEvent listener for mouse look
- Added position-based movement polling in periodic task (Hytale has
  no PlayerMoveEvent, so we compare positions each second)

Stamina enforcement now dispatches to world thread via world.execute()
to fix PlayerRef.getComponent() called from ScheduledThreadPoolExecutor
which caused error spam.
Add dual GUI system foundation (Player + Admin):
- UIPaths, GuiColors: centralized constants for template paths and colors
- PlayerPageData, AdminPageData: BuilderCodec event data classes
- PlayerPageOpener, AdminPageOpener: page resolution and opening utilities
- GuiManager: openPlayerPage/openAdminPage convenience methods
- NavBarHelper: admin nav bar variant with GuiType routing
- UIHelper: formatPlaytime utility
- AdminCommand: /he opens player dashboard, /he admin opens admin panel
- Permissions: add admin.gui permission node
- styles.ui: HyperFactions-quality TextButtonStyle definitions (tuple syntax)
- Shared templates: empty_state.ui, confirm_modal.ui, stat_row.ui
- Updated docs: gui.md, architecture.md, permissions.md, CHANGELOG.md
- HomesPage: browse homes list, teleport with warmup, delete, count/limit header
- WarpsPage: browse warps grouped by category with headers, teleport with warmup
- KitsPage: browse available kits, claim with cooldown display, preview
- 7 new .ui templates: homes_page, home_entry, warps_page, warp_entry,
  warp_category_header, kits_page, kit_entry
- /homes, /warps, /kits commands now open GUI pages (text fallback preserved)
- Page registration in HyperEssentials.registerPages() with display order
  (Homes=10, Warps=20, Kits=30)
- Dashboard: welcome screen, stat cards (homes/online/TPA), quick actions, playtime/join info
- TPA page: incoming requests with accept/deny, toggle TPA acceptance, time remaining
- Stats page: playtime, first join, session info, utility status indicators (AFK/Fly/God/Stamina)
- Added UtilityManager.getSessionStart() for session time display
- All 6 player GUI tabs now functional
- Admin Dashboard: server overview, online/warp/spawn/kit stats, module status grid
- Admin Warps: list all warps, create at location, delete
- Admin Spawns: list with default badge, create at location, delete
- Admin Kits: list with cooldown/one-time info, create from inventory, delete
- Admin page registration: Dashboard(0), Warps(20), Spawns(30), Kits(40)
… pages

- AdminPlayersPage: online player list sorted by username
- AdminModerationPage: punishment list with active/all filter, type badges, revoke
- AdminAnnouncementsPage: read-only view of config messages, interval, mode
- AdminSettingsPage: version info, data dir, config reload, module status grid
- ModerationManager/Storage: add getAllPunishments(boolean) for cross-player queries
- 8 new .ui templates for admin page entries
- Complete GUI system: 14 pages (6 player + 8 admin)
- nav_bar.ui: rewrite MenuItem style to match HyperFactions pattern
  (LabelStyle wrapper, separate SelectedStyle, no $C/$S imports)
- nav_button_active.ui: use $S.@GoldButtonStyle for active tab
- styles.ui: add missing @ColorTextPrimary used by admin entries
- confirm_modal.ui: fix FlexWeight inside Anchor tuple (invalid)
- stat_row.ui: fix FlexWeight inside Anchor tuple (invalid)
- error_page.ui: fix structure (PageOverlay outside Container)
The .ui parser does not support @name = #hex simple variable assignments.
Only LabelStyle(...) and TextButtonStyle(...) definitions are valid with
the @ prefix. All $S.@color* references replaced with inline hex values
matching HyperFactions' proven pattern.
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.

2 participants