Ability to bypass Damage and Hub Inventory.
This commit is contained in:
+14
-1
@@ -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. |
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"disable_block_break": true,
|
||||
"disable_block_place": true,
|
||||
"disable_block_damage": true,
|
||||
"disable_pvp": true,
|
||||
"disable_pvp": false,
|
||||
"disable_fall_damage": true,
|
||||
"apply_world_config": true
|
||||
},
|
||||
@@ -45,10 +45,13 @@
|
||||
| `disable_block_break` | `true` | Register an ECS system that cancels `BreakBlockEvent` in hub worlds. Players cannot mine blocks. |
|
||||
| `disable_block_place` | `true` | Register an ECS system that cancels `PlaceBlockEvent` in hub worlds. Players cannot place blocks. |
|
||||
| `disable_block_damage` | `true` | Register an ECS system that cancels `DamageBlockEvent` in hub worlds. Blocks cannot be damaged (the partial-damage step before a break). |
|
||||
| `disable_damage` | `true` | Register an ECS system that cancels entity damage in hub worlds unless the victim has `DamageBypassFlags`. Keep this on for duel arenas in hub worlds. |
|
||||
| `disable_pvp` | `true` | Apply `WorldConfig.setPvpEnabled(false)` on the hub world. Players can't damage each other. |
|
||||
| `disable_fall_damage` | `true` | Apply `WorldConfig.setFallDamageEnabled(false)`. Players don't take fall damage. |
|
||||
| `apply_world_config` | `true` | Master toggle for the world-flag application (PvP + fall damage). Set false if you want to manage these flags yourself in Hytale's world config and have Hub leave them alone. Does NOT affect the ECS block protections - toggle those individually via the `disable_block_*` flags. |
|
||||
|
||||
For duel arenas inside a hub world, use `disable_damage=true` and `disable_pvp=false`. Hytale needs world PvP enabled for player-vs-player damage to exist; Hub then blocks normal hub damage and lets duel victims through via `DamageBypassFlags`.
|
||||
|
||||
> Note: Hytale's `GameMode` only has `Adventure` and `Creative`. `Adventure` is the equivalent of Minecraft's *Survival* (players can still break/place). There is no gamemode that prevents block actions, which is why hub protection uses ECS event cancellation instead.
|
||||
|
||||
### messages
|
||||
|
||||
@@ -7,8 +7,9 @@ What Hub v1 protects against, and what it doesn't.
|
||||
- **Block break**: `CancelBreakBlockSystem` cancels `BreakBlockEvent` for any breaker entity inside a hub world.
|
||||
- **Block place**: `CancelPlaceBlockSystem` cancels `PlaceBlockEvent` likewise.
|
||||
- **Block damage** (the partial-damage ticks before a break): `CancelDamageBlockSystem` cancels `DamageBlockEvent`.
|
||||
- **PvP**: `WorldConfig.isPvpEnabled = false`. Players can't damage other players in the hub world.
|
||||
- **PvP**: Players can't damage other players in the hub world unless another plugin temporarily opts them into damage.
|
||||
- **Fall damage**: `WorldConfig.isFallDamageEnabled = false`.
|
||||
- **Hub controls**: Hub can hide HUD elements, keep players on the resting hotbar slot, and open the hub menu from the trigger slot unless another plugin temporarily opts the player into normal hub controls.
|
||||
- **Spawn location**: every joining player is teleported to the spawn point. They can't end up somewhere weird from a previous session.
|
||||
- **Duplicate join/leave broadcasts**: Hub replaces (or suppresses) Hytale's built-in `AddPlayerToWorldEvent.joinMessage` and `RemovedPlayerFromWorldEvent.leaveMessage` rather than emitting alongside them.
|
||||
|
||||
@@ -31,6 +32,14 @@ In some Minecraft-style servers `GameMode.Adventure` prevents block break/place.
|
||||
|
||||
Hub doesn't know about other Hub servers. Each Hub server protects its own world(s). If you have multiple lobbies, install Hub on each. Config can differ per server.
|
||||
|
||||
## Runtime bypass flags
|
||||
|
||||
`DamageBypassFlags` is for temporary combat inside hub worlds. It lets incoming damage through for opted-in victims. Bypassed attackers can also damage non-player entities, which keeps PvE training working without allowing them to hit ordinary hub players.
|
||||
|
||||
`HubBypassFlags` is for temporary normal controls inside hub worlds. It stops Hub from hiding HUD, forcing the resting hotbar slot, or opening the hub menu from slot changes for opted-in players.
|
||||
|
||||
Both are in-memory runtime flags with a JVM system-property fallback. Plugins should enable them only while needed and clear them when the player leaves the mode, disconnects, or the match ends.
|
||||
|
||||
## Timing of world flag application
|
||||
|
||||
`AllWorldsLoadedEvent` fires after Hytale finishes loading worlds at boot. Hub's `applyToConfiguredWorlds()` runs then. There's a brief window during boot (before `AllWorldsLoadedEvent`) where the world's flags are whatever was saved on disk. Connecting players in that window get the saved-disk flags. In practice nobody connects during this window because the server isn't accepting players yet.
|
||||
|
||||
Reference in New Issue
Block a user