Ability to bypass Damage and Hub Inventory.

This commit is contained in:
LiamSystems
2026-06-07 14:44:56 +01:00
parent e0f55b9ac7
commit 43d7e512ad
13 changed files with 247 additions and 13 deletions
+14 -1
View File
@@ -11,6 +11,9 @@ HubPlugin (entry)
+-- CancelBreakBlockSystem ECS: cancels BreakBlockEvent in hub worlds
+-- CancelPlaceBlockSystem ECS: cancels PlaceBlockEvent in hub worlds
+-- CancelDamageBlockSystem ECS: cancels DamageBlockEvent in hub worlds
+-- CancelDamageSystem ECS: cancels entity damage in hub worlds
+-- DamageBypassFlags shared temporary opt-in for combat plugins
+-- HubBypassFlags shared temporary opt-in for normal hub controls
```
## What runs when
@@ -21,7 +24,7 @@ HubPlugin (entry)
2. Register `AllWorldsLoadedEvent` listener -> `HubWorldService.applyToConfiguredWorlds()`. Also call it once now (covers reload after worlds already loaded).
3. Register `PlayerReadyEvent` -> `HubJoinListener.onReady(...)`.
4. Register `AddPlayerToWorldEvent` / `RemovedPlayerFromWorldEvent` -> `HubMessageListener` (replaces Hytale's default join/leave broadcast text, or suppresses entirely).
5. Register the three `EntityEventSystem` subclasses (one per protected event) with `getEntityStoreRegistry()`. Each is gated on its own `protection.disable_*` toggle.
5. Register the protection ECS systems with `getEntityStoreRegistry()`. Each is gated on its own `protection.disable_*` toggle.
`HubWorldService` walks every configured hub world and sets:
- `isPvpEnabled = false` (if `protection.disable_pvp`)
@@ -29,6 +32,10 @@ HubPlugin (entry)
Only the flags that actually differ from current state are written. `markChanged()` is called once if anything changed.
`DamageBypassFlags` lets another plugin temporarily allow incoming damage for a player in a hub world, for example while that player is inside a duel arena. For hub-world duel arenas, keep `disable_damage=true` and `disable_pvp=false`: Hytale world PvP must be enabled, then Hub cancels damage unless the victim is bypassed.
`HubBypassFlags` lets another plugin temporarily bypass hub control behavior for a player. Bypassed players keep normal HUD/hotbar controls and do not trigger the hub menu from hotbar slot changes.
### Per-player, on `PlayerReadyEvent`
For each player who's just finished joining a hub world (i.e. their world is in `worlds.hub_worlds`, or that list is empty meaning "every world on this server is a hub"):
@@ -61,6 +68,12 @@ Hytale's player-add system fires `AddPlayerToWorldEvent` with a default `joinMes
| [protection/CancelBreakBlockSystem.java](../src/main/java/net/kewwbec/hub/protection/CancelBreakBlockSystem.java) | ECS: cancel BreakBlockEvent in hubs. |
| [protection/CancelPlaceBlockSystem.java](../src/main/java/net/kewwbec/hub/protection/CancelPlaceBlockSystem.java) | ECS: cancel PlaceBlockEvent in hubs. |
| [protection/CancelDamageBlockSystem.java](../src/main/java/net/kewwbec/hub/protection/CancelDamageBlockSystem.java) | ECS: cancel DamageBlockEvent in hubs. |
| [protection/CancelDamageSystem.java](../src/main/java/net/kewwbec/hub/protection/CancelDamageSystem.java) | ECS: cancel entity damage in hubs. |
| [protection/DamageBypassFlags.java](../src/main/java/net/kewwbec/hub/protection/DamageBypassFlags.java) | Shared temporary damage opt-in. |
| [protection/HubBypassFlags.java](../src/main/java/net/kewwbec/hub/protection/HubBypassFlags.java) | Shared temporary hub-control opt-in. |
| [service/HubWorldService.java](../src/main/java/net/kewwbec/hub/service/HubWorldService.java) | Applies world-level flags (PvP, fall damage). |
| [listener/HubJoinListener.java](../src/main/java/net/kewwbec/hub/listener/HubJoinListener.java) | PlayerReadyEvent: spawn-teleport + private welcome. |
| [listener/HubMessageListener.java](../src/main/java/net/kewwbec/hub/listener/HubMessageListener.java) | Replaces/suppresses Hytale's built-in join/leave broadcast. |
| [listener/HubInventoryListener.java](../src/main/java/net/kewwbec/hub/listener/HubInventoryListener.java) | PlayerReadyEvent: clear inventory, set resting slot, hide HUD. |
| [listener/MenuItemActivateSystem.java](../src/main/java/net/kewwbec/hub/listener/MenuItemActivateSystem.java) | ECS: hotbar slot hub-menu trigger. |
| [listener/HubHudVisibility.java](../src/main/java/net/kewwbec/hub/listener/HubHudVisibility.java) | Applies hidden/default hub HUD layouts. |