mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 11:06:11 -10:00
Native mods: a server player's game mode
A shop must refuse a player in creative mode, who can make any item. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
076c41fc27
commit
768d20d998
2 files changed
+5
-1
No files matched your search
@@ -24,6 +24,8 @@ pub(crate) struct NativeServerPlayer {
|
||||
/// `minecraft:overworld`, `minecraft:the_nether`, `minecraft:the_end`.
|
||||
pub(crate) dimension: String,
|
||||
pub(crate) position: [f64; 3],
|
||||
/// 0 survival, 1 creative, 2 adventure, 3 spectator.
|
||||
pub(crate) game_mode: i32,
|
||||
}
|
||||
|
||||
/// A command a native mod adds, as one usage: words, then arguments
|
||||
@@ -245,6 +247,7 @@ impl Game<'_> {
|
||||
permission: g.permission,
|
||||
dimension: g.dimension.clone(),
|
||||
position: g.position,
|
||||
game_mode: g.game_mode,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -343,6 +346,7 @@ impl Game<'_> {
|
||||
permission,
|
||||
dimension: g.dimension.clone(),
|
||||
position: g.position,
|
||||
game_mode: g.game_mode,
|
||||
};
|
||||
let mut ran = false;
|
||||
self.native_perform_command(&player, line, &mut ran);
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ For mods that run where the world is simulated: a dedicated server, a LAN host,
|
||||
their level allows it, whether the world allows commands or not. The mod parses the line and sets `ran`. The
|
||||
player's state is swapped in for the call, as for their other actions, so `native_player` reads them; a
|
||||
registered command no mod takes answers as vanilla's unknown command.
|
||||
- Helpers: `native_server_players()` (uuid, name, level, dimension, position of each player on);
|
||||
- Helpers: `native_server_players()` (uuid, name, level, dimension, position and game mode of each player on);
|
||||
`native_tell(uuid, text)`, a system line to one player; `native_broadcast(text)`, to every player and the server's
|
||||
log; `native_feedback(text)`, the command's answer to the player whose command it is; `native_world_dir()`, the
|
||||
open world's folder, where a server mod keeps its data in a folder of its own so the world's backups carry it.
|
||||
Reference in new issue
Block a user