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)
|
||||
{
|
||||
string verbatim = "";
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
if (text[i] == '§')
|
||||
{
|
||||
i++; //Will skip also the next char
|
||||
}
|
||||
else verbatim += text[i]; //Add the char
|
||||
}
|
||||
return verbatim;
|
||||
if ( String.IsNullOrEmpty(text) )
|
||||
return String.Empty;
|
||||
|
||||
int idx = 0;
|
||||
var data = new char[text.Length];
|
||||
|
||||
for ( int i = 0; i < text.Length; i++ )
|
||||
if ( text[i] != '§' )
|
||||
data[idx++] = text[i];
|
||||
else
|
||||
i++;
|
||||
|
||||
return new string(data, 0, idx);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -95,32 +98,17 @@ namespace MinecraftClient
|
|||
|
||||
protected static bool isValidName(string username)
|
||||
{
|
||||
if (username == "") { return false; }
|
||||
string validchars =
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
+ "1234567890_";
|
||||
if ( String.IsNullOrEmpty(username) )
|
||||
return false;
|
||||
|
||||
bool passe = false;
|
||||
bool ok = true;
|
||||
for (int i = 0; i < username.Length; i++)
|
||||
{
|
||||
passe = false;
|
||||
for (int j = 0; j < validchars.Length; j++)
|
||||
{
|
||||
if (username[i] == validchars[j])
|
||||
{
|
||||
passe = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!passe)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
foreach ( char c in username )
|
||||
if ( !((c >= 'a' && c <= 'z')
|
||||
|| (c >= 'A' && c <= 'Z')
|
||||
|| (c >= '0' && c <= '9')
|
||||
|| c == '_') )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue