20
20
* The EntityBOT used to store all information about the user
21
21
*
22
22
* @author <a href="https://github.com/alwyn974">Alwyn974</a>
23
- * @version 1.0.13
23
+ * @version 1.0.15
24
24
* @since 1.0.0
25
25
*/
26
26
public class EntityBOT {
@@ -32,6 +32,7 @@ public class EntityBOT {
32
32
private final String password ;
33
33
private final boolean debug ;
34
34
private final boolean autoReconnect ;
35
+ private final long reconnectDelay ;
35
36
private Session client = null ;
36
37
private EntityPos pos = null ;
37
38
private double health = -1 ;
@@ -46,7 +47,7 @@ public class EntityBOT {
46
47
* @param password the password of the account
47
48
*/
48
49
public EntityBOT (String username , String password ) {
49
- this ("localhost " , username , password , false );
50
+ this ("127.0.0.1 " , username , password , false );
50
51
}
51
52
52
53
/**
@@ -95,7 +96,7 @@ public EntityBOT(String host, int port, String username, String password) {
95
96
* @param debug activate debug mode
96
97
*/
97
98
public EntityBOT (String host , int port , String username , String password , boolean debug ) {
98
- this (host , port , Proxy . NO_PROXY , username , password , debug , false );
99
+ this (host , port , username , password , debug , false , 1000 );
99
100
}
100
101
101
102
/**
@@ -106,29 +107,31 @@ public EntityBOT(String host, int port, String username, String password, boolea
106
107
* @param debug activate debug mode
107
108
* @param autoReconnect activate auto reconnect mode
108
109
*/
109
- public EntityBOT (String host , int port , String username , String password , boolean debug , boolean autoReconnect ) {
110
- this (host , port , Proxy .NO_PROXY , username , password , debug , autoReconnect );
110
+ public EntityBOT (String host , int port , String username , String password , boolean debug , boolean autoReconnect , long reconnectDelay ) {
111
+ this (host , port , Proxy .NO_PROXY , username , password , debug , autoReconnect , reconnectDelay );
111
112
}
112
113
113
114
/**
114
115
* Instanciate the EntityBOT
115
116
*
116
- * @param host the minecraft server address
117
- * @param port the minecraft server port
118
- * @param proxy the proxy
119
- * @param username the email of the premium account <br><strong>ONLY MOJANG ACCOUNT</strong>
120
- * @param password the password of the premium account
121
- * @param debug activate debug mode
122
- * @param autoReconnect activate auto reconnect
117
+ * @param host the minecraft server address
118
+ * @param port the minecraft server port
119
+ * @param proxy the proxy
120
+ * @param username the email of the premium account <br><strong>ONLY MOJANG ACCOUNT</strong>
121
+ * @param password the password of the premium account
122
+ * @param debug activate debug mode
123
+ * @param autoReconnect activate auto reconnect
124
+ * @param reconnectDelay delay before reconnect
123
125
*/
124
- public EntityBOT (String host , int port , Proxy proxy , String username , String password , boolean debug , boolean autoReconnect ) {
126
+ public EntityBOT (String host , int port , Proxy proxy , String username , String password , boolean debug , boolean autoReconnect , long reconnectDelay ) {
125
127
this .host = host ;
126
128
this .port = port ;
127
129
this .proxy = proxy ;
128
130
this .username = username ;
129
131
this .password = password ;
130
132
this .debug = debug ;
131
133
this .autoReconnect = autoReconnect ;
134
+ this .reconnectDelay = reconnectDelay ;
132
135
}
133
136
134
137
/**
@@ -144,6 +147,7 @@ public EntityBOT(ParseResult result) {
144
147
this .debug = result .isDebug ();
145
148
this .proxy = Proxy .NO_PROXY ;
146
149
this .autoReconnect = result .isAutoReconnect ();
150
+ this .reconnectDelay = result .getReconnectDelay ();
147
151
}
148
152
149
153
/**
@@ -209,6 +213,15 @@ public boolean isAutoReconnect() {
209
213
return autoReconnect ;
210
214
}
211
215
216
+ /**
217
+ * Get reconnect delay
218
+ *
219
+ * @return the delay
220
+ */
221
+ public long getReconnectDelay () {
222
+ return reconnectDelay ;
223
+ }
224
+
212
225
/**
213
226
* Get the client
214
227
*
0 commit comments