Struct MinecraftConnectionBuilder

Source
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

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.