Skip to content

Commit 26d2153

Browse files
[~] Improved README.md
1 parent a30529a commit 26d2153

File tree

7 files changed

+82
-55
lines changed

7 files changed

+82
-55
lines changed

README.md

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ In this section, you will understand below how-tos:
9898
1. **Download the Client**
9999
Download the jar archive file: `DolphinBot-[version]-full.jar`.
100100

101-
> [!NOTE]
101+
> [!IMPORTANT]
102102
> Requirements: **Java version >= 17**
103103
104104
2. **Configuration of the Bot**
@@ -134,7 +134,7 @@ In this section, you will understand below how-tos:
134134
</p>
135135
136136
> [!NOTE]
137-
> **Warning:** Command-line has high authority than config file, meaning that if options are duplicated, will only recognize
137+
> Command-line has high authority than config file, meaning that if options are duplicated, will only recognize
138138
command-line, and ignore config file one.
139139
140140
> [!TIP]
@@ -153,67 +153,67 @@ In this section, you will understand below how-tos:
153153
To specify the path of config file is optional, Use option `--config-file` to locate config directory or file.
154154
For example:
155155
```bash
156-
java -jar "DolphinBot-[version].jar" --config-file=path/to/config.json
156+
java -jar "DolphinBot-[version].jar" --config-file=path/to/config.json
157157
```
158158
If the path you specified is a directory instead of a file, Dolphin will extract config file as default config in this directory.
159159
```bash
160-
java -jar "DolphinBot-[version].jar" --config-file=path/to/config_directory
160+
java -jar "DolphinBot-[version].jar" --config-file=path/to/config_directory
161161
```
162162
If the `--config-file` parameter is absented, DolphinBot will create a default file on jar directory.
163163
```bash
164-
java -jar "DolphinBot-[version].jar"
164+
java -jar "DolphinBot-[version].jar"
165165
```
166166
**multiple bot & proxy settings**
167167
In the profile config file, you can create `profiles` field in `bot.profiles.json` to specify multiple bot profiles to log to a server.
168168
169169
> [!NOTE]
170-
> Some servers may prohibit multiple bots started on same IP, proxy settings is aimed to help you to run multiple bots
171-
from different network environments or requiring distinct egress IPs.
170+
> Some servers may prohibit multiple bots started on same IP, the proxy settings is aimed to help you to run multiple bots
171+
from different network environments or requiring distinct egress IPs.
172172
173173
To configure proxy settings for each bot, you need to edit `proxy` field. An example shown below:
174-
175-
> [!WARN]
176-
> **Warning**: Defining multiple bots may trigger the anti-bot or anti-cheat, and some servers with strict policy may prohibit it.
177-
178-
```json
179-
{
180-
"profiles": {
181-
"bot#1": {
182-
"name": "Player494",
183-
"password": "123example",
184-
"owner": ["player_name"],
185-
"enabled_plugins": [
186-
"QuestionAnswerer",
187-
"MessageDisplay",
188-
"HumanVerify"
189-
],
190-
"proxy": {
191-
"enabled": false,
192-
"info": {
193-
"address": "XX.XXX.XXX.XX",
194-
"port": 8081,
195-
"type": "SOCKS4",
196-
"username": "",
197-
"password": ""
198-
}
199-
}
200-
},
201-
"bot#2": {
202-
"name": "Player495",
203-
"password": "password",
204-
"owner": ["player_name", "other_owner"],
205-
"enabled_plugins": [
206-
"HumanVerify"
207-
],
208-
"proxy": {
209-
"enabled": false,
210-
"info": {"...": "..."}
174+
175+
> [!WARNING]
176+
> Defining multiple bots may trigger the anti-bot or anti-cheat, and some servers with strict policy may prohibit it.
177+
178+
```json
179+
{
180+
"profiles": {
181+
"bot#1": {
182+
"name": "Player494",
183+
"password": "123example",
184+
"owner": ["player_name"],
185+
"enabled_plugins": [
186+
"QuestionAnswerer",
187+
"MessageDisplay",
188+
"HumanVerify"
189+
],
190+
"proxy": {
191+
"enabled": false,
192+
"info": {
193+
"address": "XX.XXX.XXX.XX",
194+
"port": 8081,
195+
"type": "SOCKS4",
196+
"username": "",
197+
"password": ""
211198
}
212-
},
213-
"bot#3": {"...": "..."}
214-
}
199+
}
200+
},
201+
"bot#2": {
202+
"name": "Player495",
203+
"password": "password",
204+
"owner": ["player_name", "other_owner"],
205+
"enabled_plugins": [
206+
"HumanVerify"
207+
],
208+
"proxy": {
209+
"enabled": false,
210+
"info": {"...": "..."}
211+
}
212+
},
213+
"bot#3": {"...": "..."}
215214
}
216-
```
215+
}
216+
```
217217
218218
1. `enabled_plugins` field represents which plugins should enable on the bot.
219219
2. `proxy` fields (optional) represents a proxy configurations for each bot, field `enabled` marks whether activate this proxy setting,
@@ -226,7 +226,7 @@ To configure proxy settings for each bot, you need to edit `proxy` field. An exa
226226
| `type` | Proxy mode. (`HTTP`, `SOCKS4`, `SOCKS5`) |
227227
228228
> [!TIP]
229-
> "username", "password" is optional, if the remote proxy server require to auth, you need to add these.
229+
> "username", "password" is optional, if the remote proxy server require to auth, then you need to add these.
230230
231231
In this case, if you want to load `bot#1` as your single bot, you should add below argument:
232232
```bash

src/main/java/org/angellock/impl/AbstractRobot.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ public void scheduleReconnect() {
228228
} catch (InterruptedException e) {
229229
throw new RuntimeException(e);
230230
}
231-
this.scheduleConnect(0);
231+
this.scheduleConnect();
232232
}
233233

234-
public void scheduleConnect(int wait) {
235-
this.reconnectScheduler.schedule(() -> this.connect(), wait, TimeUnit.SECONDS);
234+
public void scheduleConnect() {
235+
this.reconnectScheduler.schedule(this::connect, 0, TimeUnit.SECONDS);
236236
}
237237

238238
public void setBypassed(boolean bypassed) {

src/main/java/org/angellock/impl/RobotPlayer.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,20 @@
2323
import org.angellock.impl.plugin.PluginManager;
2424
import org.angellock.impl.util.ConsoleTokens;
2525
import org.angellock.impl.util.math.Position;
26+
import org.cloudburstmc.math.immutable.vector.ImmutableVector3d;
27+
import org.cloudburstmc.math.vector.Vector3d;
28+
import org.cloudburstmc.math.vector.Vector3i;
29+
import org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction;
30+
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand;
31+
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.InteractAction;
32+
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.PlayerAction;
33+
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.positionsource.BlockPositionSource;
34+
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.positionsource.PositionSource;
35+
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPlaceRecipePacket;
36+
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.*;
2637

2738
import java.util.Optional;
39+
import java.util.Vector;
2840

2941
public class RobotPlayer extends AbstractRobot {
3042
private long connectTime;
@@ -76,7 +88,7 @@ public void onKicked() {
7688
@Override
7789
public void onPreLogin() {
7890
this.connectTime = System.currentTimeMillis();
79-
log.info(ConsoleTokens.colorizeText("&l&bAttempt to join to the server &3"+ this.infoHelper.getServer()+':'+this.infoHelper.getPort() +". &bWaiting for server establishing the connection..."));
91+
log.info(ConsoleTokens.colorizeText("&l&bAttempt to join to the server &3{}:{}. &bWaiting for server establishing the connection..."), this.infoHelper.getServer(), this.infoHelper.getPort());
8092
}
8193

8294
@Override
@@ -88,4 +100,11 @@ public double getDistanceFromOthers(IPlayer player) {
88100
public Position getPosition() {
89101
return this.loginPos;
90102
}
103+
104+
@Override
105+
public void interactBlock(double x, double y, double z, int s) {
106+
this.sendPacket(new ServerboundSwingPacket(Hand.MAIN_HAND));
107+
this.sendPacket(new ServerboundUseItemOnPacket(Vector3i.from(x, y, z), Direction.SOUTH, Hand.MAIN_HAND, 0f,0f,0f,false, (int)(System.currentTimeMillis())));
108+
109+
}
91110
}

src/main/java/org/angellock/impl/ingame/IPlayer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ public interface IPlayer extends IWalkable {
77
double getDistanceFromOthers(IPlayer player);
88

99
Position getPosition();
10+
void interactBlock(double x, double y, double z, int s);
1011
}

src/main/java/org/angellock/impl/ingame/Player.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public Position getPosition() {
3333
return position;
3434
}
3535

36+
@Override
37+
public void interactBlock(double x, double y, double z, int s) {
38+
39+
}
40+
3641
public void setPosition(Position position) {
3742
this.position = position;
3843
}
@@ -54,4 +59,6 @@ public void pushVelocity(double x, double y, double z) {
5459
public double getDistanceFromOthers(IPlayer player) {
5560
return position.getDistance(player.getPosition());
5661
}
62+
63+
5764
}

src/main/java/org/angellock/impl/managers/BotManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public static Map<String, RobotPlayer> bots() {
193193

194194
public void startAll(){
195195
for (RobotPlayer bot: bots.values()){
196-
bot.scheduleConnect(0);
196+
bot.scheduleConnect();
197197
while (bot.getServerGamemode() == GameMode.ADVENTURE){
198198
try {
199199
Thread.sleep(5000L);

src/main/java/org/angellock/impl/managers/ResourceHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private void autoCopy(File outFile) throws IOException {
3939
InputStream in = Start.class.getClassLoader().getResourceAsStream(getFullFileName());
4040
if (in != null) {
4141
OutputStream out = new FileOutputStream(outFile);
42-
byte[] buf = new byte[512];
42+
byte[] buf = new byte[1024];
4343
int len;
4444
while((len = in.read(buf)) > 0) {
4545
out.write(buf, 0, len);

0 commit comments

Comments
 (0)