From 73b89256f0150cf1a13a1e25734fe5813c5496cb Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 19 Jun 2024 12:03:41 +0200 Subject: [PATCH] Remove Packet Signed-off-by: Lixfel --- .../protocol/packet/UpdateTeamsPacket.java | 131 ------------------ 1 file changed, 131 deletions(-) delete mode 100644 src/de/steamwar/bungeecore/protocol/packet/UpdateTeamsPacket.java diff --git a/src/de/steamwar/bungeecore/protocol/packet/UpdateTeamsPacket.java b/src/de/steamwar/bungeecore/protocol/packet/UpdateTeamsPacket.java deleted file mode 100644 index 9c79228..0000000 --- a/src/de/steamwar/bungeecore/protocol/packet/UpdateTeamsPacket.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2024 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.bungeecore.protocol.packet; - -import com.velocitypowered.api.network.ProtocolVersion; -import com.velocitypowered.api.proxy.Player; -import com.velocitypowered.proxy.connection.MinecraftSessionHandler; -import com.velocitypowered.proxy.protocol.MinecraftPacket; -import com.velocitypowered.proxy.protocol.ProtocolUtils; -import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder; -import io.netty.buffer.ByteBuf; -import lombok.*; -import net.kyori.adventure.text.Component; - -import java.util.List; - -@AllArgsConstructor -@NoArgsConstructor -@Builder -@Getter -@Setter -public class UpdateTeamsPacket implements MinecraftPacket { - private String name; - private Mode mode; - - private Component displayName; - private Component prefix; - private Component suffix; - private NameTagVisibility nameTagVisibility; - private CollisionRule collisionRule; - private int color; - private byte friendlyFlags; - - private List players; - - - @Override - public void decode(ByteBuf byteBuf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { - throw new UnsupportedOperationException("Packet is not implemented"); - } - - @Override - public boolean handle(MinecraftSessionHandler minecraftSessionHandler) { - return false; - } - - @Override - public void encode(ByteBuf byteBuf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { - ProtocolUtils.writeString(byteBuf, name); - byteBuf.writeByte(mode.ordinal()); - - switch (mode) { - case CREATE, UPDATE: - new ComponentHolder(protocolVersion, displayName).write(byteBuf); - if (protocolVersion.lessThan(ProtocolVersion.MINECRAFT_1_13)) { - new ComponentHolder(protocolVersion, prefix).write(byteBuf); - new ComponentHolder(protocolVersion, suffix).write(byteBuf); - } - byteBuf.writeByte(friendlyFlags); - ProtocolUtils.writeString(byteBuf, nameTagVisibility.getValue()); - ProtocolUtils.writeString(byteBuf, collisionRule.getValue()); - if (protocolVersion.greaterThan(ProtocolVersion.MINECRAFT_1_12_2)) { - ProtocolUtils.writeVarInt(byteBuf, color); - new ComponentHolder(protocolVersion, prefix).write(byteBuf); - new ComponentHolder(protocolVersion, suffix).write(byteBuf); - } else { - byteBuf.writeByte((byte) color); - } - ProtocolUtils.writeVarInt(byteBuf, players.size()); - for (Player player : players) { - ProtocolUtils.writeString(byteBuf, player.getUsername()); - } - break; - case ADD_PLAYER, REMOVE_PLAYER: - ProtocolUtils.writeVarInt(byteBuf, players.size()); - for (Player player : players) { - ProtocolUtils.writeString(byteBuf, player.getUsername()); - } - break; - case REMOVE: - break; - } - } - - public enum Mode { - CREATE, - REMOVE, - UPDATE, - ADD_PLAYER, - REMOVE_PLAYER, - } - - @AllArgsConstructor - @Getter - enum NameTagVisibility { - ALWAYS("always"), - NEVER("never"), - HIDE_FOR_OTHER_TEAMS("hideForOtherTeams"), - HIDE_FOR_OWN_TEAM("hideForOwnTeam"); - - private final String value; - } - - @AllArgsConstructor - @Getter - enum CollisionRule { - ALWAYS("always"), - NEVER("never"), - PUSH_OTHER_TEAMS("pushOtherTeams"), - PUSH_OWN_TEAM("pushOwnTeam"); - - private final String value; - } -}