2014-05-31 01:59:03 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using MinecraftClient.Crypto;
|
2015-11-27 17:16:33 +01:00
|
|
|
|
using MinecraftClient.Mapping;
|
2014-05-31 01:59:03 +02:00
|
|
|
|
|
|
|
|
|
|
namespace MinecraftClient.Protocol
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Interface for the Minecraft protocol handler.
|
|
|
|
|
|
/// A protocol handler is used to communicate with the Minecraft server.
|
|
|
|
|
|
/// This interface allows to abstract from the underlying minecraft version in other parts of the program.
|
|
|
|
|
|
/// The protocol handler will take care of parsing and building the appropriate network packets.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
2015-06-19 19:40:18 +02:00
|
|
|
|
public interface IMinecraftCom : IDisposable, IAutoComplete
|
2014-05-31 01:59:03 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Start the login procedure once connected to the server
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>True if login was successful</returns>
|
|
|
|
|
|
bool Login();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Disconnect from the server
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
void Disconnect();
|
|
|
|
|
|
|
2016-11-19 16:06:08 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Get max length for chat messages
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>Max length, in characters</returns>
|
|
|
|
|
|
int GetMaxChatMessageLength();
|
|
|
|
|
|
|
2014-05-31 01:59:03 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Send a chat message or command to the server
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="message">Text to send</param>
|
|
|
|
|
|
/// <returns>True if successfully sent</returns>
|
|
|
|
|
|
bool SendChatMessage(string message);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Allow to respawn after death
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>True if packet successfully sent</returns>
|
|
|
|
|
|
bool SendRespawnPacket();
|
2015-09-29 14:00:44 +02:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2015-11-27 17:16:33 +01:00
|
|
|
|
/// Inform the server of the client being used to connect
|
2015-09-29 14:00:44 +02:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="brandInfo">Client string describing the client</param>
|
|
|
|
|
|
/// <returns>True if brand info was successfully sent</returns>
|
|
|
|
|
|
bool SendBrandInfo(string brandInfo);
|
2015-10-24 22:26:45 -07:00
|
|
|
|
|
2016-08-26 12:19:25 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Inform the server of the client's Minecraft settings
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="language">Client language eg en_US</param>
|
|
|
|
|
|
/// <param name="viewDistance">View distance, in chunks</param>
|
|
|
|
|
|
/// <param name="difficulty">Game difficulty (client-side...)</param>
|
|
|
|
|
|
/// <param name="chatMode">Chat mode (allows muting yourself)</param>
|
|
|
|
|
|
/// <param name="chatColors">Show chat colors</param>
|
|
|
|
|
|
/// <param name="skinParts">Show skin layers</param>
|
|
|
|
|
|
/// <param name="mainHand">1.9+ main hand</param>
|
|
|
|
|
|
/// <returns>True if client settings were successfully sent</returns>
|
|
|
|
|
|
bool SendClientSettings(string language, byte viewDistance, byte difficulty, byte chatMode, bool chatColors, byte skinParts, byte mainHand);
|
|
|
|
|
|
|
2015-11-27 17:16:33 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Send a location update telling that we moved to that location
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="location">The new location</param>
|
2017-03-10 23:40:02 +01:00
|
|
|
|
/// <param name="onGround">True if the player is on the ground</param>
|
2019-04-09 18:01:00 -07:00
|
|
|
|
/// <param name="yaw">The new yaw (optional)</param>
|
|
|
|
|
|
/// <param name="pitch">The new pitch (optional)</param>
|
2015-11-27 17:16:33 +01:00
|
|
|
|
/// <returns>True if packet was successfully sent</returns>
|
2019-04-09 18:01:00 -07:00
|
|
|
|
bool SendLocationUpdate(Location location, bool onGround, float? yaw, float? pitch);
|
2015-11-27 17:16:33 +01:00
|
|
|
|
|
2015-10-24 22:26:45 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Send a plugin channel packet to the server.
|
|
|
|
|
|
/// </summary>
|
2015-11-27 17:16:33 +01:00
|
|
|
|
/// <see href="http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/" />
|
2015-10-24 22:26:45 -07:00
|
|
|
|
/// <param name="channel">Channel to send packet on</param>
|
|
|
|
|
|
/// <param name="data">packet Data</param>
|
|
|
|
|
|
/// <returns>True if message was successfully sent</returns>
|
|
|
|
|
|
bool SendPluginChannelPacket(string channel, byte[] data);
|
2020-03-21 18:41:48 +08:00
|
|
|
|
|
|
|
|
|
|
// by reinforce
|
|
|
|
|
|
bool SendInteractEntityPacket(int EntityID, int type);
|
|
|
|
|
|
bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z, int hand);
|
|
|
|
|
|
bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z);
|
2014-05-31 01:59:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|