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;
 }
 /// <summary>
 /// Server Info: Consider Forge to be enabled regardless of server Ping
 /// </summary>
 /// <param name="protocolVersion">Minecraft protocol version</param>
 /// <returns>ForgeInfo item stating that Forge is enabled</returns>
 public static ForgeInfo ProtocolForceForge(int protocol)
 {
     return(Protocol18Forge.ServerForceForge(protocol));
 }
 /// <summary>
 /// Check if we can force-enable Forge support for a Minecraft version without using server Ping
 /// </summary>
 /// <param name="protocolVersion">Minecraft protocol version</param>
 /// <returns>TRUE if we can force-enable Forge support without using server Ping</returns>
 public static bool ProtocolMayForceForge(int protocol)
 {
     return(Protocol18Forge.ServerMayForceForge(protocol));
 }
Esempio n. 4
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));
        }