Skip to content

Commit f6f5f3d

Browse files
Merge pull request #4 from NeonAngelThreads/proxy-support
[+] Added Proxy settings for starting multiple bots from different IPs
2 parents 512ba5d + 343cf30 commit f6f5f3d

File tree

10 files changed

+280
-122
lines changed

10 files changed

+280
-122
lines changed

README.md

Lines changed: 97 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@
2828
<a href="https://github.com/NeonAngelThreads/DolphinBot/tree/master/src/main">
2929
<img src="https://img.shields.io/github/languages/code-size/NeonAngelThreads/DolphinBot" alt="GitHub code size"/>
3030
</a>
31+
<br>
32+
<a href="https://github.com/NeonAngelThreads/DolphinBot/releases">
33+
<img src="https://img.shields.io/github/downloads/neonangelthreads/dolphinbot/total" alt="downloads"/>
34+
</a>
3135
<p align="center">
3236
<a href="https://github.com/NeonAngelThreads/DolphinBot/blob/master/PluginDocs.md">📖Docs</a>
3337
·
3438
<a href="https://github.com/NeonAngelThreads/DolphinBot/issues">🐛Submit Suggestion/Bug</a>
39+
3540
</p>
3641
</p>
3742

@@ -51,7 +56,7 @@
5156
- Supporting to configure the bot clusters, and start at once.
5257
- Supporting colourful console logging strings expression `colorizeText("&6Hello &lWorld")`.
5358
- Automatic answer questions in `2b2t.xin` for speeding up login process.
54-
- Supporting to reload a plugin while the client is running on server.
59+
- Supporting to configure proxy settings for multiple bots.
5560

