diff --git a/MinecraftClient/ChatBot.cs b/MinecraftClient/ChatBot.cs
index b46315c3..8a1d0ee6 100644
--- a/MinecraftClient/ChatBot.cs
+++ b/MinecraftClient/ChatBot.cs
@@ -25,7 +25,6 @@ namespace MinecraftClient
///
/// The virtual class containing anything you need for creating chat bots.
///
-
public abstract class ChatBot
{
public enum DisconnectReason { InGameKick, LoginRejected, ConnectionLost };
@@ -75,7 +74,6 @@ namespace MinecraftClient
/// NOTE: Chat messages cannot be sent at this point in the login process. If you want to send
/// a message when the bot is loaded, use AfterGameJoined.
///
-
public virtual void Initialize() { }
///
@@ -84,20 +82,17 @@ namespace MinecraftClient
/// NOTE: This is not always right after joining the server - if the bot was loaded after logging
/// in this is still called.
///
-
public virtual void AfterGameJoined() { }
///
/// Will be called every ~100ms (10fps) if loaded in MinecraftCom
///
-
public virtual void Update() { }
///
/// Any text sent by the server will be sent here by MinecraftCom
///
/// Text from the server
-
public virtual void GetText(string text) { }
///
@@ -106,7 +101,6 @@ namespace MinecraftClient
/// Disconnect Reason
/// Kick message, if any
/// Return TRUE if the client is about to restart
-
public virtual bool OnDisconnect(DisconnectReason reason, string message) { return false; }
///
@@ -117,7 +111,6 @@ namespace MinecraftClient
///
/// The name of the channel
/// The payload for the message
-
public virtual void OnPluginMessage(string channel, byte[] data) { }
/* =================================================================== */
@@ -132,7 +125,6 @@ namespace MinecraftClient
/// Text to send to the server
/// Whether the message should be sent immediately rather than being queued to avoid chat spam
/// True if the text was sent with no error
-
protected bool SendText(string text, bool sendImmediately = false)
{
if (Settings.botMessageDelay.TotalSeconds > 0 && !sendImmediately)
@@ -156,7 +148,6 @@ namespace MinecraftClient
///
/// The command to process
/// TRUE if the command was indeed an internal MCC command
-
protected bool PerformInternalCommand(string command)
{
string temp = "";
@@ -169,7 +160,6 @@ namespace MinecraftClient
/// The command to process
/// May contain a confirmation or error message after processing the command, or "" otherwise.
/// TRUE if the command was indeed an internal MCC command
-
protected bool PerformInternalCommand(string command, ref string response_msg)
{
return Handler.PerformInternalCommand(command, ref response_msg);
@@ -178,7 +168,6 @@ namespace MinecraftClient
///
/// Remove color codes ("§c") from a text message received from the server
///
-
protected static string GetVerbatim(string text)
{
if ( String.IsNullOrEmpty(text) )
@@ -199,7 +188,6 @@ namespace MinecraftClient
///
/// Verify that a string contains only a-z A-Z 0-9 and _ characters.
///
-
public static bool IsValidName(string username)
{
if (String.IsNullOrEmpty(username))
@@ -222,7 +210,6 @@ namespace MinecraftClient
/// if it's a private message, this will contain the message
/// if it's a private message, this will contain the player name that sends the message
/// Returns true if the text is a private message
-
protected static bool IsPrivateMessage(string text, ref string message, ref string sender)
{
if (String.IsNullOrEmpty(text))
@@ -334,7 +321,6 @@ namespace MinecraftClient
/// if it's message, this will contain the message
/// if it's message, this will contain the player name that sends the message
/// Returns true if the text is a chat message
-
protected static bool IsChatMessage(string text, ref string message, ref string sender)
{
if (String.IsNullOrEmpty(text))
@@ -438,7 +424,6 @@ namespace MinecraftClient
/// Text to parse
/// Will contain the sender's username, if it's a teleport request
/// Returns true if the text is a teleport request
-
protected static bool IsTeleportRequest(string text, ref string sender)
{
if (String.IsNullOrEmpty(text))
@@ -493,7 +478,6 @@ namespace MinecraftClient
/// Write some text in the console. Nothing will be sent to the server.
///
/// Log text to write
-
protected void LogToConsole(object text)
{
ConsoleIO.WriteLogLine(String.Format("[{0}] {1}", this.GetType().Name, text));
@@ -518,7 +502,6 @@ namespace MinecraftClient
/// It will unload and reload all the bots and then reconnect to the server
///
/// If connection fails, the client will make X extra attempts
-
protected void ReconnectToTheServer(int ExtraAttempts = 3)
{
McTcpClient.ReconnectionAttemptsLeft = ExtraAttempts;
@@ -528,7 +511,6 @@ namespace MinecraftClient
///
/// Disconnect from the server and exit the program
///
-
protected void DisconnectAndExit()
{
Program.Exit();
@@ -537,7 +519,6 @@ namespace MinecraftClient
///
/// Unload the chatbot, and release associated memory.
///
-
protected void UnloadBot()
{
Handler.BotUnLoad(this);
@@ -548,7 +529,6 @@ namespace MinecraftClient
///
/// Player name
/// Message
-
protected void SendPrivateMessage(string player, string message)
{
SendText(String.Format("/{0} {1} {2}", Settings.PrivateMsgsCmdName, player, message));
@@ -559,7 +539,6 @@ namespace MinecraftClient
///
/// File name
/// Player name to send error messages, if applicable
-
protected void RunScript(string filename, string playername = "")
{
Handler.BotLoad(new ChatBots.Script(filename, playername));
@@ -569,7 +548,6 @@ namespace MinecraftClient
/// Get the current Minecraft World
///
/// Minecraft world or null if associated setting is disabled
-
protected Mapping.World GetWorld()
{
if (Settings.TerrainAndMovements)
@@ -581,7 +559,6 @@ namespace MinecraftClient
/// Get the current location of the player
///
/// Minecraft world or null if associated setting is disabled
-
protected Mapping.Location GetCurrentLocation()
{
return Handler.GetCurrentLocation();
@@ -593,7 +570,6 @@ namespace MinecraftClient
/// Location to reach
/// Allow possible but unsafe locations
/// True if a path has been found
-
protected bool MoveToLocation(Mapping.Location location, bool allowUnsafe = false)
{
return Handler.MoveTo(location, allowUnsafe);
@@ -602,7 +578,6 @@ namespace MinecraftClient
///
/// Get a Y-M-D h:m:s timestamp representing the current system date and time
///
-
protected static string GetTimestamp()
{
DateTime time = DateTime.Now;
@@ -620,7 +595,6 @@ namespace MinecraftClient
///
/// File to load
/// The string array or an empty array if failed to load the file
-
protected string[] LoadDistinctEntriesFromFile(string file)
{
if (File.Exists(file))
@@ -639,11 +613,19 @@ namespace MinecraftClient
}
}
+ ///
+ /// Return the list of currently online players
+ ///
+ /// List of online players
+ protected string[] GetOnlinePlayers()
+ {
+ return Handler.GetOnlinePlayers();
+ }
+
///
/// Registers the given plugin channel for use by this chatbot.
///
/// The name of the channel to register
-
protected void RegisterPluginChannel(string channel)
{
this.registeredPluginChannels.Add(channel);
@@ -654,7 +636,6 @@ namespace MinecraftClient
/// Unregisters the given plugin channel, meaning this chatbot can no longer use it.
///
/// The name of the channel to unregister
-
protected void UnregisterPluginChannel(string channel)
{
this.registeredPluginChannels.RemoveAll(chan => chan == channel);
@@ -669,7 +650,6 @@ namespace MinecraftClient
/// The data to send.
/// Should the message be sent even if it hasn't been registered by the server or this bot? (Some Minecraft channels aren't registered)
/// Whether the message was successfully sent. False if there was a network error or if the channel wasn't registered.
-
protected bool SendPluginChannelMessage(string channel, byte[] data, bool sendEvenIfNotRegistered = false)
{
if (!sendEvenIfNotRegistered)