mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Update Bots.cs
This commit is contained in:
parent
72c447e1b9
commit
4c4319a260
1 changed files with 23 additions and 35 deletions
|
|
@ -77,16 +77,19 @@ namespace MinecraftClient
|
||||||
|
|
||||||
protected static string getVerbatim(string text)
|
protected static string getVerbatim(string text)
|
||||||
{
|
{
|
||||||
string verbatim = "";
|
if ( String.IsNullOrEmpty(text) )
|
||||||
for (int i = 0; i < text.Length; i++)
|
return String.Empty;
|
||||||
{
|
|
||||||
if (text[i] == '§')
|
int idx = 0;
|
||||||
{
|
var data = new char[text.Length];
|
||||||
i++; //Will skip also the next char
|
|
||||||
}
|
for ( int i = 0; i < text.Length; i++ )
|
||||||
else verbatim += text[i]; //Add the char
|
if ( text[i] != '§' )
|
||||||
}
|
data[idx++] = text[i];
|
||||||
return verbatim;
|
else
|
||||||
|
i++;
|
||||||
|
|
||||||
|
return new string(data, 0, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -95,32 +98,17 @@ namespace MinecraftClient
|
||||||
|
|
||||||
protected static bool isValidName(string username)
|
protected static bool isValidName(string username)
|
||||||
{
|
{
|
||||||
if (username == "") { return false; }
|
if ( String.IsNullOrEmpty(username) )
|
||||||
string validchars =
|
return false;
|
||||||
"abcdefghijklmnopqrstuvwxyz"
|
|
||||||
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
||||||
+ "1234567890_";
|
|
||||||
|
|
||||||
bool passe = false;
|
foreach ( char c in username )
|
||||||
bool ok = true;
|
if ( !((c >= 'a' && c <= 'z')
|
||||||
for (int i = 0; i < username.Length; i++)
|
|| (c >= 'A' && c <= 'Z')
|
||||||
{
|
|| (c >= '0' && c <= '9')
|
||||||
passe = false;
|
|| c == '_') )
|
||||||
for (int j = 0; j < validchars.Length; j++)
|
return false;
|
||||||
{
|
|
||||||
if (username[i] == validchars[j])
|
return true;
|
||||||
{
|
|
||||||
passe = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!passe)
|
|
||||||
{
|
|
||||||
ok = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue