Skip to content

Commit

Permalink
readme update for mcdr2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Jul 10, 2023
1 parent d27745d commit 25b7109
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ A MCDReforged api plugin to get player data information and more

## Usage

Use `server.get_plugin_instance()` to get the MinecraftDataAPI instance
Directly `import` MinecraftDataAPI and just use it:

```python
api = server.get_plugin_instance('minecraft_data_api')
import minecraft_data_api as api

pos = api.get_player_info('Steve', 'Pos')
```

You can declare the dependency of this plugin in PLUGIN_METADATA:
Suggestion: declare the dependency of MinecraftDataAPI in your plugin metadata:

```python
PLUGIN_METADATA = {
Expand All @@ -29,7 +31,7 @@ PLUGIN_METADATA = {

## Function list

Check the sample plugin in the `examples` folder or read the code to get a more comprehensive understanding
Check the example plugin in the `examples` folder or read the code to get a more comprehensive understanding

### convert_minecraft_json

Expand All @@ -51,9 +53,9 @@ Args:
- text: A data get entity or other command result that use Minecraft style json format

Return:
- A parsed json result. It can be a `dict`, a `list` or an `int`
- A parsed json result. It can be a `dict` / `list` / `int` / `float`

Samples:
Examples:

- Input `Steve has the following entity data: [-227.5d, 64.0d, 231.5d]`, output `[-227.5, 64.0, 123000.0]`

Expand Down
8 changes: 5 additions & 3 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

## 使用方法

使用 `server.get_plugin_instance()` 来获得 MinecraftDataAPI 插件实例,即可使用
直接 `import` MinecraftDataAPI,就能用了

```python
api = server.get_plugin_instance('minecraft_data_api')
import minecraft_data_api as api

pos = api.get_player_info('Steve', 'Pos')
```

可在 PLUGIN_METADATA 中声明对本 API 的依赖:
建议:在插件元数据中声明对 MinecraftDataAPI 的依赖:

```python
PLUGIN_METADATA = {
Expand Down

0 comments on commit 25b7109

Please sign in to comment.