Cleaned up stuff by chaning one tiny thing
This commit is contained in:
parent
6d93d474ee
commit
a7df7abda9
2 changed files with 32 additions and 15 deletions
|
|
@ -472,6 +472,20 @@ namespace Terraria
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsAdmin(int ply)
|
||||||
|
{
|
||||||
|
string remoteEndPoint = Convert.ToString((Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint));
|
||||||
|
string[] remoteEndPointIP = remoteEndPoint.Split(':');
|
||||||
|
TextReader tr = new StreamReader(saveDir + "admins.txt");
|
||||||
|
string adminlist = tr.ReadToEnd();
|
||||||
|
tr.Close();
|
||||||
|
if (adminlist.Contains(remoteEndPointIP[0]))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetRealIP(string mess)
|
public static string GetRealIP(string mess)
|
||||||
{
|
{
|
||||||
return mess.Split(':')[0];
|
return mess.Split(':')[0];
|
||||||
|
|
|
||||||
|
|
@ -956,7 +956,7 @@
|
||||||
//TODO: Clean this shit up
|
//TODO: Clean this shit up
|
||||||
if (str9 == "/hardcore")
|
if (str9 == "/hardcore")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -972,9 +972,9 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/off")
|
if (str9 == "/off")
|
||||||
{
|
{
|
||||||
if (!ShankShock.isAdmin(ShankShock.findPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.sendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Netplay.disconnect = true;
|
Netplay.disconnect = true;
|
||||||
|
|
@ -982,7 +982,7 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/skeletron")
|
if (str9 == "/skeletron")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -993,7 +993,7 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/reload")
|
if (str9 == "/reload")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1004,7 +1004,7 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/bloodmoon")
|
if (str9 == "/bloodmoon")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1020,7 +1020,7 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/dropmeteor")
|
if (str9 == "/dropmeteor")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1031,7 +1031,7 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/star")
|
if (str9 == "/star")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1042,7 +1042,7 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/eye")
|
if (str9 == "/eye")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1053,7 +1053,7 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/invade")
|
if (str9 == "/invade")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1067,8 +1067,11 @@
|
||||||
ShankShock.SendMessage(this.whoAmI, "/who - Who's online?");
|
ShankShock.SendMessage(this.whoAmI, "/who - Who's online?");
|
||||||
ShankShock.SendMessage(this.whoAmI, "/me - Talk in 3rd person");
|
ShankShock.SendMessage(this.whoAmI, "/me - Talk in 3rd person");
|
||||||
ShankShock.SendMessage(this.whoAmI, "/p - Talk in party chat");
|
ShankShock.SendMessage(this.whoAmI, "/p - Talk in party chat");
|
||||||
ShankShock.SendMessage(this.whoAmI, "/kick | /ban | /eater | /hardcore");
|
if (ShankShock.IsAdmin(this.whoAmI))
|
||||||
ShankShock.SendMessage(this.whoAmI, "/invade | /dropmeteor | /bloodmoon | /eye");
|
{
|
||||||
|
ShankShock.SendMessage(this.whoAmI, "/kick | /ban | /eater | /hardcore");
|
||||||
|
ShankShock.SendMessage(this.whoAmI, "/invade | /dropmeteor | /bloodmoon | /eye");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1087,7 +1090,7 @@
|
||||||
}
|
}
|
||||||
if (str9 == "/eater")
|
if (str9 == "/eater")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI)))
|
if (!ShankShock.IsAdmin(this.whoAmI))
|
||||||
{
|
{
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1098,7 +1101,7 @@
|
||||||
}
|
}
|
||||||
if (str9.Length > 5 && str9.Substring(0, 5) == "/kick")
|
if (str9.Length > 5 && str9.Substring(0, 5) == "/kick")
|
||||||
{
|
{
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI))){
|
if (!ShankShock.IsAdmin(this.whoAmI)){
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1113,7 +1116,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (str9.Length > 4 && str9.Substring(0, 4) == "/ban"){
|
if (str9.Length > 4 && str9.Substring(0, 4) == "/ban"){
|
||||||
if (!ShankShock.IsAdmin(ShankShock.FindPlayer(this.whoAmI))){
|
if (!ShankShock.IsAdmin(this.whoAmI)){
|
||||||
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue