// Path: api-bungee/src/main/java/codecrafter47/bungeetablistplus/api/bungee/Icon.java
// @Data
// public class Icon implements Serializable {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private final UUID player;
//     @NonNull
//     private final String[][] properties;
// 
//     /**
//      * The default icon. The client will show a random Alex/ Steve face when using this.
//      */
//     public static final Icon DEFAULT = new Icon(null, new String[0][]);
// }
// 
// Path: bungee/src/main/java/codecrafter47/bungeetablistplus/protocol/PacketHandler.java
// public interface PacketHandler {
// 
//     PacketListenerResult onPlayerListPacket(PlayerListItem packet);
// 
//     PacketListenerResult onTeamPacket(Team packet);
// 
//     PacketListenerResult onPlayerListHeaderFooterPacket(PlayerListHeaderFooter packet);
// 
//     void onServerSwitch(boolean is13OrLater);
// }
// 
// Path: bungee/src/main/java/codecrafter47/bungeetablistplus/protocol/PacketListenerResult.java
// public enum PacketListenerResult {
//     PASS, MODIFIED, CANCEL;
// }


import codecrafter47.bungeetablistplus.api.bungee.Icon;
import codecrafter47.bungeetablistplus.protocol.PacketHandler;
import codecrafter47.bungeetablistplus.protocol.PacketListenerResult;
import lombok.AllArgsConstructor;
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
import net.md_5.bungee.protocol.packet.PlayerListItem;
import net.md_5.bungee.protocol.packet.Team;
/*
 *     Copyright (C) 2020 Florian Stober
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU 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 General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package codecrafter47.bungeetablistplus.tablisthandler.logic;


@AllArgsConstructor
public class TabListHandler implements PacketHandler {
    private final TabListHandler parent;

    public void onConnected() {
        if (parent != null) {
            parent.onConnected();
        }
    }

    public void onDisconnected() {
        if (parent != null) {
            parent.onDisconnected();
        }
    }

    @Override
    public PacketListenerResult onPlayerListPacket(PlayerListItem packet) {
        return parent != null ? parent.onPlayerListPacket(packet) : PacketListenerResult.PASS;
    }

    @Override
    public PacketListenerResult onTeamPacket(Team packet) {
        return parent != null ? parent.onTeamPacket(packet) : PacketListenerResult.PASS;
    }

    @Override
// Path: api-bungee/src/main/java/codecrafter47/bungeetablistplus/api/bungee/Icon.java
// @Data
// public class Icon implements Serializable {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private final UUID player;
//     @NonNull
//     private final String[][] properties;
// 
//     /**
//      * The default icon. The client will show a random Alex/ Steve face when using this.
//      */
//     public static final Icon DEFAULT = new Icon(null, new String[0][]);
// }
// 
// Path: bungee/src/main/java/codecrafter47/bungeetablistplus/protocol/PacketHandler.java
// public interface PacketHandler {
// 
//     PacketListenerResult onPlayerListPacket(PlayerListItem packet);
// 
//     PacketListenerResult onTeamPacket(Team packet);
// 
//     PacketListenerResult onPlayerListHeaderFooterPacket(PlayerListHeaderFooter packet);
// 
//     void onServerSwitch(boolean is13OrLater);
// }
// 
// Path: bungee/src/main/java/codecrafter47/bungeetablistplus/protocol/PacketListenerResult.java
// public enum PacketListenerResult {
//     PASS, MODIFIED, CANCEL;
// }


// Path: bungee/src/test/java/codecrafter47/bungeetablistplus/tablisthandler/logic/TabListHandler.java
import codecrafter47.bungeetablistplus.api.bungee.Icon;
import codecrafter47.bungeetablistplus.protocol.PacketHandler;
import codecrafter47.bungeetablistplus.protocol.PacketListenerResult;
import lombok.AllArgsConstructor;
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
import net.md_5.bungee.protocol.packet.PlayerListItem;
import net.md_5.bungee.protocol.packet.Team;

/*
 *     Copyright (C) 2020 Florian Stober
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU 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 General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package codecrafter47.bungeetablistplus.tablisthandler.logic;


@AllArgsConstructor
public class TabListHandler implements PacketHandler {
    private final TabListHandler parent;

    public void onConnected() {
        if (parent != null) {
            parent.onConnected();
        }
    }

    public void onDisconnected() {
        if (parent != null) {
            parent.onDisconnected();
        }
    }

    @Override
    public PacketListenerResult onPlayerListPacket(PlayerListItem packet) {
        return parent != null ? parent.onPlayerListPacket(packet) : PacketListenerResult.PASS;
    }

    @Override
    public PacketListenerResult onTeamPacket(Team packet) {
        return parent != null ? parent.onTeamPacket(packet) : PacketListenerResult.PASS;
    }

    @Override
    public PacketListenerResult onPlayerListHeaderFooterPacket(PlayerListHeaderFooter packet) {