5661
## Screenshots:
5762
### Running on Windows server 2019:
@@ -63,6 +68,7 @@
6368
**Features category:**
6469
- [`Hot-Reloading Plugin`](#hot-swapping-plugins-in-game)
6570
- [`Terminal Interactions`]()
71+
- [`Proxy Settings`]()
6672

6773
**Implemented Event APIs:**
6874
- [`Programmable State Machine`](PluginDocs.md#3-programmable-login-state-machine)
@@ -86,115 +92,157 @@
8692
In this section, you will understand below how-tos:
8793
- **1. How to directly start a single bot with command-line.**
8894
- **2. How to specify bot profile with config file without command-line.**
89-
- **3. How to start multiple bot simultaneously**
95+
- **3. How to start multiple bot simultaneously with proxy settings**
9096
- **4. How to configure advanced options**
9197
- **5. How to make a custom plugin**
9298

9399
1. **Download the Client**
94100
Download the jar archive file: `DolphinBot-[version]-full.jar`.
95101
Requirements: **Java version >= 17**
96102
2. **Configuration of the Bot**
97-
**Configuring Profile**
103+
### Configuring Profile
98104
There are two different ways to set bot config:
99-
- If you want to quickly start for simplicity and only one bot started, you can use **Command-line setting**
105+
- If you want to quickly start for simplicity, you can use **Command-line setting**
100106
- If you would like to start multiple bot at once, and access advanced options, you can use **Config file setting**
101107

102108
1. **Command-line Setting**
103109
In-game profile should be defined on below boot command-line.
104110
An example of argument list:
105111
```bash
106-
java -jar "DolphinBot-[version]-full.jar" -username=[username] -password=[password] -skin-recorder=[enable/disable]
112+
java -jar "DolphinBot-[version]-full.jar" --username=[username] --password=[password] --skin-recorder=[enable/disable]
107113
```
108-
`--username` : in-game displaying name of bot.
109-
`--password` : password for login or register.
110-
`--auto-reconnect` : whether reconnect to server when got kicked or disconnect by some reasons.
111-
`--skin-recorder` : whether automatic capture and save online players' skins.
112-
`--server` : target server address.
113-
`--port` : target server port.
114+
| Command Lines | Description |
115+
|--------------------|----------------------------------------------------------------------------|
116+
| `--username` | in-game displaying name of bot. |
117+
| `--password` | password for login or register. |
118+
| `--auto-reconnect` | whether reconnect to server when got kicked or disconnect by some reasons. |
119+
| `--skin-recorder` | whether automatic capture and save online players' skins. |
120+
| `--server` | target server address. |
121+
| `--port` | target server port. |
122+
114123
Example:
115124
```bash
116125
java -jar "DolphinBot-[version]-full.jar" --username=[username] --password=[password] --server=0.0.0.0 --port=25565
117126
```
118-
or
119127
```bash
120128
java -jar "DolphinBot-[version]-full.jar" --username=Dolphin1 --password=123 --server=2b2t.xin --port=25565 --owner=Melibertan
121129
```
122-
Command profile will be loaded:
123130
<p align="center">
124131
<img src="assets/dolphinbot-profile.png" alt="profile list">
125132
</p>
126133
127-
**Warning:** command-line has high authority than config file, meaning that if options are duplicated, will only recognize
134+
> [!NOTE]
135+
>
136+
> **Warning:** command-line has high authority than config file, meaning that if options are duplicated, will only recognize
128137
command-line, and ignore config file one.
129-
Optionally, you can specify more option by adding argument:
130-
`--owner` : Specifying only who can use this bot.
131-
2. **Config File Setting**
138+
139+
> [!TIP]
140+
>
141+
> Optionally, you can specify more option by adding argument:
142+
`--owner` : Specifying only who can use this bot.
143+
144+
**Example:**
145+
`--owner=Melibertan`, of course, you also can define multiple names. For each owner name, should be split with ";".
146+
**Example:**
147+
`--owner=owner1;owner2;owner3;...`
148+
### Config File Setting
132149
Config files include functional config `mc.bot.config.json` and profile config `bot.profiles.json`
133150
You can also move above profile arguments into config file ``bot.profiles.json`` following below formats, all config values in it will be loaded.
134151
DolphinBot will apply command-line options first, duplicated options in config file will be ignored.
135152
To specify the path of config file is optional, Use option `--config-file` to locate config directory or file.
136153
For example:
137154
```bash
138-
java -jar "DolphinBot-[version].jar" -config-file=path/to/config.json
155+
java -jar "DolphinBot-[version].jar" --config-file=path/to/config.json
139156
```
140157
If the path you specified is a directory instead of a file, Dolphin will extract config file as default config in this directory.
141158
```bash
142-
java -jar "DolphinBot-[version].jar" -config-file=path/to/config_directory
159+
java -jar "DolphinBot-[version].jar" --config-file=path/to/config_directory
143160
```
144161
If the `--config-file` parameter is absented, DolphinBot will create a default file on jar directory.
145162
```bash
146163
java -jar "DolphinBot-[version].jar"
147164
```
148-
149-
In the profile config file, you can create `profiles` key in `bot.profiles.json` to specify multiple bot profiles to log to a server.
150-
**Warning**: Defining multiple bots may trigger the anti-bot or anti-cheat, and some servers with strict policy may prohibit it.
165+
**multiple bot & proxy settings**
166+
In the profile config file, you can create `profiles` field in `bot.profiles.json` to specify multiple bot profiles to log to a server.
167+
> [!NOTE]
168+
>
169+
> Some servers may prohibit multiple bots started on same IP, proxy settings is aimed to help you to run multiple bots
170+
from different network environments or requiring distinct egress IPs.
171+
172+
To configure proxy settings for each bot, you need to edit `proxy` field. An example shown below:
173+
> [!Warn]
174+
>
175+
> **Warning**: Defining multiple bots may trigger the anti-bot or anti-cheat, and some servers with strict policy may prohibit it.
151176
```json
152177
{
153178
"profiles": {
154179
"bot#1": {
155180
"name": "Player494",
156181
"password": "123example",
157182
"owner": ["player_name"],
158-
159183
"enabled_plugins": [
160184
"QuestionAnswerer",
161185
"MessageDisplay",
162186
"HumanVerify"
163-
]
187+
],
188+
"proxy": {
189+
"enabled": false,
190+
"info": {
191+
"address": "XX.XXX.XXX.XX",
192+
"port": 8081,
193+
"type": "SOCKS4",
194+
"username": "",
195+
"password": ""
196+
}
197+
}
164198
},
165199
"bot#2": {
166200
"name": "Player495",
167201
"password": "password",
168202
"owner": ["player_name", "other_owner"],
169-
170203
"enabled_plugins": [
171204
"HumanVerify"
172-
]
205+
],
206+
"proxy": {
207+
"enabled": false,
208+
"info": {"...": "..."}
209+
}
173210
},
174211
"bot#3": {"...": "..."}
175212
}
176213
}
177214
```
178-
where `enabled_plugins` key represents which plugins should enable on the bot.
215+
216+
1. `enabled_plugins` field represents which plugins should enable on the bot.
217+
2. `proxy` fields (optional) represents a proxy configurations for each bot, field `enabled` marks whether activate this proxy setting,
218+
and field `info` contains:
219+
220+
| field | Description |
221+
|-------------|-------------------------------------------------|
222+
| `address` | Remote IP address or host name of proxy server. |
223+
| `port` | Proxy server port. |
224+
| `type` | Proxy mode. (`HTTP`, `SOCKS4`, `SOCKS5`) |
225+
> [!TIP]
226+
>
227+
> "username", "password" is optional, if the remote proxy server require to auth, you need to add these.
228+
179229
In this case, if you want to load `bot#1` as your single bot, you should add below argument:
180230
```bash
181-
java -jar "DolphinBot-[version].jar" --config-file=path/to/config_directory -profiles="bot#1"
182-
```
183-
or
231+
java -jar "DolphinBot-[version].jar" --config-file=path/to/config_directory --profiles="bot#1"
232+
```
184233
```bash
185234
java -jar "DolphinBot-[version].jar" --profiles="bot#1"
186235
```
187-
If you want to start multiple bot simultaneously, specify multiple profile name as a list in option `-profiles`, for
236+
If you want to start multiple bot simultaneously, specify multiple profile name as a list in option `--profiles`, for
188237
each profile name, should be split with ";".
189238
190-
**Examples:**
191-
```bash
192-
java -jar "DolphinBot-[version].jar" --profiles="bot#1;bot#2"
193-
```
239+
**Examples:**
194240
```bash
195241
java -jar "DolphinBot-[version].jar" --profiles="bot#1;bot#2;bot#3;..."
196242
```
197-
- **Warning**: If the `--profiles` option is absented, it will load all bots in profile config by default.
243+
> [!NOTE]
244+
>
245+
> - **Warning**: If the `--profiles` option is absented, it will load all bots in profile config by default.
198246
199247
**Owners:**
200248
If you want to limit a bot can be only use by specified player(s) you can put player names into `owner` as list.
@@ -210,23 +258,21 @@ In this section, you will understand below how-tos:
210258
"owner2",
211259
"owner3"
212260
],
213-
214-
"enabled_plugins": [
215-
"QuestionAnswerer",
216-
"MessageDisplay",
217-
"HumanVerify"
218-
]
261+
"enabled_plugins": [ "QuestionAnswerer", "MessageDisplay", "HumanVerify" ],
262+
"proxy": {
263+
"enabled": false,
264+
"info": {
265+
"address": "XX.XXX.XXX.XX",
266+
"port": 8081,
267+
"type": "SOCKS4",
268+
"username": "",
269+
"password": ""
270+
}
271+
}
219272
}
220273
}
221274
}
222275
```
223-
224-
Or you can directly define it by command line.
225-
**Example:**
226-
`--owner=Melibertan`, of course, you also can define multiple names:
227-
For each owner name, should be split with ";".
228-
**Example:**
229-
`--owner=owner1;owner2;owner3;...`
230276
2. **Advanced Configurations (optional)**
231277
If you want to access more advanced configs, you can edit `mc.bot.config.json`.
232278
Every single config option is equilibrium to option that defined by command line, and all config value including
@@ -262,6 +308,7 @@ In this section, you will understand below how-tos:
262308
| `reconnect-delay` | Min delay(millis) for cooling down when reconnect a server. |
263309
| `msg-send-delay` | The delay of sending in-game messages. |
264310
| `enable-packet-debug` | Whether enable packet debugger. |
311+
265312
## Hot Swapping Plugins In-Game
266313
Dolphin bot supports you to **hot-reload** and **hot-load** (**hot injection**) plugins in server, without quit the entire client and reconnecting to server.
267314
You can send `!reload <pluginName>` dolphin command in server chat.
@@ -285,7 +332,7 @@ Alternatively, you can type `reload plugin.jar` in the terminal to hot-reload pl
285332
Sure! you can become the **second contributor** of DolphinBot team! you can join at any time freely.
286333
287334
### Our First Contributor:
288-
1. huangdihd - (Fixed a critical bug in commit [README.md](README.md)(`#372990a`)
335+
1. huangdihd - (Fixed a critical bug in commit(`#372990a`)
289336
## Community
290337
- Encountered a bug? issues and suggestions are welcome!
291338
My Bilibili space:

0 commit comments

Comments
 (0)