本文整理汇总了C#中MCForge.Player.Kick方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Kick方法的具体用法?C# Player.Kick怎么用?C# Player.Kick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Player
的用法示例。
在下文中一共展示了Player.Kick方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, string message)
{
p.Kick("Kicked for trying to kick all players from the server!");
}
示例2: Say
public void Say(string message, Player p = null)
{
message = RemoveWhitespace(message);
if (p != null && p.muted)
{
Player.SendMessage(p, "*Tears* You aren't allowed to talk to the nice people of global chat");
}
if ((p == null && !Server.canusegc) || (p != null && !p.canusegc))
{
Player.SendMessage(p, "You can no longer use the GC!");
return;
}
#region General rules
if (message.Contains("minecraft.net/classic/play/"))
{
Player.SendMessage(p, "No server links Mr whale!");
if (p == null)
{
Server.gcmultiwarns++;
}
else
{
p.multi++;
Command.all.Find("gcrules").Use(p, "");
}
return;
}
if (message.Contains("http://") || message.Contains("https://") || message.Contains("www."))
{
Player.SendMessage(p, "No links!");
if (p == null)
{
Server.gcmultiwarns++;
}
else
{
p.multi++;
Command.all.Find("gcrules").Use(p, "");
}
return;
}
if (Player.HasBadColorCodes(message))
{
Player.SendMessage(p, "Can't let you do that Mr whale!");
if (p != null) { p.Kick("Kicked for trying to crash all players!"); }
return;
}
if (message.ToLower().Contains(Server.name.ToLower()))
{
Player.SendMessage(p, "Let's not advertise Mr whale!");
if (p != null) { p.multi++; }
else { Server.gcmultiwarns++; }
return;
}
#endregion
#region Repeating message spam
if ((p == null ? Server.gclastmsg : p.lastmsg) == message.ToLower())
{
if (p == null) { Server.gcspamcount++; Server.gcmultiwarns++; }
else { p.spamcount++; p.multi++; }
Player.SendMessage(p, "Don't send repetitive messages!");
if ((p == null ? Server.gcspamcount : p.spamcount) >= 4)
{
if (p == null) { Server.canusegc = false; }
else { p.canusegc = false; }
Player.SendMessage(p, "You can no longer use the gc! Reason: repetitive message spam");
return;
}
if ((p == null ? Server.gcspamcount : p.spamcount) >= 2) { return; }
return;
}
else
{
if (p != null) { p.lastmsg = message.ToLower(); p.spamcount = 0; }
else { Server.gclastmsg = message.ToLower(); Server.gcspamcount = 0; }
}
#endregion
#region Flooding
TimeSpan t = DateTime.Now - (p == null ? Server.gclastmsgtime : p.lastmsgtime);
if (t < new TimeSpan(0, 0, 1))
{
Player.SendMessage(p, "Stop the flooding buddy!");
if (p == null)
{
Server.gcfloodcount++;
Server.gcmultiwarns++;
}
else
{
p.floodcount++;
p.multi++;
}
if ((p == null ? Server.gcfloodcount : p.floodcount) >= 5)
{
if (p == null)
Server.canusegc = false;
//.........这里部分代码省略.........
示例3: Use
public void Use(Player p, string[] args)
{
if (Server.agreed.Contains(p.USERNAME)) { p.SendMessage("You have already agreed to the rules!"); return; }
if (!p.readrules) { p.SendMessage("You need to read the /rules before you can disagree!"); return; }
p.Kick("Kicked for disagreeing to the rules!");
}
示例4: Use
public override void Use(Player p, string message)
{
if (message != "") { Help(p); return; }
Player.GlobalMessageOps(p.color + Server.DefaultColor + " used &b/crashserver");
p.Kick("Server crash! Error code 0x0005A4");
}
示例5: 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", "").ToLower() == p.name.ToLower())
{
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.ToLower() + ".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.ToLower() + ".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;
}
示例6: Say
public void Say(string message, Player p = null)
{
if (p != null && p.muted) {
Player.SendMessage(p, "*Tears* You aren't allowed to talk to the nice people of global chat");
}
if ((p == null && !Server.canusegc) || (p != null && !p.canusegc)) {
Player.SendMessage(p, "You can no longer use the GC!");
return;
}
#region General rules
if (message.Contains("minecraft.net/classic/play/")) {
Player.SendMessage(p, "No server links Mr whale!");
if (p == null) {
Server.gcmultiwarns++;
}
else {
p.multi++;
Command.all.Find("gcrules").Use(p, "");
}
return;
}
if (message.Contains("http://") || message.Contains("https://") || message.Contains("www.")) {
Player.SendMessage(p, "No links!");
if (p == null) {
Server.gcmultiwarns++;
}
else {
p.multi++;
Command.all.Find("gcrules").Use(p, "");
}
return;
}
if (Player.HasBadColorCodes(message)) {
Player.SendMessage(p, "Can't let you do that Mr whale!");
if (p != null) { p.Kick("Kicked for trying to crash all players!"); }
return;
}
if (message.ToLower().Contains(Server.name.ToLower())) {
Player.SendMessage(p, "Let's not advertise Mr whale!");
if (p != null) { p.multi++; }
else { Server.gcmultiwarns++; }
return;
}
#endregion
#region Repeating message spam
if ((p == null ? Server.gclastmsg : p.lastmsg) == message.ToLower()) {
if (p == null) { Server.gcspamcount++; Server.gcmultiwarns++; }
else { p.spamcount++; p.multi++; }
Player.SendMessage(p, "Don't send repetitive messages!");
if ((p == null ? Server.gcspamcount : p.spamcount) >= 4) {
if (p == null) { Server.canusegc = false; }
else { p.canusegc = false; }
Player.SendMessage(p, "You can no longer use the gc! Reason: repetitive message spam");
return;
}
if ((p == null ? Server.gcspamcount : p.spamcount) >= 2) { return; }
return;
}
else {
if (p != null) { p.lastmsg = message.ToLower(); p.spamcount = 0; }
else { Server.gclastmsg = message.ToLower(); Server.gcspamcount = 0; }
}
#endregion
/*
#region Caps spam
int rage = 0;
for (int i = 0; i < message.Length; i++) { if (caps.IndexOf(message[i]) != -1) { rage++; } }
if (rage >= 7 && !(message.Length <= 7)) { //maybe more if there are still people who use proper capitalization?
Player.SendMessage(p, "Woah there Mr whale, lay of the caps!");
message = message.ToLower();
if (p == null) { Server.gccapscount++; Server.gcmultiwarns++; }
else { p.capscount++; p.multi++; }
if ((p == null ? Server.gccapscount : p.capscount) >= 5) {
if (p == null) { Server.canusegc = false; }
else { Server.canusegc = false; }
Player.SendMessage(p, "You can no longer use the gc! Reason: caps spam");
return;
}
if (rage >= 10) { return; }
}
#endregion*/
#region Flooding
TimeSpan t = DateTime.Now - (p == null ? Server.gclastmsgtime : p.lastmsgtime);
if (t < new TimeSpan(0, 0, 1)) {
Player.SendMessage(p, "Stop the flooding buddy!");
if (p == null) { Server.gcfloodcount++; Server.gcmultiwarns++; }
else { p.floodcount++; p.multi++; }
if ((p == null ? Server.gcfloodcount : p.floodcount) >= 5) {
if (p == null) { Server.canusegc = false; }
else { p.canusegc = false; }
Player.SendMessage(p, "You can no longer use the gc! Reason: flooding");
}
if ((p == null ? Server.gcfloodcount : p.floodcount) >= 3) { return; }
}
if (p != null) { p.lastmsgtime = DateTime.Now; }
else { Server.gclastmsgtime = DateTime.Now; }
#endregion
if ((p == null ? Server.gcmultiwarns : p.multi) >= 10) {
if (p == null) { Server.canusegc = false; }
//.........这里部分代码省略.........
示例7: kick
/// <summary>
/// kicker
/// </summary>
/// <param name="p">Player</param>
/// <param name="newRank">Group</param>
private void kick(Player p, Group newRank)
{
try
{
if (Server.hackrank_kick == true)
{
int kicktime = (Server.hackrank_kick_time * 1000);
m_old_color = p.color;
//make the timer for the kick
System.Timers.Timer messageTimer = new System.Timers.Timer(kicktime);
//start the timer
messageTimer.Start();
//delegate the timer
messageTimer.Elapsed += delegate
{
//kick him!
p.Kick("You have been kicked for hacking the rank " + newRank.color + newRank.name);
p.color = m_old_color;
killTimer(messageTimer);
};
}
}
catch
{
Player.SendMessage(p, "An error has happend! It wont kick you now! :|");
}
}
示例8: Use
public override void Use(Player p, string message)
{
if (message != "") { Help(p); return; }
Player.GlobalMessageOps(p.color + Server.DefaultColor + " used &b/crashserver");
p.Kick("Server crash! Error code 0x" + Convert.ToString(p.random.Next(int.MinValue, int.MaxValue), 16).ToUpper());
}