Requesting PR for 1.19.1 (and 1.19.2) #44
No files matched your search
@@ -17,7 +17,6 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.steveice10:mcprotocollib:1.19.1-SNAPSHOT'
|
implementation 'com.github.steveice10:mcprotocollib:1.19.1-SNAPSHOT'
|
||||||
//implementation 'com.github.steveice10:mcprotocollib:1.19-1'
|
|
||||||
implementation 'commons-cli:commons-cli:1.5.0'
|
implementation 'commons-cli:commons-cli:1.5.0'
|
||||||
implementation 'com.diogonunes:JColor:5.2.0'
|
implementation 'com.diogonunes:JColor:5.2.0'
|
||||||
implementation 'dnsjava:dnsjava:3.4.3'
|
implementation 'dnsjava:dnsjava:3.4.3'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import com.github.steveice10.packetlib.tcp.TcpClientSession;
|
|||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.UUID;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@ public class Bot extends Thread {
|
|||||||
private ProxyInfo proxy;
|
private ProxyInfo proxy;
|
||||||
private InetSocketAddress address;
|
private InetSocketAddress address;
|
||||||
private Session client;
|
private Session client;
|
||||||
|
private UUID uuid;
|
||||||
private boolean hasMainListener;
|
private boolean hasMainListener;
|
||||||
|
|
||||||
private double lastX, lastY, lastZ = -1;
|
private double lastX, lastY, lastZ = -1;
|
||||||
@@ -40,6 +41,7 @@ public class Bot extends Thread {
|
|||||||
this.nickname = nickname;
|
this.nickname = nickname;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.proxy = proxy;
|
this.proxy = proxy;
|
||||||
|
this.uuid = UUID.randomUUID(); // Add random UUID for sending message.
|
||||||
|
|
||||||
Log.info("Creating bot", nickname);
|
Log.info("Creating bot", nickname);
|
||||||
protocol = new MinecraftProtocol(nickname);
|
protocol = new MinecraftProtocol(nickname);
|
||||||
@@ -108,7 +110,7 @@ public class Bot extends Thread {
|
|||||||
// The server console will print out that the message was "expired". To avoid this, set timeStamp as now.
|
// The server console will print out that the message was "expired". To avoid this, set timeStamp as now.
|
||||||
long timeStamp = Instant.now().toEpochMilli();
|
long timeStamp = Instant.now().toEpochMilli();
|
||||||
|
|
||||||
//send command
|
// Send command
|
||||||
if (text.startsWith("/")) {
|
if (text.startsWith("/")) {
|
||||||
client.send(new ServerboundChatCommandPacket(
|
client.send(new ServerboundChatCommandPacket(
|
||||||
text.substring(1),
|
text.substring(1),
|
||||||
@@ -117,11 +119,10 @@ public class Bot extends Thread {
|
|||||||
new ArrayList<>(),
|
new ArrayList<>(),
|
||||||
true,
|
true,
|
||||||
new ArrayList<>(),
|
new ArrayList<>(),
|
||||||
new LastSeenMessage(null, null)
|
new LastSeenMessage(uuid, new byte[0])
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
//send chat message
|
// Send chat message
|
||||||
|
|
||||||
// From 1.19.1 or 1.19, the ServerboundChatPacket needs timestamp, salt and signed signature to generate packet.
|
// From 1.19.1 or 1.19, the ServerboundChatPacket needs timestamp, salt and signed signature to generate packet.
|
||||||
// tmpSignature will provide an empty byte array that can pretend it as signature.
|
// tmpSignature will provide an empty byte array that can pretend it as signature.
|
||||||
byte[] tmpSignature = new byte[0]; // Set it empty byte array.
|
byte[] tmpSignature = new byte[0]; // Set it empty byte array.
|
||||||
@@ -132,12 +133,11 @@ public class Bot extends Thread {
|
|||||||
new byte[0],
|
new byte[0],
|
||||||
true,
|
true,
|
||||||
new ArrayList<>(),
|
new ArrayList<>(),
|
||||||
new LastSeenMessage(null, null)));
|
new LastSeenMessage(uuid, new byte[0])
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getNickname() {
|
public String getNickname() {
|
||||||
return nickname;
|
return nickname;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user