File tree 3 files changed +23
-7
lines changed
src/main/java/me/creepermaxcz/mcbots
3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ plugins {
3
3
}
4
4
5
5
group ' me.creepermaxcz.mc-bots'
6
- version ' 1.2.5 '
6
+ version ' 1.2.6 '
7
7
8
8
sourceCompatibility = 1.8
9
9
targetCompatibility = 1.8
@@ -16,7 +16,7 @@ repositories {
16
16
}
17
17
18
18
dependencies {
19
- implementation ' com.github.steveice10:mcprotocollib:1.19.1-SNAPSHOT '
19
+ implementation ' com.github.steveice10:mcprotocollib:1.19.2-1 '
20
20
implementation ' commons-cli:commons-cli:1.5.0'
21
21
implementation ' com.diogonunes:JColor:5.2.0'
22
22
implementation ' dnsjava:dnsjava:3.4.3'
Original file line number Diff line number Diff line change @@ -81,8 +81,16 @@ public void packetReceived(Session session, Packet packet) {
81
81
if (packet instanceof ClientboundLoginPacket ) {
82
82
connected = true ;
83
83
Log .info (nickname + " connected" );
84
- if (Main .joinMessage != null ) {
85
- sendChat (Main .joinMessage );
84
+
85
+ if (Main .joinMessages .size () > 0 ) {
86
+ for (String msg : Main .joinMessages ) {
87
+ sendChat (msg );
88
+
89
+ try {
90
+ Thread .sleep (100 );
91
+ } catch (InterruptedException ignored ) {
92
+ }
93
+ }
86
94
}
87
95
}
88
96
else if (packet instanceof ClientboundPlayerPositionPacket ) {
@@ -114,7 +122,6 @@ public void run() {
114
122
@ Override
115
123
public void disconnected (DisconnectedEvent event ) {
116
124
connected = false ;
117
- Main .removeBot (Bot .this );
118
125
Log .info (nickname + " disconnected" );
119
126
120
127
// Do not write disconnect reason if disconnected by command
@@ -143,6 +150,8 @@ public void disconnected(DisconnectedEvent event) {
143
150
Log .info ();
144
151
}
145
152
153
+ Main .removeBot (Bot .this );
154
+
146
155
Thread .currentThread ().interrupt ();
147
156
}
148
157
});
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public class Main {
31
31
private static int delayMax = 5000 ;
32
32
private static boolean minimal = false ;
33
33
private static boolean mostMinimal = false ;
34
- public static String joinMessage ;
34
+ public static ArrayList < String > joinMessages = new ArrayList <>() ;
35
35
36
36
public static String prompt = "?" ;
37
37
@@ -188,7 +188,14 @@ public static void main(String[] args) throws Exception {
188
188
String address = cmd .getOptionValue ('s' );
189
189
coloredChat = !cmd .hasOption ('n' );
190
190
191
- joinMessage = cmd .getOptionValue ('j' );
191
+ if (cmd .hasOption ('j' )) {
192
+ // Split messages by &&, trim and append to arraylist
193
+ String [] messages = cmd .getOptionValue ('j' ).split ("&&" );
194
+ for (String msg : messages ) {
195
+ joinMessages .add (msg .trim ());
196
+ }
197
+ }
198
+
192
199
193
200
int port = 25565 ;
194
201
if (address .contains (":" )) {
You can’t perform that action at this time.
0 commit comments