Overview
The spawn commands allow administrators to set a spawn point and players to teleport to it. The teleportation includes a configurable timer and movement detection./spawn
Teleports the player to the configured spawn location.Syntax
Permission
Required to use the
/spawn command.Default: trueBehavior
- Checks if the player has permission to use the command
- Triggers a
HubblySpawnEvent(can be cancelled by other plugins) - Starts a teleport timer (configured in
config.yml) - Monitors player movement during the timer
- Cancels teleport if the player moves
- Teleports the player when the timer completes
Examples
Configuration
The spawn timer is controlled by thespawn.timer value in config.yml:
If the player moves during the teleport countdown, the teleport will be cancelled and they’ll receive a message: “You moved, teleport cancelled.”
Events
Fired when a player uses
/spawn. Can be cancelled by other plugins or event handlers.Cancellable: Yes/setspawn
Sets the spawn location to the player’s current position.Syntax
Permission
Required to use the
/setspawn command.Default: opBehavior
- Captures the player’s current location (X, Y, Z coordinates)
- Rounds coordinates to the nearest 0.5 block for precision
- Rounds yaw and pitch to the nearest cardinal direction
- Saves the world name and all position data to
config.yml - Persists the configuration to disk
Examples
Coordinate Rounding
The command uses intelligent rounding:- Position (X, Y, Z): Rounded to nearest 0.5 (e.g., 10.7 becomes 10.5, 10.3 becomes 10.5)
- Rotation (Yaw, Pitch): Rounded to nearest 45-degree angle for clean directional facing
The spawn location is saved immediately to the configuration file and will persist across server restarts.
Permissions Summary
| Permission | Description | Default |
|---|---|---|
hubbly.command.spawn | Use /spawn command | true |
hubbly.command.setspawn | Use /setspawn command | op |
hubbly.command.* | All command permissions | op |
Source Reference
Implemented in:SpawnCommand.java:53- Spawn teleport handlerSetSpawnCommand.java:54- Spawn location setterSpawnTeleportTask.java- Teleport timer and movement detection