even better playername regex
This commit is contained in:
@@ -9,7 +9,9 @@ public partial class player_variables : Node
|
||||
{
|
||||
get
|
||||
{
|
||||
_playername = Regex.Replace(_playername, "[^a-zA-Z0-9 ]+", "").StripEdges();
|
||||
_playername = Regex.Replace(_playername, @"[\[\]<>\\\*\$\@\|\~\+§%/#\^°':;!?=\-`´卐卍࿕࿖࿗࿘ꖦ⃠\uD83C-\uDBFF\uDC00-\uDFFF]", "").Trim('"').StripEdges(); //todo swearword censoring with bbcode effect
|
||||
if (_playername.Length > 12)
|
||||
_playername = _playername.Substring(0, 12);
|
||||
return Regex.Replace(_playername, @"\s+", " ");
|
||||
}
|
||||
set { _playername = value; }
|
||||
|
@@ -129,7 +129,14 @@ public partial class console : PopupPanel
|
||||
}
|
||||
void playername(string name)
|
||||
{
|
||||
string tmpPlayerName = player_variables.PlayerName;
|
||||
player_variables.PlayerName = name;
|
||||
if (player_variables.PlayerName == "")
|
||||
{
|
||||
player_variables.PlayerName = tmpPlayerName;
|
||||
Print("The name had too much incorrect symbols and would be empty when changed.");
|
||||
}
|
||||
else
|
||||
Print("Your new name is now: " + player_variables.PlayerName);
|
||||
}
|
||||
void closedialogue()
|
||||
|
Reference in New Issue
Block a user