001/*
002 * Forge Mod Loader
003 * Copyright (c) 2012-2013 cpw.
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser Public License v2.1
006 * which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
008 * 
009 * Contributors:
010 *     cpw - implementation
011 */
012
013package cpw.mods.fml.common.network;
014
015import net.minecraft.network.INetworkManager;
016import net.minecraft.network.NetLoginHandler;
017import net.minecraft.network.packet.NetHandler;
018import net.minecraft.network.packet.Packet1Login;
019import net.minecraft.server.MinecraftServer;
020
021public interface IConnectionHandler
022{
023    /**
024     * Called when a player logs into the server
025     *  SERVER SIDE
026     *
027     * @param player
028     * @param netHandler
029     * @param manager
030     */
031    void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager);
032
033    /**
034     * If you don't want the connection to continue, return a non-empty string here
035     * If you do, you can do other stuff here- note no FML negotiation has occured yet
036     * though the client is verified as having FML installed
037     *
038     * SERVER SIDE
039     *
040     * @param netHandler
041     * @param manager
042     */
043    String connectionReceived(NetLoginHandler netHandler, INetworkManager manager);
044
045    /**
046     * Fired when a remote connection is opened
047     * CLIENT SIDE
048     *
049     * @param netClientHandler
050     * @param server
051     * @param port
052     */
053    void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager);
054    /**
055     *
056     * Fired when a local connection is opened
057     *
058     * CLIENT SIDE
059     *
060     * @param netClientHandler
061     * @param server
062     */
063    void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager);
064
065    /**
066     * Fired when a connection closes
067     *
068     * ALL SIDES
069     *
070     * @param manager
071     */
072    void connectionClosed(INetworkManager manager);
073
074    /**
075     * Fired when the client established the connection to the server
076     *
077     * CLIENT SIDE
078     * @param clientHandler
079     * @param manager
080     * @param login
081     */
082    void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login);
083
084}