Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from V1nc3ntWasTaken/1.19.1
Browse files Browse the repository at this point in the history
Merge 1.19.1 support to the main branch
  • Loading branch information
V1nc3ntWasTaken committed Aug 3, 2022
2 parents e99ed9b + e8f9fb9 commit 360e53f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.doclic</groupId>
<artifactId>NoEncryption</artifactId>
<version>2.1</version>
<version>3.0</version>
<packaging>jar</packaging>

<name>NoEncryption</name>
Expand Down Expand Up @@ -57,9 +57,9 @@
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
Expand All @@ -72,8 +72,8 @@
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -102,13 +102,13 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.19.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.19.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static void initialize(NoEncryption plugin) {
Compatibility.plugin = plugin;

// 1.19 is "1.19-R0.1-SNAPSHOT"
Compatibility.compatibleVersion = "1.19-R0.1-SNAPSHOT";
Compatibility.compatibleVersion = "1.19.1-R0.1-SNAPSHOT";

try {
bukkitVersion = Bukkit.getBukkitVersion(); // Gets the server version displayable to a user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,42 @@

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.*;
import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket;
import net.minecraft.util.Crypt.SaltSignaturePair;

import java.util.Optional;
import java.util.UUID;

public class CompatiblePacketListener {

public Object readPacket(ChannelHandlerContext channelHandlerContext, Object packet) { return packet; }

public Object writePacket(ChannelHandlerContext channelHandlerContext, Object packet, ChannelPromise promise) {
if (packet instanceof final ClientboundPlayerChatPacket clientboundPlayerChatPacket) {
final Optional<Component> unsignedContent = clientboundPlayerChatPacket.unsignedContent();
// Code partially by atenfyr https://github.com/atenfyr
final Optional<Component> unsignedContent = clientboundPlayerChatPacket.message().unsignedContent();
final ChatMessageContent signedContent = clientboundPlayerChatPacket.message().signedContent();
final SignedMessageBody signedBody = clientboundPlayerChatPacket.message().signedBody();
final ChatType.BoundNetwork chatType = clientboundPlayerChatPacket.chatType();

// recreate a new packet
return new ClientboundPlayerChatPacket(
unsignedContent.orElse(clientboundPlayerChatPacket.signedContent()), // use unsigned content if available, this is the signed content field
unsignedContent, // unsigned content field
clientboundPlayerChatPacket.typeId(),
clientboundPlayerChatPacket.sender(),
clientboundPlayerChatPacket.timeStamp(),
new SaltSignaturePair(0, new byte[0])); // salt signature field
new PlayerChatMessage(
new SignedMessageHeader(
new MessageSignature(new byte[0]),
new UUID(0,0)),
new MessageSignature(new byte[0]),
new SignedMessageBody(
new ChatMessageContent(
signedContent.plain(),
signedContent.decorated()),
signedBody.timeStamp(),
0,
signedBody.lastSeen()),
unsignedContent,
new FilterMask(0)
),
chatType);
}

return packet;
Expand Down

0 comments on commit 360e53f

Please sign in to comment.