コード例 #1
0
        public Protocol16Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
        {
            ConsoleIO.SetAutoCompleteEngine(this);
            if (protocolversion >= 72)
            {
                ChatParser.InitTranslations();
            }
            this.c = Client;
            this.protocolversion = ProtocolVersion;
            this.handler         = Handler;

            if (Handler.GetTerrainEnabled())
            {
                ConsoleIO.WriteLineFormatted("§e[错误]§c世界交互 暂不支持此版本");
                Handler.SetTerrainEnabled(false);
            }

            if (handler.GetInventoryEnabled())
            {
                ConsoleIO.WriteLineFormatted("§e[错误]§c物品栏交互暂不支持此版本");
                handler.SetInventoryEnabled(false);
            }

            if (handler.GetEntityHandlingEnabled())
            {
                ConsoleIO.WriteLineFormatted("§e[错误]§c实体交互暂不支持此版本");
                handler.SetEntityHandlingEnabled(false);
            }
        }
コード例 #2
0
        public Protocol16Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
        {
            ConsoleIO.SetAutoCompleteEngine(this);
            if (protocolversion >= 72)
            {
                ChatParser.InitTranslations();
            }
            this.c = Client;
            this.protocolversion = ProtocolVersion;
            this.handler         = Handler;

            if (Handler.GetTerrainEnabled())
            {
                ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
                Handler.SetTerrainEnabled(false);
            }

            if (handler.GetInventoryEnabled())
            {
                ConsoleIO.WriteLineFormatted("§8Inventories are currently not handled for that MC version.");
                handler.SetInventoryEnabled(false);
            }

            if (handler.GetEntityHandlingEnabled())
            {
                ConsoleIO.WriteLineFormatted("§8Entities are currently not handled for that MC version.");
                handler.SetEntityHandlingEnabled(false);
            }
        }
コード例 #3
0
        public Protocol16Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
        {
            ConsoleIO.SetAutoCompleteEngine(this);
            if (protocolversion >= 72)
            {
                ChatParser.InitTranslations();
            }
            this.c = Client;
            this.protocolversion = ProtocolVersion;
            this.handler         = Handler;

            if (Handler.GetTerrainEnabled())
            {
                Translations.WriteLineFormatted("extra.terrainandmovement_disabled");
                Handler.SetTerrainEnabled(false);
            }

            if (handler.GetInventoryEnabled())
            {
                Translations.WriteLineFormatted("extra.inventory_disabled");
                handler.SetInventoryEnabled(false);
            }

            if (handler.GetEntityHandlingEnabled())
            {
                Translations.WriteLineFormatted("extra.entity_disabled");
                handler.SetEntityHandlingEnabled(false);
            }
        }
コード例 #4
0
 public RespawnHandler(IMinecraftComHandler handler, DataTypes dataTypes, WorldInfo worldInfo, int protocolversion)
 {
     this.handler         = handler;
     this.dataTypes       = dataTypes;
     this.worldInfo       = worldInfo;
     this.protocolversion = protocolversion;
 }
