pub struct MinecraftConnectionBuilder { /* private fields */ }
Expand description
A builder to create a MinecraftConnection is obtained via MinecraftConnection::builder.
The builder pattern is used to add new parameters without breaking backwards compatibility.
Implementations§
Source§impl MinecraftConnectionBuilder
impl MinecraftConnectionBuilder
Sourcepub fn log_file(
self,
log_file: impl Into<PathBuf>,
) -> MinecraftConnectionBuilder
pub fn log_file( self, log_file: impl Into<PathBuf>, ) -> MinecraftConnectionBuilder
The path to Minecraft’s log file.
For single player this is typically at these locations:
- Windows:
C:\Users\Herobrine\AppData\Roaming\.minecraft\logs\latest.log
- GNU/Linux:
~/.minecraft/logs/latest.log
- Mac:
~/Library/Application Support/minecraft/logs/latest.log
For servers it is at logs/latest.log
in the server directory.
Defaults to ../../logs/latest.log
relative to world_dir
, which is the correct value for
single player, but usually not for servers.
Sourcepub fn enable_logging_automatically(
self,
enable_logging_automatically: impl Into<bool>,
) -> MinecraftConnectionBuilder
pub fn enable_logging_automatically( self, enable_logging_automatically: impl Into<bool>, ) -> MinecraftConnectionBuilder
Whether logging is automatically enabled for all commands passed to MinecraftConnection::execute_commands. This works by prepending an enable_logging_command and appending a reset_logging_command to the list of commands.
This setting has no effect for logged_cart_commands. Logging still has to be enabled for these manually.
Default: true
.
Sourcepub fn build(self) -> MinecraftConnection
pub fn build(self) -> MinecraftConnection
Creates a MinecraftConnection with the configured parameters.
§Panics
Panics if no log_file was specified and the
world_dir has less than 2 path compontents. In this case the
default value of ../../logs/latest.log
can not be resolved.