mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix for respawning + /respawn command
- Player is automatically respawned when logging in - Added /respawn command (MC 1.7 does not fail to respawn) - Cleaned MCC command handling code, /exec is now /script
This commit is contained in:
parent
adba89794e
commit
afff1ef89e
2 changed files with 25 additions and 19 deletions
|
|
@ -143,6 +143,9 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//Needed if the player is dead
|
||||||
|
handler.SendRespawnPacket();
|
||||||
|
|
||||||
while (client.Client.Connected)
|
while (client.Client.Connected)
|
||||||
{
|
{
|
||||||
text = ConsoleIO.ReadLine();
|
text = ConsoleIO.ReadLine();
|
||||||
|
|
@ -160,9 +163,21 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (text.ToLower() == "/quit" || text.ToLower().StartsWith("/exec ") || text.ToLower() == "/reco" || text.ToLower() == "/reconnect") { break; }
|
text = text.Trim();
|
||||||
while (text.Length > 0 && text[0] == ' ') { text = text.Substring(1); }
|
if (text.ToLower() == "/quit" || text.ToLower() == "/reco")
|
||||||
if (text != "")
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (text.ToLower() == "/respawn")
|
||||||
|
{
|
||||||
|
handler.SendRespawnPacket();
|
||||||
|
ConsoleIO.WriteLine("You have respawned.");
|
||||||
|
}
|
||||||
|
else if (text.ToLower().StartsWith("/script "))
|
||||||
|
{
|
||||||
|
handler.BotLoad(new Bots.Scripting(text.Substring(8)));
|
||||||
|
}
|
||||||
|
else if (text != "")
|
||||||
{
|
{
|
||||||
//Message is too long
|
//Message is too long
|
||||||
if (text.Length > 100)
|
if (text.Length > 100)
|
||||||
|
|
@ -175,7 +190,7 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Send the message splitted in sereval messages
|
//Send the message splitted in several messages
|
||||||
while (text.Length > 100)
|
while (text.Length > 100)
|
||||||
{
|
{
|
||||||
handler.SendChatMessage(text.Substring(0, 100));
|
handler.SendChatMessage(text.Substring(0, 100));
|
||||||
|
|
@ -189,22 +204,10 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.ToLower() == "/quit")
|
switch (text.ToLower())
|
||||||
{
|
{
|
||||||
ConsoleIO.WriteLine("You have left the server.");
|
case "/quit": Program.Exit(); break;
|
||||||
Disconnect();
|
case "/reco": Program.Restart(); break;
|
||||||
}
|
|
||||||
|
|
||||||
else if (text.ToLower().StartsWith("/exec ")) {
|
|
||||||
handler.BotLoad(new Bots.Scripting("config/" + text.Split()[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
else if (text.ToLower() == "/reco" || text.ToLower() == "/reconnect")
|
|
||||||
{
|
|
||||||
ConsoleIO.WriteLine("You have left the server.");
|
|
||||||
handler.SendRespawnPacket();
|
|
||||||
Program.Restart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException) { }
|
catch (IOException) { }
|
||||||
|
|
|
||||||
|
|
@ -549,6 +549,9 @@ namespace MinecraftClient
|
||||||
if (message == null)
|
if (message == null)
|
||||||
message = "";
|
message = "";
|
||||||
|
|
||||||
|
message.Replace("\"", "\\\"");
|
||||||
|
message = "\"" + message + "\"";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] packet_id = getVarInt(0x40);
|
byte[] packet_id = getVarInt(0x40);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue