Skip to content

Commit

Permalink
Add support single player.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lapis256 committed Jul 29, 2024
1 parent 8a8a8c4 commit 9a06ce3
Show file tree
Hide file tree
Showing 9 changed files with 267 additions and 158 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ jobs:
target: x86_64-unknown-linux-gnu
glibc: 2.17
extension: ""
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
glibc: 2.17
extension: ""
- os: macos-latest
target: x86_64-apple-darwin
glibc: -1
extension: ""
- os: macos-latest
target: aarch64-apple-darwin
glibc: -1
extension: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
glibc: -1
Expand Down
113 changes: 23 additions & 90 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
[package]
name = "player_mover"
description = "A Minecraft tool to edit player data and change their position."
version = "1.0.0"
version = "1.1.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/Lapis256/player-mover"
readme = "README.md"
authors = ["Lapis256"]

[dependencies]
fastnbt = "2"
flate2 = "1.0"
dialoguer = "0.11.0"
mojang = "0.1.0"
ureq = { version = "2.10.0", features = ["json"] }
globmatch = "0.3"
serde = { version = "1", features = ["derive"] }
clap = { version = "4", features = ["derive", "string"] }
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# player-mover
プレイヤーの座標を編集するMinecraftのツールです。
[English](./README.md) / [日本語](./README_ja.md)

## 使い方
A Minecraft tool to edit player positions.

## Usage
```
player_mover <WORLD> [CHANGE_POSITION] [CHANGE_DIMENSION]
```
- WORLD (必須)
- ワールドディレクトリ
- CHANGE_POSITION (任意)
- 指定した座標にプレイヤーを移動させます。
- 形式: x,y,z
- 指定していない場合はスポーン座標に移動させます
- CHANGE_DIMENSION (任意)
- 指定したディメンションにプレイヤーを移動させます
- 指定していない場合はオーバーワールドに移動させます

- WORLD (required)
- World directory
- CHANGE_POSITION (optional)
- Moves the player to the specified position.
- Format: x,y,z
- If not specified, the player is moved to the spawn position.
- CHANGE_DIMENSION (optional)
- Moves the player to the specified dimension.
- If not specified, the player is moved to the Overworld.
18 changes: 18 additions & 0 deletions README_ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# player-mover
[English](./README.md) / [日本語](./README_ja.md)

プレイヤーの座標を編集するMinecraftのツールです。

## 使い方
```
player_mover <WORLD> [CHANGE_POSITION] [CHANGE_DIMENSION]
```
- WORLD (必須)
- ワールドディレクトリ
- CHANGE_POSITION (任意)
- 指定した座標にプレイヤーを移動させます。
- 形式: x,y,z
- 指定していない場合はスポーン座標に移動させます
- CHANGE_DIMENSION (任意)
- 指定したディメンションにプレイヤーを移動させます
- 指定していない場合はオーバーワールドに移動させます
25 changes: 25 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use std::error::Error;

use serde::Deserialize;

#[derive(Deserialize)]
struct Player {
name: String,
}

pub fn fetch_player_name(uuid: &str) -> Result<String, Box<dyn Error>> {
let player: Player = ureq::get(&format!(
"https://sessionserver.mojang.com/session/minecraft/profile/{}",
uuid.replace('-', "").to_lowercase()
))
.call()?
.into_json()?;

Ok(player.name)
}

#[test]
fn test_fetch_player_name() {
let name = fetch_player_name("069a79f4-44e9-4726-a5be-fca90e38aaf5").unwrap();
assert_eq!(name, "Notch");
}
Loading

0 comments on commit 9a06ce3

Please sign in to comment.