コード例 #5
0
        public Protocol18PacketHandler(int protocolVersion, DataTypes dataTypes, IMinecraftComHandler handler, IPacketReadWriter packetSender, Protocol18Terrain pTerrain, Protocol18Forge pForge, WorldInfo worldInfo, Protocol18Handler protocol18Handler, Player player)
        {
            this.protocolversion = protocolVersion;

            MultiVersionHandler blockHandler = new MultiVersionHandler(protocolVersion);

            blockHandler.addPacketHandler(new BlockChangeHandler17(handler, dataTypes), (int)McVersion.V17).
            addPacketHandler(new BlockChangeHandler18(handler, dataTypes), (int)McVersion.V18);
            packetHandlers.Add(PacketIncomingType.BlockChange, blockHandler);


            packetHandlers.Add(PacketIncomingType.KeepAlive, new KeepAliveHandler(packetSender));
            packetHandlers.Add(PacketIncomingType.JoinGame, new JoinGameHandler(handler, dataTypes, worldInfo, protocolVersion));
            packetHandlers.Add(PacketIncomingType.ChatMessage, new ChatMessageHandler(handler, dataTypes));
            packetHandlers.Add(PacketIncomingType.Respawn, new RespawnHandler(handler, dataTypes, worldInfo, protocolVersion));
            packetHandlers.Add(PacketIncomingType.PlayerPositionAndLook, new PlayerPositionAndLookHandler(packetSender, dataTypes, handler, player, protocolVersion));
            packetHandlers.Add(PacketIncomingType.ChunkData, new ChunkDataHandler(handler, dataTypes, pTerrain, worldInfo, protocolVersion));
            packetHandlers.Add(PacketIncomingType.MultiBlockChange, new MultiBlockChangeHandler(handler, dataTypes, protocolVersion));

            packetHandlers.Add(PacketIncomingType.MapChunkBulk, new MapChunkBulkHandler(handler, dataTypes, protocolVersion, pTerrain, worldInfo));
            packetHandlers.Add(PacketIncomingType.UnloadChunk, new UnloadChunkHandler(handler, dataTypes, protocolVersion));
            packetHandlers.Add(PacketIncomingType.PlayerListUpdate, new PlayerListUpdateHandler(handler, dataTypes, protocolVersion));
            packetHandlers.Add(PacketIncomingType.TabCompleteResult, new TabCompleteResultHandler(handler, dataTypes, protocol18Handler, protocolVersion));
            packetHandlers.Add(PacketIncomingType.PluginMessage, new PluginMessageHandler(handler, dataTypes, pForge, worldInfo, protocolVersion));
            packetHandlers.Add(PacketIncomingType.KickPacket, new KickHandler(handler, dataTypes));
            packetHandlers.Add(PacketIncomingType.NetworkCompressionTreshold, new NetworkCompressionThresholdHandler(handler, dataTypes, protocol18Handler, protocolVersion));
            packetHandlers.Add(PacketIncomingType.OpenWindow, new OpenWindowHandler(player, dataTypes));
            packetHandlers.Add(PacketIncomingType.CloseWindow, new CloseWindowHandler(dataTypes, player));
            packetHandlers.Add(PacketIncomingType.WindowItems, new WindowItemsHandler(player, dataTypes));
            packetHandlers.Add(PacketIncomingType.ResourcePackSend, new ResourecePackSendHandler(dataTypes, packetSender, protocolVersion));
        }
コード例 #6
0
 public TabCompleteResultHandler(IMinecraftComHandler handler, DataTypes dataTypes, Protocol18Handler protocol18Handler, int protocolversion)
 {
     this.handler           = handler;
     this.dataTypes         = dataTypes;
     this.protocol18Handler = protocol18Handler;
     this.protocolversion   = protocolversion;
 }
コード例 #7
0
 public NetworkCompressionThresholdHandler(IMinecraftComHandler handler, DataTypes dataTypes, Protocol18Handler Protocol18Handler, int protocolversion)
 {
     this.handler           = handler;
     this.dataTypes         = dataTypes;
     this.Protocol18Handler = Protocol18Handler;
     this.protocolversion   = protocolversion;
 }
コード例 #8
0
 public PlayerPositionAndLookHandler(IPacketReadWriter packetSender, DataTypes dataTypes, IMinecraftComHandler handler, Player player, int protocolversion)
 {
     this.dataTypes       = dataTypes;
     this.packetSender    = packetSender;
     this.handler         = handler;
     this.player          = player;
     this.protocolversion = protocolversion;
 }
コード例 #9
0
 public MapChunkBulkHandler(IMinecraftComHandler handler, DataTypes dataTypes, int protocolversion, Protocol18Terrain pTerrain, WorldInfo worldInfo)
 {
     this.handler         = handler;
     this.dataTypes       = dataTypes;
     this.protocolversion = protocolversion;
     this.pTerrain        = pTerrain;
     this.worldInfo       = worldInfo;
 }
コード例 #10
0
 public Protocol18Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
 {
     ConsoleIO.SetAutoCompleteEngine(this);
     ChatParser.InitTranslations();
     this.c = Client;
     this.protocolversion = ProtocolVersion;
     this.handler = Handler;
 }
コード例 #11
0
 public Protocol17Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
 {
     ConsoleIO.SetAutoCompleteEngine(this);
     ChatParser.InitTranslations();
     this.c = Client;
     this.protocolversion = ProtocolVersion;
     this.handler         = Handler;
 }
コード例 #12
0
 /// <summary>
 /// Initialize a new Forge protocol handler
 /// </summary>
 /// <param name="forgeInfo">Forge Server Information</param>
 /// <param name="protocolVersion">Minecraft protocol version</param>
 /// <param name="dataTypes">Minecraft data types handler</param>
 public Protocol18Forge(ForgeInfo forgeInfo, int protocolVersion, DataTypes dataTypes, Protocol18Handler protocol18, IMinecraftComHandler mcHandler)
 {
     this.forgeInfo       = forgeInfo;
     this.protocolversion = protocolVersion;
     this.dataTypes       = dataTypes;
     this.protocol18      = protocol18;
     this.mcHandler       = mcHandler;
 }
コード例 #13
0
 public ChunkDataHandler(IMinecraftComHandler handler, DataTypes dataTypes, Protocol18Terrain protocol18Terrain, WorldInfo worldInfo, int protocolversion)
 {
     this.handler         = handler;
     this.dataTypes       = dataTypes;
     this.pTerrain        = protocol18Terrain;
     this.worldInfo       = worldInfo;
     this.protocolversion = protocolversion;
 }
コード例 #14
0
 public PluginMessageHandler(IMinecraftComHandler handler, DataTypes dataTypes, Protocol18Forge pForge, WorldInfo worldInfo, int protocolversion)
 {
     this.handler         = handler;
     this.dataTypes       = dataTypes;
     this.pForge          = pForge;
     this.worldInfo       = worldInfo;
     this.protocolversion = protocolversion;
 }
コード例 #15
0
        /// <summary>
        /// Get a protocol handler for the specified Minecraft version
        /// </summary>
        /// <param name="Client">Tcp Client connected to the server</param>
        /// <param name="ProtocolVersion">Protocol version to handle</param>
        /// <param name="Handler">Handler with the appropriate callbacks</param>
        /// <returns></returns>

        public static IMinecraftCom getProtocolHandler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
        {
            int[] supportedVersions_Protocol16 = { 51, 60, 61, 72, 73, 74, 78 };
            if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
                return new Protocol16Handler(Client, ProtocolVersion, Handler);
            int[] supportedVersions_Protocol17 = { 4, 5 };
            if (Array.IndexOf(supportedVersions_Protocol17, ProtocolVersion) > -1)
                return new Protocol17Handler(Client, ProtocolVersion, Handler);
            int[] supportedVersions_Protocol18 = { 47 };
            if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
                return new Protocol18Handler(Client, ProtocolVersion, Handler);
            throw new NotSupportedException("The protocol version no." + ProtocolVersion + " is not supported.");
        }
コード例 #16
0
        public Protocol16Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
        {
            ConsoleIO.SetAutoCompleteEngine(this);
            if (protocolversion >= 72)
            {
                ChatParser.InitTranslations();
            }
            this.c = Client;
            this.protocolversion = ProtocolVersion;
            this.handler         = Handler;


            ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
            //Null obj pattern?
        }
コード例 #17
0
ファイル: Protocol18.cs プロジェクト: gdianaty/MinechatPC
        public Protocol18Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler, ForgeInfo ForgeInfo)
        {
            ConsoleIO.SetAutoCompleteEngine(this);
            ChatParser.InitTranslations();
            this.c = Client;
            this.protocolversion = ProtocolVersion;
            this.handler = Handler;
            this.forgeInfo = ForgeInfo;

            if (Settings.TerrainAndMovements && protocolversion > MC18Version)
            {
                ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
                Settings.TerrainAndMovements = false;
            }
        }
コード例 #18
0
        public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHandler handler, ForgeInfo forgeInfo, Player player)
        {
            this.player = player;

            ConsoleIO.SetAutoCompleteEngine(this);
            ChatParser.InitTranslations();

            connectionInfo       = new ConnectionInfo(new SocketWrapper(Client), 0);
            this.dataTypes       = new DataTypes(protocolVersion);
            this.protocolversion = protocolVersion;
            this.handler         = handler;
            this.pForge          = new Protocol18Forge(forgeInfo, protocolVersion, dataTypes, this, handler);
            this.pTerrain        = new Protocol18Terrain(protocolVersion, dataTypes, handler);

            if (protocolversion > (int)McVersion.V1142)
            {
                ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
                //Modify client pool for terrain?
            }

            if (player.GetInventoryEnabled() && protocolversion > (int)McVersion.V114)
            {
                ConsoleIO.WriteLineFormatted("§8Inventories are currently not handled for that MC version.");
                player.SetInventoryEnabled(false);
            }

            if (protocolversion >= (int)McVersion.V18)
            {
                if (protocolVersion >= (int)McVersion.V114)
                {
                    Block.Palette = new Palette114();
                }
                else
                {
                    Block.Palette = new Palette113();
                }
            }
            else
            {
                Block.Palette = new Palette112();
            }

            packetReadWriter = new Protocol18PacketReadWriter(connectionInfo, dataTypes, protocolVersion);
            packetHandler    = new Protocol18PacketHandler(protocolVersion, dataTypes, handler, packetReadWriter, pTerrain, pForge, worldInfo, this, player);

            pForge.packetReadWriter = packetReadWriter;
        }
