Proper support fo 1.19.4! #69
No files matched your search
+2
-2
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'me.creepermaxcz.mc-bots'
|
group 'me.creepermaxcz.mc-bots'
|
||||||
version '1.2.6'
|
version '1.2.7'
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
@@ -16,7 +16,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.steveice10:mcprotocollib:1.19.2-1'
|
implementation 'com.github.steveice10:mcprotocollib:1.19.4-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'
|
||||||
|
|||||||
@@ -231,4 +231,4 @@ eval "set -- $(
|
|||||||
tr '\n' ' '
|
tr '\n' ' '
|
||||||
)" '"$@"'
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
@@ -7,7 +7,6 @@ import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
|||||||
import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException;
|
import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException;
|
||||||
import com.github.steveice10.mc.protocol.data.game.ClientCommand;
|
import com.github.steveice10.mc.protocol.data.game.ClientCommand;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket;
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerCombatKillPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerCombatKillPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatCommandPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatCommandPacket;
|
||||||
@@ -24,9 +23,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.*;
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -126,11 +123,9 @@ public class Bot extends Thread {
|
|||||||
|
|
||||||
// Do not write disconnect reason if disconnected by command
|
// Do not write disconnect reason if disconnected by command
|
||||||
if (!manualDisconnecting) {
|
if (!manualDisconnecting) {
|
||||||
//Log.info(" -> " + event.getReason());
|
// Fix broken reason string by finding the content with regex
|
||||||
|
|
||||||
//fix broken reason string by finding the content with regex
|
|
||||||
Pattern pattern = Pattern.compile("content=\"(.*?)\"");
|
Pattern pattern = Pattern.compile("content=\"(.*?)\"");
|
||||||
Matcher matcher = pattern.matcher(event.getReason());
|
Matcher matcher = pattern.matcher(String.valueOf(event.getReason()));
|
||||||
|
|
||||||
StringBuilder reason = new StringBuilder();
|
StringBuilder reason = new StringBuilder();
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
@@ -169,24 +164,24 @@ public class Bot extends Thread {
|
|||||||
client.send(new ServerboundChatCommandPacket(
|
client.send(new ServerboundChatCommandPacket(
|
||||||
text.substring(1),
|
text.substring(1),
|
||||||
timeStamp,
|
timeStamp,
|
||||||
|
0L,
|
||||||
|
Collections.emptyList(),
|
||||||
0,
|
0,
|
||||||
new ArrayList<>(),
|
new BitSet()
|
||||||
true,
|
|
||||||
new ArrayList<>(),
|
|
||||||
null
|
|
||||||
));
|
));
|
||||||
} 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.
|
||||||
// salt is set 0 since this is offline server and no body will check it.
|
// salt is set 0 since this is offline server and no body will check it.
|
||||||
client.send(new ServerboundChatPacket(text,
|
|
||||||
timeStamp,
|
client.send(new ServerboundChatPacket(
|
||||||
|
text,
|
||||||
|
Instant.now().toEpochMilli(),
|
||||||
|
0L,
|
||||||
|
null,
|
||||||
0,
|
0,
|
||||||
new byte[0],
|
new BitSet()
|
||||||
true,
|
|
||||||
new ArrayList<>(),
|
|
||||||
null
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class MainListener implements SessionListener {
|
|||||||
// For example, some commands like /say makes the message content as null.
|
// For example, some commands like /say makes the message content as null.
|
||||||
// However, the message exists as in getMessagePlain(), thus can retrieve message using the method.
|
// However, the message exists as in getMessagePlain(), thus can retrieve message using the method.
|
||||||
if (message == null) { // When this message was null.
|
if (message == null) { // When this message was null.
|
||||||
Log.chat(Utils.getFullText((TextComponent) sender, clientboundPlayerChatPacket.getMessagePlain(), Main.coloredChat));
|
Log.chat(Utils.getFullText((TextComponent) sender, clientboundPlayerChatPacket.getContent(), Main.coloredChat));
|
||||||
} else { // When message exists.
|
} else { // When message exists.
|
||||||
Log.chat(Utils.getFullText((TextComponent) sender, (TextComponent) message, Main.coloredChat));
|
Log.chat(Utils.getFullText((TextComponent) sender, (TextComponent) message, Main.coloredChat));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user