Skip to content

Commit

Permalink
feat(bungee): support configuration phase protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotcorreia committed Oct 19, 2023
1 parent 65e0c32 commit dc6e532
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
4 changes: 2 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ test {

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-proxy:1.20-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-api:1.20-R0.2-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-proxy:1.20-R0.2-SNAPSHOT'
compileOnly 'com.velocitypowered:velocity-api:3.1.0'
annotationProcessor 'com.velocitypowered:velocity-api:3.1.0'
compileOnly 'com.comphenix.protocol:ProtocolLib:5.1.1-SNAPSHOT'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,32 @@
import com.rexcantor64.triton.Triton;
import com.rexcantor64.triton.config.MainConfig;
import com.rexcantor64.triton.player.BungeeLanguagePlayer;
import com.rexcantor64.triton.utils.NMSUtils;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import net.md_5.bungee.UserConnection;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.TranslatableComponent;
import net.md_5.bungee.chat.ComponentSerializer;
import net.md_5.bungee.netty.ChannelWrapper;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.packet.*;

import java.util.*;
import net.md_5.bungee.protocol.packet.BossBar;
import net.md_5.bungee.protocol.packet.Chat;
import net.md_5.bungee.protocol.packet.Kick;
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
import net.md_5.bungee.protocol.packet.PlayerListItem;
import net.md_5.bungee.protocol.packet.PlayerListItemRemove;
import net.md_5.bungee.protocol.packet.PlayerListItemUpdate;
import net.md_5.bungee.protocol.packet.Subtitle;
import net.md_5.bungee.protocol.packet.SystemChat;
import net.md_5.bungee.protocol.packet.Title;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

public class BungeeListener extends MessageToMessageEncoder<DefinedPacket> {

Expand Down Expand Up @@ -235,7 +248,9 @@ protected void encode(ChannelHandlerContext ctx, DefinedPacket packet,
}

private void send(DefinedPacket packet) {
((ChannelWrapper) NMSUtils.getDeclaredField(owner.getCurrentConnection(), "ch")).write(packet);
if (owner.getCurrentConnection() instanceof UserConnection) {
((UserConnection)owner.getCurrentConnection()).sendPacketQueued(packet);
}
}

public void refreshTab() {
Expand Down

0 comments on commit dc6e532

Please sign in to comment.