mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Remote Control : Auto accept tpa and tpahere
- Added Essentials teleportation request in bot api - Used the api in remote control to auto accept
This commit is contained in:
parent
9456e82923
commit
f0b071ddea
2 changed files with 27 additions and 2 deletions
|
|
@ -146,7 +146,7 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true is the text passed is a private message sent to the bot
|
/// Returns true if the text passed is a private message sent to the bot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">text to test</param>
|
/// <param name="text">text to test</param>
|
||||||
/// <param name="message">if it's a private message, this will contain the message</param>
|
/// <param name="message">if it's a private message, this will contain the message</param>
|
||||||
|
|
@ -155,6 +155,7 @@ namespace MinecraftClient
|
||||||
|
|
||||||
protected static bool isPrivateMessage(string text, ref string message, ref string sender)
|
protected static bool isPrivateMessage(string text, ref string message, ref string sender)
|
||||||
{
|
{
|
||||||
|
text = getVerbatim(text);
|
||||||
if (text == "") { return false; }
|
if (text == "") { return false; }
|
||||||
string[] tmp = text.Split(' ');
|
string[] tmp = text.Split(' ');
|
||||||
|
|
||||||
|
|
@ -190,7 +191,7 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true is the text passed is a public message written by a player on the chat
|
/// Returns true if the text passed is a public message written by a player on the chat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">text to test</param>
|
/// <param name="text">text to test</param>
|
||||||
/// <param name="message">if it's message, this will contain the message</param>
|
/// <param name="message">if it's message, this will contain the message</param>
|
||||||
|
|
@ -204,6 +205,7 @@ namespace MinecraftClient
|
||||||
//<*Faction Someone> message
|
//<*Faction Someone> message
|
||||||
//<*Faction Someone>: message
|
//<*Faction Someone>: message
|
||||||
//<*Faction ~Nicknamed>: message
|
//<*Faction ~Nicknamed>: message
|
||||||
|
text = getVerbatim(text);
|
||||||
if (text == "") { return false; }
|
if (text == "") { return false; }
|
||||||
if (text[0] == '<')
|
if (text[0] == '<')
|
||||||
{
|
{
|
||||||
|
|
@ -225,6 +227,25 @@ namespace MinecraftClient
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the text passed is a teleport request (Essentials)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">Text to parse</param>
|
||||||
|
/// <param name="sender">Will contain the sender's username, if it's a teleport request</param>
|
||||||
|
/// <returns>Returns true if the text is a teleport request</returns>
|
||||||
|
|
||||||
|
protected static bool isTeleportRequest(string text, ref string sender)
|
||||||
|
{
|
||||||
|
text = getVerbatim(text);
|
||||||
|
sender = text.Split(' ')[0];
|
||||||
|
if (text.EndsWith("has requested to teleport to you.")
|
||||||
|
|| text.EndsWith("has requested that you teleport to them."))
|
||||||
|
{
|
||||||
|
return isValidName(sender);
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes some text in the console. Nothing will be sent to the server.
|
/// Writes some text in the console. Nothing will be sent to the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,10 @@ namespace MinecraftClient.ChatBots
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (isTeleportRequest(text, ref sender) && Settings.Bots_Owners.Contains(sender.ToLower()))
|
||||||
|
{
|
||||||
|
SendText("/tpaccept");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue