An open API service indexing awesome lists of open source software.

https://github.com/jaffe2718/command-debug-devkit

This project is written for debugging Minecraft command.
https://github.com/jaffe2718/command-debug-devkit

idea-plugin minecraft minecraft-mod

Last synced: about 1 year ago
JSON representation

This project is written for debugging Minecraft command.

Awesome Lists containing this project

README

          

# Command Debug DevKit

![icon](idea-plugin/src/main/resources/META-INF/pluginIcon.svg)
![Stars](https://img.shields.io/github/stars/Jaffe2718/Command-Debug-DevKit?style=flat-square)
![Forks](https://img.shields.io/github/forks/Jaffe2718/Command-Debug-DevKit?style=flat-square)
![Issues](https://img.shields.io/github/issues/Jaffe2718/Command-Debug-DevKit?style=flat-square)
![Licence](https://img.shields.io/github/license/Jaffe2718/Command-Debug-DevKit?style=flat-square)

by Jaffe2718

## Introduction 📖
This project is written for debugging Minecraft commands. In this project, there are serveral subprojects:
- `fabric`: The mod for Fabric and Quilt, used to be a connection kit for IDE. It can create two socket server to provide code completion and code execution service.
- `ide-debug-tool`: This is a command line tool which can connect to the socket server opened by the mod. It can send code to the server and get the result. It can be a debug tool for IDE or a command line tool to execute *.mcfunction file directly.
- `idea-plugin`: This is a plugin for IntelliJ IDEA. It can connect to the socket server opened by the mod. It provides code completion and code execution service for IDE. The plugin contains a compiled `ide-debug-tool` so you don't need to install it manually.

## Setup 🛠️

### Mods
![follows](https://img.shields.io/modrinth/followers/command-debug-service)
![latestVersion](https://img.shields.io/modrinth/v/command-debug-service)
![mcVersion](https://img.shields.io/modrinth/game-versions/command-debug-service)
![modDownloads](https://img.shields.io/modrinth/dt/command-debug-service)


[![Modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3.1.2/assets/cozy/available/modrinth_vector.svg)](https://modrinth.com/mod/command-debug-service)

#### Fabric/Quilt Mod
1. Install Minecraft with`Fabric/Quilt Loader` and
[![Fabric-API](https://img.shields.io/badge/Fabric%20API-000000?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIH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KSIvPiAgPHJlY3QgeD0iMTAiIHk9IjExIiB3aWR0aD0iMSIgaGVpZ2h0PSIyIiBmaWxsPSJyZ2IoOTgsIDI3LCAxNjUpIi8+ICA8cmVjdCB4PSIxMSIgeT0iMTEiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIGZpbGw9InJnYigxNTEsIDM0LCAyNTUpIi8+ICA8cmVjdCB4PSIxMyIgeT0iMTEiIHdpZHRoPSIxIiBoZWlnaHQ9IjIiIGZpbGw9InJnYigxMTIsIDI4LCAxODgpIi8+ICA8cmVjdCB4PSIxMSIgeT0iMTMiIHdpZHRoPSIyIiBoZWlnaHQ9IjEiIGZpbGw9InJnYigxMDgsIDI4LCAxODApIi8+IDwvZz48L3N2Zz4=)](https://modrinth.com/mod/qsl)for your Minecraft version.
2. Install dependencies for the mod, please check `fabric.mod.json` for the dependencies.
3. Download the mod from [![release-page](https://img.shields.io/badge/GitHub%20Releases-000000.svg?logo=github)](https://github.com/Jaffe2718/Command-Debug-DevKit/releases) or [![Modrinth](https://img.shields.io/badge/Modrinth-000000.svg?logo=modrinth)](https://modrinth.com/mod/command-debug-service).
4. Put the mod into your `mods` folder.

### IDE Debug Tool
[![release-page](.doc/s1.svg)](https://github.com/Jaffe2718/Command-Debug-DevKit/releases)
[![doc](.doc/s2.svg)](ide-debug-tool/README.md)
* The tool is a `jar` file, you can just download it from [![release-page](https://img.shields.io/badge/GitHub%20Releases-000000.svg?logo=github)](https://github.com/Jaffe2718/Command-Debug-DevKit/releases) and you can use it without any installation steps.
* For more information, please see [![IDE Debug Tool](https://img.shields.io/badge/IDE%20Debug%20Tool%20%7c%20README%2Emd-000000.svg?logo=markdown&logoColor=50AAFF)](ide-debug-tool/README.md).

### Idea Plugin
![Version](https://img.shields.io/jetbrains/plugin/v/me.jaffe2718.devkit)
![Downloads](https://img.shields.io/jetbrains/plugin/d/me.jaffe2718.devkit)
![Plugin](https://img.shields.io/jetbrains/plugin/r/rating/me.jaffe2718.devkit)


[![Marketplace](.doc/s0.svg)](https://plugins.jetbrains.com/plugin/22587-minecraft-command-devkit)

1. Download the tool from [![release-page](https://img.shields.io/badge/GitHub%20Releases-000000.svg?logo=github)](https://github.com/Jaffe2718/Command-Debug-DevKit/releases) or [![JetBrains Marketplace](https://img.shields.io/badge/JetBrains_Marketplace-000000?logo=jetbrains&logoColor=black&labelColor=FFFFFF)](https://plugins.jetbrains.com/plugin/22587-minecraft-command-devkit), choose the version suitable for the mod.
2. Install the plugin in your IDEA: click `File` -> `Settings` -> `Plugins` -> `⚙️` -> `Install Plugin from Disk...` -> choose the downloaded file, or install it directly from JetBrains Marketplace inside IDE.

## Usage 📖

> **Note**: The Author's most recommended way to use this mod is to use the plugin.

### Mod

* The mod creates 3 socket servers to provide code completion, code execution service and datapack management service.
* The mod should work with other tools like [IDE Debug Tool](#ide-debug-tool) or [IDEA Plugin](#idea-plugin) or [other tools](DEV.md) you write by yourself.

#### Security Configuration of Mod

##### Ports

- **Command Execution Socket Port**: The port for the command execution service socket binding. The default value is `0`, which means the service will be disabled. If you modify this value, it will be applied when the program restarts.

##### Show Socket Info

Boolean value, if true, the server socket info will be shown in the message field for the trusted clients.

##### Trust Mode

The client socket trust mode for the Command Debug Service.
- **ALL_ALLOWED**: All clients are allowed to connect.
- **WHITE_LIST**: Only clients recorded in the `Trusted IPv4 Addresses` are allowed to connect.

##### Trusted IPv4 Addresses
The white list for the Command Debug Service. Only clients recorded in this list are allowed to connect in `WHITE_LIST` mode, otherwise, all clients are trusted.

### IDEA Plugin

#### Create a New Datapack Project

1. Setup a new datapack project in IDEA.
1. At the welcome page of IDEA, click `New Project`;
2. Choose `Minecraft Datapack`;
3. Fill in the metadata of the datapack project;


create new project
fill in metadata


4. Click `Create`, and the project will be automatically created with the default structure, and it will create `data//functions/demo.mcfunction` as example.


fill in metadata
The new datapack project

2. Import an existing datapack as a project.
1. At the welcome page of IDEA, click `New Project`;
2. Choose `Import Minecraft Datapack`;
3. Choose the datapack you want to import and fill the project name and extract path;


import existing project
Choose the datapack you want to import



import existing project
Filling the project name and extract path


> **Note**: The plugin will automatically check if the datapack is valid by these rules:
    1. The datapack must be a zip file;
    2. The zip file must contain a `pack.mcmeta` file;
    3. The zip file must contain a `data` folder.
If the datapack is invalid, the plugin will prevent you from importing it.


import existing project
The plugin will prevent you from importing an invalid datapack


4. Click `Create`, and the datapack will be automatically imported as a project.


import existing project
The new project based on the imported datapack

#### Edit & Debug Minecraft Function

1. Open or create a project;
2. Open or create a Minecraft function file;


open or create a function file
create a Minecraft function file

3. Start the Minecraft game with the [mod](#mods) installed, and open the world you want to debug;
4. Start edit the `*.mcfunction` file, connect to the socket servers and start debug;


start debug
Click the function buttons at the toolbar of the editor to get debug services



start debug
Connect to the code execution service



start debug
Connect to the completion service

5. Now you can start edit the `*.mcfunction` file and get code completion and code execution service.


import existing project
Code completion

6. You can click `Execute Without Log` to execute the command without logging the result to the console.


execute without log
Execute the command without logging

7. You can click `Execute` to execute the command and log the result to the console.


execute
Execute the command and log the result to the console


> **Note**: Remember to configure the project JDK. Click `File` -> `Project Structure` to choose the JDK you want to use.


configure project JDK
Congigure the project JDK

#### Custom Syntax Highlighting

* Click `File` -> `Settings` -> `Editor` -> `Color Scheme` -> `Minecraft Function` to customize the syntax highlighting.


custom syntax highlighting
Click File -> Settings -> Editor -> Color Scheme -> Minecraft Function to customize the syntax highlighting

#### Minecraft Command Console

1. Launch the Minecraft game with the [mod](#mods) installed, and open the world you want to debug;

2. Click `Tools` -> `Minecraft Command DecKit` -> `Minecraft Command Console` and fill the host and port of the command execution socket server.


open console
Click Tools -> Minecraft Command DecKit -> Minecraft Command Console to open the console



open console
Fill the host and port of the command execution socket server

3. You can write your commands line by line press `Enter` to execute the command.


open console
Write your commands line by line press Enter to execute the command

#### Generate Minecraft Datapack

1. There are two ways to start the task to generate a datapack:
- Right click the project view and click `Minecraft Command DevKit` -> `Generate Minecraft Datapack` in the context menu.


generate datapack
Right click the project view and click Generate Minecraft Datapack in the context menu


- Click `Tools` -> `Minecraft Command DecKit` -> `Generate Minecraft Datapack` from the main menu bar:


generate datapack
Click Generate Minecraft Datapack from the main menu bar

2. Click `Generate` to start the task, and the datapack will be generated in the `build` folder of the project named `.zip`.


generate datapack
Click Generate to start the task


> Tips: `Generate and Import/Link Datapact to Minecraft` are similar to `Generate Minecraft Datapack`,
> but they require the user to fill in the host and port of the `Datapack Management Service` socket server.
> For `Import`, the generated datapack will be copied to the current world's datapack folder,
> and for `Link`, the generated datapack will be linked to the current world's datapack folder and expired when the world is closed.

#### Datapack Management

1. There are two ways to start the task to manage the datapack:
- Click `Tools` -> `Minecraft Command DecKit` -> `Datapack Management` from the main menu bar:


manage datapack
Click Manage Datapack from the main menu bar


- Right click the project view and click `Minecraft Command DevKit` -> `Datapack Managment` in the context menu.


manage datapack
Right click the project view and click Manage Datapack in the context menu


2. Input the host and port of `Datapack Management Service` socket server shown in the Minecraft game.


manage datapack
Input the host and port of Datapack Management Service socket server

3. Do your operations.
1. Right-click the item in `Datapacks` -> `Status` -> `Enabled` and click `Disable` to disable the datapack.
2. Right-click the item in `Datapacks` -> `Status` -> `Available` and click `Enable` to enable the datapack.
3. Right-click `Datapacks` -> `Type` -> `Common` and click `Import...` to import a datapack.
4. Right-click `Datapacks` -> `Type` -> `Common` and click `Link...` to link a datapack.



manage datapack
Datapack Management View

> Tips:

>     This feature is with the requirement `3.x` version of the mod.

>     Only the world is opened, the `Datapack Management Service` socket server will be valid.

>     The linked datapack will be expired when the world is closed, and the imported datapack will be copied to the world's datapack folder.

> * For more info, please visit [DEV.md](DEV.md#concepts).

### Command Line Tool

* You can also use the [IDE Debug Tool](#ide-debug-tool) to connect to the socket server and execute the code.


command line tool
Command Line Tool

## Warning ⚠️

When you use this mod, you should be careful.
Because it can execute any command.
Do not send the host and port to any untrusted program to avoid being attacked.
Do not install this mod on your multiplayer server to avoid being attacked by DDOS or other attacks.

## Development 🔧

### Overview
This is the document for developers.
We will introduce how to develop external tools to work with this mod.
Programing language is not limited, you can use any language you like,
the only thing you need to do is make your tool has the ability to connect to the socket server and interact with it.

### Concepts
- For `4.x` version, the mod will create 3 socket servers, for code completion, code execution and datapack management.

| Server | Type | Description | Accepted Message | Returned Message |
|:-------------------:|:-------------:|:---------------------------------------------:|:-----------------------------------------------------------------------------------------------------------:|:--------------------:|
| Code Completion | Socket Server | The server for code completion | single line command or unfinished command | multiple line result |
| Code Execution | Socket Server | The server for command execution in Minecraft | single line command | execution feedbacks |
| Datapack Management | Socket Server | The server for receive datapack from client | json string without `\n` like `{ "name": "[name].zip", "data": "[base64 encoded data]", "flag": "import" }` | None |
- Tips: the message sent is a single line of text, you should add `\n` at the end of the message or auto flush the buffer to send the message to the server.

### More Information
For more information, please visit [![https://img.shields.io/badge/DEV%20%7c%20README%2Emd-000000.svg?logo=markdown&logoColor=50AAFF](https://img.shields.io/badge/Developer%20Documentation%20%7c%20DEV%2Emd-000000.svg?logo=markdown&logoColor=50AAFF)](DEV.md).

## License 📜
[![Licence](https://img.shields.io/github/license/Jaffe2718/Command-Debug-DevKit?style=for-the-badge)](LICENSE)

This project is licensed under the MIT License.
You can use this project for any purpose for free.
See the [![Licence](https://img.shields.io/badge/License-MIT-000000.svg?style=flat&color=B0FF00&logoColor=B0FF00)](LICENSE) file for details.

## Update and Cooperation 🤝
Currently, this project is still in development.
If you have any idea or suggestion,
please open an issue or pull request.
And the plugin is only for `IntelliJ Platform IDEs`,
if you want to use other IDEs such as `Eclipse` and `VS Code`,
you can create a plugin for it and pull request to this project.
What's more, the mod is only for `Fabric` and `Quilt` currently,
you can rewrite it for `Forge` or other mod loaders and pull request to this project.
I will be very grateful if you can help me to improve this project.