Struct mojang::Player[][src]

pub struct Player {
    pub name: String,
    pub uuid: String,
    pub skin_url: Option<String>,
    pub name_changes: Option<Vec<(u64, String)>>,
}
Expand description

A Player…

Not much more to say

Fields

name: String

Player Name

uuid: String

Player UUID

All lowercase with no dashes

skin_url: Option<String>

Url of current player skin

name_changes: Option<Vec<(u64, String)>>

List of all player name changes

Due to API limitations anything before the first name change will be the accounts original name.

Implementations

Make a new player

You can supply the Name or UUID

If you supply the uuid you will automaticly get the skin URL

Example
// Import Lib
use mojang::Player;

// Make a player with Username
let p = Player::new("Sigma76").unwrap();

// Make a player with UUID
let p2 = Player::new("3c358264b4564bdeab1efe1023db6679").unwrap();

Add Skin URL to a player

Example
// Import Lib
use mojang::Player;

// Load Skin Data into Player
let p = Player::new("Sigma76").unwrap().add_skin().unwrap();

Add Name History Data to a Player

Required if you want to use player.name_at(n)

Example
// Import Lib
use mojang::Player;

// Load Name History Data into Player
let p = Player::new("Sigma76").unwrap().add_name_change().unwrap();

Get play name at Timestamp (ms)

You must have called add_name_change on the player before useing this

Example
// Import Lib
use mojang::Player;

// Load Name History Data into Player
let p = Player::new("Sigma76").unwrap().add_name_change().unwrap();

// Get name at timestamp
assert_eq!(p.name_at(16362446560000).unwrap(), "Sigma76");

Trait Implementations

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.