本文整理汇总了C#中System.Net.Player.Kick方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Kick方法的具体用法?C# Player.Kick怎么用?C# Player.Kick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Player
的用法示例。
在下文中一共展示了Player.Kick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, string message)
{
string Owner = Server.server_owner;
if (Server.server_owner == "Notch")
{
Owner = "the owner";
}
if (p.group.Permission < Server.verifyadminsrank)
{
Player.SendMessage(p, "You do not have the &crequired rank to use this command!");
return;
}
if (Server.verifyadmins == false)
{
Player.SendMessage(p, "Verification of admins is &cdisabled!");
return;
}
if (p.adminpen == false)
{
{
Player.SendMessage(p, "You have &calready verified" + Server.DefaultColor + ", why are you using this?");
Player.SendMessage(p, "To set a new password use &a/setpass [Pass]!");
return;
}
}
if (p.passtries == 3)
{
p.Kick("Did you really think you could keep on guessing?");
return;
}
int foundone = 0;
if (message == "")
{
Help(p);
return;
}
int number = message.Split(' ').Length;
if (number > 1)
{
Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!");
return;
}
if (!Directory.Exists("extra/passwords"))
{
Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
return;
}
DirectoryInfo di = new DirectoryInfo("extra/passwords/");
FileInfo[] fi = di.GetFiles("*.xml");
Thread.Sleep(10);
try
{
foreach (FileInfo file in fi)
{
if (file.Name.Replace(".xml", "") == p.name)
{
foundone++;
}
}
}
catch
{
Player.SendMessage(p, "An Error Occurred! Try again soon!");
return;
}
if (foundone < 0)
{
Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
return;
}
if (foundone > 1)
{
Player.SendMessage(p, "&cAn error has occurred!");
return;
}
if (!File.Exists("extra/passwords/" + p.name + ".xml"))
{
Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
return;
}
Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.name + ".xml"), "MCForgeEncryption", p, message);
if (message == password)
{
Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
if (p.adminpen == true)
{
p.adminpen = false;
}
password = "";
p.passtries = 0;
return;
}
p.passtries++;
Player.SendMessage(p, "&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
Player.SendMessage(p, "If you have &cforgotten your password, " + Server.DefaultColor + "contact " + Owner + " and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.passtries);
return;
}
示例2: Use
public override void Use(Player p, string message)
{
if ( p.group.Permission < Server.verifyadminsrank ) {
Player.SendMessage(p, "You do not have the &crequired rank to use this command!");
return;
}
if ( !Server.verifyadmins ) {
Player.SendMessage(p, "Verification of admins is &cdisabled!");
return;
}
if ( !p.adminpen ) {
Player.SendMessage(p, "You have &calready verified.");
return;
}
if ( p.passtries >= 3 ) {
p.Kick("Did you really think you could keep on guessing?");
return;
}
if ( String.IsNullOrEmpty(message.Trim()) ) {
Help(p);
return;
}
int number = message.Split(' ').Length;
if ( number > 1 ) {
Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!");
return;
}
if ( !Directory.Exists("extra/passwords") ) {
Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
return;
}
DirectoryInfo di = new DirectoryInfo("extra/passwords/");
FileInfo[] fi = di.GetFiles("*.dat");
if ( !File.Exists("extra/passwords/" + p.name + ".dat") ) {
Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
return;
}
if ( PasswordHasher.MatchesPass(p.name, message) ) {
Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
if ( p.adminpen ) {
p.adminpen = false;
}
return;
}
p.passtries++;
Player.SendMessage(p, "&cWrong Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
Player.SendMessage(p, "Forgot your password? " + Server.DefaultColor + "Contact the owner so they can reset it!");
}