mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Update from Crowdin
This commit is contained in:
parent
e6849ae91a
commit
27c40f27d2
190 changed files with 16264 additions and 4806 deletions
|
|
@ -8,7 +8,9 @@
|
|||
|
||||
## Notes
|
||||
|
||||
> **ℹ️ NOTE: For now this page contains only the bare basics of the Chat Bot API, enough of details to teach you how to make basic Chat Bots. For more details you need to take a look at the [ChatBot.cs](https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Scripting/ChatBot.cs) and [Examples](#examples). This page will be improved in the future.**
|
||||
::: tip
|
||||
**For now this page contains only the bare basics of the Chat Bot API, enough of details to teach you how to make basic Chat Bots. For more details you need to take a look at the [ChatBot.cs](https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Scripting/ChatBot.cs) and [Examples](#examples). This page will be improved in the future.**
|
||||
:::
|
||||
|
||||
**Minecraft Console Client** has a rich C# API which allows you to create Chat Bots (effectively plugins) which can help you create complex automations which normal scripts may not be able to do.
|
||||
|
||||
|
|
@ -32,7 +34,9 @@ More in-depth:
|
|||
|
||||
This introduction assumes that you have the basic knowledge of C#.
|
||||
|
||||
> **ℹ️ NOTE: Here we will use terms Chat Bot and Script interchangeably**
|
||||
::: tip
|
||||
**Here we will use terms Chat Bot and Script interchangeably**
|
||||
:::
|
||||
|
||||
Create a new empty file and name it `ExampleChatBot.cs` in the same folder where you have your MCC installed.
|
||||
|
||||
|
|
@ -41,14 +45,14 @@ Paste the following example code:
|
|||
```csharp
|
||||
//MCCScript 1.0
|
||||
|
||||
MCC.LoadBot(new ExampleChatBot());
|
||||
MCC. LoadBot(new ExampleChatBot());
|
||||
|
||||
//MCCScript Extensions
|
||||
|
||||
// The code and comments above are defining a "Script Metadata" section
|
||||
|
||||
// Every single chat bot (script) must be a class which extends the ChatBot class.
|
||||
// Your class must be instantiates in the "Script Metadata" section and passed to MCC.LoadBot function.
|
||||
// Your class must be instantiates in the "Script Metadata" section and passed to MCC. LoadBot function.
|
||||
class ExampleChatBot : ChatBot
|
||||
{
|
||||
// This method will be called when the script has been initialized for the first time, it's called only once
|
||||
|
|
@ -99,38 +103,40 @@ Chat Bot (Script) structure is the following:
|
|||
|
||||
`//MCCScript Extensions` marks the end of the **Script Metadata** section, this must be defined before a Chat Bot (Script) class.
|
||||
|
||||
In order for your Chat Bot (Script) to properly load in-between the `//MCCScript 1.0` and the `//MCCScript Extensions` lines you must instantiate your Chat Bot (Script) class and pass it to the `MCC.LoadBot` function.
|
||||
In order for your Chat Bot (Script) to properly load in-between the `//MCCScript 1.0` and the `//MCCScript Extensions` lines you must instantiate your Chat Bot (Script) class and pass it to the `MCC. LoadBot` function.
|
||||
|
||||
Example code:
|
||||
|
||||
```
|
||||
MCC.LoadBot(new YourChatBotClassNameHere());
|
||||
MCC. LoadBot(new YourChatBotClassNameHere());
|
||||
```
|
||||
|
||||
**Script Metadata** section allows for including C# packages and libraries with: `//using <namespace>` and `/dll <dll name>`.
|
||||
|
||||
> **ℹ️ NOTE: Avoid adding whitespace between `//` and keywords**
|
||||
::: tip
|
||||
**Avoid adding whitespace between `//` and keywords**
|
||||
:::
|
||||
|
||||
By the default the following packages are loaded:
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System. Collections. Generic;
|
||||
using System. Text. RegularExpressions;
|
||||
using System. Linq;
|
||||
using System. Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System. Net;
|
||||
using System. Threading;
|
||||
using MinecraftClient;
|
||||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.Inventory;
|
||||
using MinecraftClient. Mapping;
|
||||
using MinecraftClient.
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```csharp
|
||||
//using System.Collections.Immutable
|
||||
//using System. Collections. Immutable
|
||||
//dll MyDll.dll
|
||||
```
|
||||
|
||||
|
|
@ -139,10 +145,10 @@ Full Example:
|
|||
```csharp
|
||||
//MCCScript 1.0
|
||||
|
||||
//using System.Collections.Immutable
|
||||
//using System. Collections. Immutable
|
||||
//dll MyDll.dll
|
||||
|
||||
MCC.LoadBot(new ExampleChatBot());
|
||||
MCC. LoadBot(new ExampleChatBot());
|
||||
|
||||
//MCCScript Extensions
|
||||
```
|
||||
|
|
@ -155,7 +161,8 @@ There are no required methods, everything is optional.
|
|||
|
||||
When the Chat Bot (Script) has been initialized for the first time the `Initialize` method will be called. In it you can initialize variables, eg. Dictionaries, etc..
|
||||
|
||||
> **ℹ️ NOTE: For allocating resources like a database connection, we recommend allocating them in `AfterGameJoined` and freeing them in `OnDisconnect`**.
|
||||
::: tip
|
||||
**For allocating resources like a database connection, we recommend allocating them in `AfterGameJoined` and freeing them in `OnDisconnect`** :::.
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue