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 #2 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 5, 2022
2 parents 360e53f + 7a41328 commit 1b52e85
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 9 deletions.
63 changes: 63 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 🐞 Bug Report
description: Report a bug for NoEncryption (Must be using V1nc3ntWasTaken's fork).
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues and have not found a duplicate relating to my issue.
required: true
- type: checkboxes
attributes:
label: Are you using the latest version of NoEncryption (Must be using V1nc3ntWasTaken's fork)?
description: Please make sure you're using the latest version of NoEncryption as it's possible your issue has already been fixed.
options:
- label: I am using the latest version of MockBukkit.
required: true
- type: dropdown
id: ne-version
attributes:
label: NoEncryption Version
description: What NoEncryption version is your server running (Must be using V1nc3ntWasTaken's fork)?
options:
- 3.0
- 2.1
- type: dropdown
id: mv-version
attributes:
label: Minecraft Version
description: What Minecraft version is your server running?
options:
- 1.19.1
- 1.19
validations:
required: true
- type: textarea
id: fw-version
attributes:
label: Server Type
description: What server type and version are you running? Use the contents of /version
validations:
required: true
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: Describe the bug in as much detail as you can.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproducible Test
description: Please write a test that can reliably reproduce the bug. Include any plugins that you may interact with in the time span.
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
validations:
required: false
2 changes: 1 addition & 1 deletion 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>3.0</version>
<version>3.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>NoEncryption</name>
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/me/doclic/noencryption/PlayerListener.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package me.doclic.noencryption;

import io.netty.channel.Channel;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelPromise;
import me.doclic.noencryption.compatibility.*;
import io.netty.channel.*;
import me.doclic.noencryption.compatibility.CompatiblePacketListener;
import me.doclic.noencryption.compatibility.CompatiblePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
Expand All @@ -20,7 +17,7 @@ public void onPlayerJoin (PlayerJoinEvent e) {

final Player player = e.getPlayer();
final ChannelPipeline pipeline = new CompatiblePlayer().getChannel(player).pipeline();
pipeline.addBefore("packet_handler", player.getUniqueId().toString(), new ChannelDuplexHandler() {
pipeline.addBefore("packet_handler", "no_encryption", new ChannelDuplexHandler() {

@Override
public void channelRead(ChannelHandlerContext channelHandlerContext, Object packet) throws Exception {
Expand All @@ -47,7 +44,7 @@ public void onPlayerQuit (PlayerQuitEvent e) {

final Player player = e.getPlayer();
final Channel channel = new CompatiblePlayer().getChannel(player);
channel.eventLoop().submit(() -> channel.pipeline().remove(player.getUniqueId().toString()));
channel.eventLoop().submit(() -> channel.pipeline().remove("no_encryption"));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import net.md_5.bungee.chat.ComponentSerializer;
import net.minecraft.network.chat.*;
import net.minecraft.network.protocol.game.ClientboundPlayerChatHeaderPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket;
import net.minecraft.network.protocol.game.ClientboundSystemChatPacket;

import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -40,6 +43,22 @@ public Object writePacket(ChannelHandlerContext channelHandlerContext, Object pa
chatType);
}

if (packet instanceof final ClientboundSystemChatPacket clientboundSystemChatPacket) {
return new ClientboundSystemChatPacket(
ComponentSerializer.parse(clientboundSystemChatPacket.content()),
clientboundSystemChatPacket.overlay());
}

if (packet instanceof final ClientboundPlayerChatHeaderPacket clientboundPlayerChatHeaderPacket) {
return new ClientboundPlayerChatHeaderPacket(
new SignedMessageHeader(
new MessageSignature(new byte[0]),
new UUID(0,0)),
new MessageSignature(new byte[0]),
clientboundPlayerChatHeaderPacket.bodyDigest()
);
}

return packet;

}
Expand Down

0 comments on commit 1b52e85

Please sign in to comment.