Fix /buy commands erroring when your username is Bot. (Thanks Bot)

This commit is contained in:
UnknownShadow200 2018-02-12 08:20:44 +11:00
parent 192c17274c
commit 447ca35241
4 changed files with 14 additions and 19 deletions

View File

@ -37,11 +37,11 @@ namespace MCGalaxy.Commands.Chatting {
if (loginMsg.Length == 0) { if (loginMsg.Length == 0) {
string path = PlayerDB.LoginPath(who.name); string path = PlayerDB.LoginPath(who.name);
if (File.Exists(path)) File.Delete(path); if (File.Exists(path)) File.Delete(path);
Player.Message(p, "The login message of {0} %Shas been removed.", Player.Message(p, "Login message of {0} %Swas removed.",
who.ColoredName); who.ColoredName);
} else { } else {
PlayerDB.SetLoginMessage(who.name, loginMsg); PlayerDB.SetLoginMessage(who.name, loginMsg);
Player.Message(p, "The login message of {0} %Shas been changed to: {1}", Player.Message(p, "Login message of {0} %Swas changed to: {1}",
who.ColoredName, loginMsg); who.ColoredName, loginMsg);
} }
} }

View File

@ -37,11 +37,11 @@ namespace MCGalaxy.Commands.Chatting {
if (logoutMsg.Length == 0) { if (logoutMsg.Length == 0) {
string path = PlayerDB.LogoutPath(who.name); string path = PlayerDB.LogoutPath(who.name);
if (File.Exists(path)) File.Delete(path); if (File.Exists(path)) File.Delete(path);
Player.Message(p, "The logout message of {0} %Shas been removed.", Player.Message(p, "Logout message of {0} %Swas removed.",
who.ColoredName); who.ColoredName);
} else { } else {
PlayerDB.SetLogoutMessage(who.name, logoutMsg); PlayerDB.SetLogoutMessage(who.name, logoutMsg);
Player.Message(p, "The logout message of {0} %Shas been changed to: {1}", Player.Message(p, "Logout message of {0} %Swas changed to: {1}",
who.ColoredName, logoutMsg); who.ColoredName, logoutMsg);
} }
} }

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Eco {
protected override void DoPurchase(Player p, string message, string[] args) { protected override void DoPurchase(Player p, string message, string[] args) {
if (args.Length == 1) { if (args.Length == 1) {
Command.all.FindByName("LoginMessage").Use(null, p.name); Command.all.FindByName("LoginMessage").Use(p, "-own");
Player.Message(p, "%aYour login message was removed for free."); Player.Message(p, "%aYour login message was removed for free.");
return; return;
} }
@ -43,8 +43,7 @@ namespace MCGalaxy.Eco {
if (text.Length > NetUtils.StringSize) { if (text.Length > NetUtils.StringSize) {
Player.Message(p, "%cLogin message must be 64 characters or less."); return; Player.Message(p, "%cLogin message must be 64 characters or less."); return;
} }
Command.all.FindByName("LoginMessage").Use(null, p.name + " " + text); Command.all.FindByName("LoginMessage").Use(p, "-own " + text);
Player.Message(p, "%aYour login message was changed to: %f" + text);
Economy.MakePurchase(p, Price, "%3LoginMessage: %f" + text); Economy.MakePurchase(p, Price, "%3LoginMessage: %f" + text);
} }
} }
@ -60,7 +59,7 @@ namespace MCGalaxy.Eco {
protected override void DoPurchase(Player p, string message, string[] args) { protected override void DoPurchase(Player p, string message, string[] args) {
if (args.Length == 1) { if (args.Length == 1) {
Command.all.FindByName("LogoutMessage").Use(null, p.name); Command.all.FindByName("LogoutMessage").Use(p, "-own");
Player.Message(p, "%aYour logout message was removed for free."); Player.Message(p, "%aYour logout message was removed for free.");
return; return;
} }
@ -72,8 +71,7 @@ namespace MCGalaxy.Eco {
if (text.Length > NetUtils.StringSize) { if (text.Length > NetUtils.StringSize) {
Player.Message(p, "%cLogin message must be 64 characters or less."); return; Player.Message(p, "%cLogin message must be 64 characters or less."); return;
} }
Command.all.FindByName("LogoutMessage").Use(null, p.name + " " + text); Command.all.FindByName("LogoutMessage").Use(p, "-own " + text);
Player.Message(p, "%aYour logout message was changed to: %f" + text);
Economy.MakePurchase(p, Price, "%3LogoutMessage: %f" + text); Economy.MakePurchase(p, Price, "%3LogoutMessage: %f" + text);
} }
} }

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Eco {
protected override void DoPurchase(Player p, string message, string[] args) { protected override void DoPurchase(Player p, string message, string[] args) {
if (args.Length == 1) { if (args.Length == 1) {
Command.all.FindByName("Title").Use(null, p.name); Command.all.FindByName("Title").Use(p, "-own");
Player.Message(p, "%aYour title was removed for free."); return; Player.Message(p, "%aYour title was removed for free."); return;
} }
@ -42,8 +42,7 @@ namespace MCGalaxy.Eco {
Player.Message(p, "%cTitles must be under 20 characters."); return; Player.Message(p, "%cTitles must be under 20 characters."); return;
} }
Command.all.FindByName("Title").Use(null, p.name + " " + title); Command.all.FindByName("Title").Use(p, "-own " + title);
Player.Message(p, "%aYour title was changed to [" + p.titlecolor + title + "%a]");
Economy.MakePurchase(p, Price, "%3Title: %f" + title); Economy.MakePurchase(p, Price, "%3Title: %f" + title);
} }
} }
@ -59,7 +58,7 @@ namespace MCGalaxy.Eco {
protected override void DoPurchase(Player p, string message, string[] args) { protected override void DoPurchase(Player p, string message, string[] args) {
if (args.Length == 1) { if (args.Length == 1) {
Command.all.FindByName("Nick").Use(null, p.name); Command.all.FindByName("Nick").Use(p, "-own");
Player.Message(p, "%aYour nickname was removed for free."); return; Player.Message(p, "%aYour nickname was removed for free."); return;
} }
@ -71,8 +70,7 @@ namespace MCGalaxy.Eco {
Player.Message(p, "%cNicknames must be under 30 characters."); return; Player.Message(p, "%cNicknames must be under 30 characters."); return;
} }
Command.all.FindByName("Nick").Use(null, p.name + " " + nick); Command.all.FindByName("Nick").Use(p, "-own " + nick);
Player.Message(p, "%aYour nickname was changed to [" + p.color + nick + "%a]");
Economy.MakePurchase(p, Price, "%3Nickname: %f" + nick); Economy.MakePurchase(p, Price, "%3Nickname: %f" + nick);
} }
} }
@ -94,8 +92,7 @@ namespace MCGalaxy.Eco {
Player.Message(p, "%cYou already have a " + color + colName + "%c titlecolor"); return; Player.Message(p, "%cYou already have a " + color + colName + "%c titlecolor"); return;
} }
Command.all.FindByName("TColor").Use(null, p.name + " " + colName); Command.all.FindByName("TColor").Use(p, "-own " + colName);
Player.Message(p, "%aYour titlecolor was changed to " + color + colName);
Economy.MakePurchase(p, Price, "%3Titlecolor: " + color + colName); Economy.MakePurchase(p, Price, "%3Titlecolor: " + color + colName);
} }
} }
@ -117,7 +114,7 @@ namespace MCGalaxy.Eco {
Player.Message(p, "%cYou already have a " + color + colName + "%c color"); return; Player.Message(p, "%cYou already have a " + color + colName + "%c color"); return;
} }
Command.all.FindByName("Color").Use(null, p.name + " " + colName); Command.all.FindByName("Color").Use(p, "-own " + colName);
Economy.MakePurchase(p, Price, "%3Color: " + color + colName); Economy.MakePurchase(p, Price, "%3Color: " + color + colName);
} }
} }