コード例 #19
0
        public Protocol16Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
        {
            //ConsoleIO.SetAutoCompleteEngine(this);
            if (protocolversion >= 72)
            {
                ChatParser.InitTranslations();
            }
            this.c = Client;
            this.protocolversion = ProtocolVersion;
            this.handler         = Handler;

            /*if (Settings.TerrainAndMovements)
             * {
             *  //ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
             *  Settings.TerrainAndMovements = false;
             * }*/
        }
コード例 #20
0
ファイル: Protocol16.cs プロジェクト: savioacp/HtBot
        public Protocol16Handler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
        {
            ConsoleIO.SetAutoCompleteEngine(this);
            if (protocolversion >= 72)
            {
                ChatParser.InitTranslations();
            }
            this.c = Client;
            this.protocolversion = ProtocolVersion;
            this.handler         = Handler;

            if (Settings.TerrainAndMovements)
            {
                ConsoleIO.WriteLineFormatted("§2[HtBot]§a Terreno e Movimentos não são suportados nessa versão do Minecraft.");
                Settings.TerrainAndMovements = false;
            }
        }
コード例 #21
0
        public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHandler handler, ForgeInfo forgeInfo)
        {
            ConsoleIO.SetAutoCompleteEngine(this);
            ChatParser.InitTranslations();
            this.socketWrapper   = new SocketWrapper(Client);
            this.dataTypes       = new DataTypes(protocolVersion);
            this.protocolversion = protocolVersion;
            this.handler         = handler;
            this.pForge          = new Protocol18Forge(forgeInfo, protocolVersion, dataTypes, this, handler);
            this.pTerrain        = new Protocol18Terrain(protocolVersion, dataTypes, handler);

            if (handler.GetTerrainEnabled() && protocolversion > MC1142Version)
            {
                ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
                handler.SetTerrainEnabled(false);
            }

            if (handler.GetInventoryEnabled() && protocolversion > MC114Version)
            {
                ConsoleIO.WriteLineFormatted("§8Inventories are currently not handled for that MC version.");
                handler.SetInventoryEnabled(false);
            }

            if (protocolversion >= MC113Version)
            {
                if (protocolVersion > MC1142Version && handler.GetTerrainEnabled())
                {
                    throw new NotImplementedException("Please update block types handling for this Minecraft version. See Material.cs");
                }
                if (protocolVersion >= MC114Version)
                {
                    Block.Palette = new Palette114();
                }
                else
                {
                    Block.Palette = new Palette113();
                }
            }
            else
            {
                Block.Palette = new Palette112();
            }
        }
コード例 #22
0
 public MultiBlockChangeHandler(IMinecraftComHandler handler, DataTypes dataTypes, int protocolversion)
 {
     this.handler         = handler;
     this.dataTypes       = dataTypes;
     this.protocolversion = protocolversion;
 }
コード例 #23
0
 /// <summary>
 /// Get a protocol handler for the specified Minecraft version
 /// </summary>
 /// <param name="Client">Tcp Client connected to the server</param>
 /// <param name="ProtocolVersion">Protocol version to handle</param>
 /// <param name="Handler">Handler with the appropriate callbacks</param>
 /// <returns></returns>
 public static IMinecraftCom GetProtocolHandler(TcpClient Client, int ProtocolVersion, ForgeInfo forgeInfo, IMinecraftComHandler Handler)
 {
     int[] supportedVersions_Protocol16 = { 51, 60, 61, 72, 73, 74, 78 };
     if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
     {
         return(new Protocol16Handler(Client, ProtocolVersion, Handler));
     }
     int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485 };
     if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
     {
         return(new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo));
     }
     throw new NotSupportedException("The protocol version no." + ProtocolVersion + " is not supported.");
 }
コード例 #24
0
 public KickHandler(IMinecraftComHandler handler, DataTypes dataTypes)
 {
     this.handler   = handler;
     this.dataTypes = dataTypes;
 }
コード例 #25
0
 public UnloadChunkHandler(IMinecraftComHandler handler, DataTypes dataTypes, int protocolversion)
 {
     this.handler         = handler;
     this.dataTypes       = dataTypes;
     this.protocolversion = protocolversion;
 }
コード例 #26
0
 public ChatMessageHandler(IMinecraftComHandler handler, DataTypes dataTypes)
 {
     this.handler   = handler;
     this.dataTypes = dataTypes;
 }
コード例 #27
0
 /// <summary>
 /// Get a protocol handler for the specified Minecraft version
 /// </summary>
 /// <param name="Client">Tcp Client connected to the server</param>
 /// <param name="ProtocolVersion">Protocol version to handle</param>
 /// <param name="Handler">Handler with the appropriate callbacks</param>
 /// <returns></returns>
 public static IMinecraftCom GetProtocolHandler(TcpClient Client, int ProtocolVersion, ForgeInfo forgeInfo, IMinecraftComHandler Handler)
 {
     int[] supportedVersions_Protocol16 = { 51, 60, 61, 72, 73, 74, 78 };
     if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
     {
         return(new Protocol16Handler(Client, ProtocolVersion, Handler));
     }
     int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573, 575, 578, 735, 736, 751, 753, 754 };
     if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
     {
         return(new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo));
     }
     throw new NotSupportedException(Translations.Get("exception.version_unsupport", ProtocolVersion));
 }
コード例 #28
0
        /// <summary>
        /// Get a protocol handler for the specified Minecraft version
        /// </summary>
        /// <param name="Client">Tcp Client connected to the server</param>
        /// <param name="ProtocolVersion">Protocol version to handle</param>
        /// <param name="Handler">Handler with the appropriate callbacks</param>
        /// <returns></returns>

        public static IMinecraftCom getProtocolHandler(TcpClient Client, int ProtocolVersion, IMinecraftComHandler Handler)
        {
            int[] supportedVersions_Protocol16 = { 51, 60, 61, 72, 73, 74, 78 };
            if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
            {
                return(new Protocol16Handler(Client, ProtocolVersion, Handler));
            }
            int[] supportedVersions_Protocol17 = { 4, 5 };
            if (Array.IndexOf(supportedVersions_Protocol17, ProtocolVersion) > -1)
            {
                return(new Protocol17Handler(Client, ProtocolVersion, Handler));
            }
            int[] supportedVersions_Protocol18 = { 47 };
            if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
            {
                return(new Protocol18Handler(Client, ProtocolVersion, Handler));
            }
            throw new NotSupportedException("The protocol version no." + ProtocolVersion + " is not supported.");
        }
コード例 #29
0
        public bool Connect(ServerConnectionInfo serverInfo, Player player, int protocolVersion, ForgeInfo forgeInfo, IMinecraftComHandler minecraftComHandler)
        {
            client = ProxyHandler.startNewTcpClient(serverInfo.ServerIP, serverInfo.ServerPort);
            //client.Connect(serverInfo.ServerIP, serverInfo.ServerPort);
            client.ReceiveBufferSize = 1024 * 1024;

            communicationHandler = ProtocolHandler.GetProtocolHandler(client, protocolVersion, forgeInfo, minecraftComHandler, player);

            return(login());
            //send login packets
        }
コード例 #30
0
 /// <summary>
 /// Initialize a new Terrain Decoder
 /// </summary>
 /// <param name="protocolVersion">Minecraft Protocol Version</param>
 /// <param name="dataTypes">Minecraft Protocol Data Types</param>
 public Protocol18Terrain(int protocolVersion, DataTypes dataTypes, IMinecraftComHandler handler)
 {
     this.protocolversion = protocolVersion;
     this.dataTypes       = dataTypes;
     this.handler         = handler;
 }
コード例 #31
0
 public PlayerListUpdateHandler(IMinecraftComHandler handler, DataTypes dataTypes, int protocolversion)
 {
     this.handler         = handler;
     this.dataTypes       = dataTypes;
     this.protocolversion = protocolversion;
 }
コード例 #32
0
 public BlockChangeHandler17(IMinecraftComHandler handler, DataTypes dataTypes)
 {
     this.handler   = handler;
     this.dataTypes = dataTypes;
 }