本文整理汇总了C#中MCForge.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于MCForge命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
CatchPos cpos = (CatchPos)p.blockchangeObject;
cpos.message = cpos.message.Replace("'", "\\'");
DataTable Messages = MySQL.fillData("SELECT * FROM `Messages" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
Messages.Dispose();
if (Messages.Rows.Count == 0)
{
MySQL.executeQuery("INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')");
}
else
{
MySQL.executeQuery("UPDATE `Messages" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
}
Player.SendMessage(p, "Message block placed.");
p.level.Blockchange(p, x, y, z, cpos.type);
p.SendBlockchange(x, y, z, cpos.type);
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例2: Help
public override void Help(Player p)
{
Player.SendMessage(p, "/setrank <player> <rank> <yay> - Sets or returns a players rank.");
Player.SendMessage(p, "You may use /rank as a shortcut");
Player.SendMessage(p, "Valid Ranks are: " + Group.concatList(true, true));
Player.SendMessage(p, "<yay> is a celebratory message");
}
示例3: Use
public override void Use(Player p, string message)
{
Level lvl = null;
if (p == null)
{
Player.SendMessage(p, "You have to be ingame to do that!");
return;
}
if (message == "") { Help(p); return; } else { lvl = Level.Find(message); }
if (lvl == null)
{
Player.SendMessage(p, "Level not found!");
return;
}
if (lvl.name.Split('.')[1].ToLower() == p.name.ToLower())
{
Player.SendMessage(p, "You cannot dislike your own map!");
return;
}
lvl.like(p.name, true);
Player.SendMessage(p, "Added map to your dislike list");
}
示例4: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
Group foundGroup = Group.Find(message);
if (foundGroup == null)
{
Player.SendMessage(p, "Could not find group");
return;
}
string totalList = "";
foreach (string s in foundGroup.playerList.All())
{
totalList += ", " + s;
}
if (totalList == "")
{
Player.SendMessage(p, "No one has the rank of " + foundGroup.color + foundGroup.name);
return;
}
Player.SendMessage(p, "People with the rank of " + foundGroup.color + foundGroup.name + ":");
Player.SendMessage(p, totalList.Remove(0, 2));
}
示例5: BlankMessage
//Yes this does work
//Trust me...I'm a doctor
public void BlankMessage(Player p)
{
byte[] buffer = new byte[65];
Player.StringFormat(" ", 64).CopyTo(buffer, 1);
p.SendRaw(13, buffer);
buffer = null;
}
示例6: Use
public override void Use(Player p, string message)
{
string alltext = File.ReadAllText("text/tempranks.txt");
if (alltext.Contains(message) == false)
{
Player.SendMessage(p, "&cPlayer &a" + message + "&c Has not been assigned a temporary rank. Cannot unnasign.");
goto end;
}
string alltempranks = "";
Player who = Player.Find(message);
foreach (string line in File.ReadAllLines("text/tempranks.txt"))
{
if (line.Contains(message))
{
string group = line.Split(' ')[2];
Group oldgroup = Group.findPlayerGroup(who.name);
Group newgroup = Group.Find(group);
Command.all.Find("setrank").Use(null, who.name + " " + newgroup.name);
Player.SendMessage(p, "&eTemporary rank of &a" + message + "&e has been unassigned");
Player.SendMessage(who, "&eYour temporary rank has been unassigned");
}
if (!line.Contains(message))
{
alltempranks = alltempranks + line + "\r\n";
}
}
File.WriteAllText("text/tempranks.txt", alltempranks);
end:
System.Threading.Thread.Sleep(0);
}
示例7: Use
public override void Use(Player p, string message)
{
if (p == null)
{
Player.SendMessage(p, "You have to be ingame to do that!");
return;
}
if (message == "") { Help(p); return; }
string mapnumber = null;
if (message.Split(' ').Length == 2)
mapnumber = message.Split(' ')[1];
message = message.Split(' ')[0];
string path = "levels/" + p.name;
if (!string.IsNullOrEmpty(mapnumber))
path += "." + mapnumber;
path += ".lvl";
string dest = "levels/submit/" + message + "." + p.name + ".lvl";
if (System.IO.File.Exists(path))
{
if (!System.IO.Directory.Exists("levels/submit"))
System.IO.Directory.CreateDirectory("levels/submit"); //if not then make it
System.IO.File.Copy(path, dest);
Player.SendMessage(p, "Level submitted as " + message);
}
else
{
Player.SendMessage(p, "Level not found!");
}
}
示例8: Help
public void Help(Player p)
{
p.SendMessage("/calculate <num1> <method> <num2> - Evaluates two number using a method.");
p.SendMessage("Available methods for two numbers: /, x, -, +, ^(Exponent),");
p.SendMessage("/calculate <num1> <method> - Evaluates a number using a complex method.");
p.SendMessage("Available methods for one number: square, root, pi, cube");
}
示例9: Use
public override void Use(Player p, string message)
{
if (message == "")
{
p.whisper = !p.whisper; p.whisperTo = "";
if (p.whisper) Player.SendMessage(p, "All messages sent will now auto-whisper");
else Player.SendMessage(p, "Whisper chat turned off");
}
else
{
Player who = Player.Find(message);
if (who == null) { p.whisperTo = ""; p.whisper = false; Player.SendMessage(p, "Could not find player."); return; }
if (who.hidden)
{
if (p.hidden == false || who.group.Permission > p.group.Permission)
{
Player.SendMessage(p, "Could not find player.");
return;
}
}
p.whisper = true;
p.whisperTo = who.name;
Player.SendMessage(p, "Auto-whisper enabled. All messages will now be sent to " + who.name + ".");
}
}
示例10: Use
public override void Use(Player p, string message)
{
if (message == "" || message.Split(' ').Length > 2) { Help(p); return; }
Player who = Player.Find(message);
if (who == null)
{
if (Server.muted.Contains(message))
{
Server.muted.Remove(message);
Player.GlobalMessage(message + Server.DefaultColor + " is not online but they have been &bun-muted");
Server.muted.Save("muted.txt");
return;
}
Player.SendMessage(p, "The player entered is not online.");
return;
}
if (who.muted)
{
who.muted = false;
Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " has been &bun-muted", false);
}
else
{
if (p != null)
{
if (who != p) if (who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot mute someone of a higher rank."); return; }
}
who.muted = true;
Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " has been &8muted", false);
Server.muted.Save("muted.txt");
}
}
示例11: Register
/// <summary>
/// Register this event
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
public static void Register(Player.OnAFK method, Priority priority, Plugin plugin)
{
if (Find(plugin) != null)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnPlayerAFKEvent(method, priority, plugin));
Organize();
}
示例12: Use
public override void Use(Player p, string message)
{
string newsFile = "text/news.txt";
if (!File.Exists(newsFile) || (File.Exists(newsFile) && File.ReadAllLines(newsFile).Length == -1))
{
using (var SW = new StreamWriter(newsFile))
{
SW.WriteLine("News have not been created. Put News in '" + newsFile + "'.");
}
return;
}
string[] strArray = File.ReadAllLines(newsFile);
if (message == "")
{
foreach (string t in strArray)
{
Player.SendMessage(p, t);
}
}
else
{
string[] split = message.Split(' ');
if (split[0] == "all") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "You must be at least " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + " to send this to all players."); return; } for (int k = 0; k < strArray.Length; k++) { Player.GlobalMessage(strArray[k]); } return; }
Player player = Player.Find(split[0]);
if (player == null) { Player.SendMessage(p, "Could not find player \"" + split[0] + "\"!"); return; }
foreach (string t in strArray)
{
Player.SendMessage(player, t);
}
Player.SendMessage(p, "The News were successfully sent to " + player.name + ".");
}
}
示例13: Help
public override void Help(Player p)
{
p.SendMessage(c.lime + "To purchase an item, type /buy [item number] [amount] (except for item 5)");
p.SendMessage(c.blue + "1. " + Server.DefaultColor + "Title - 250 " + Server.moneys);
p.SendMessage(c.blue + "2. " + Server.DefaultColor + "Title Color - 150 " + Server.moneys);
p.SendMessage(c.blue + "3. " + Server.DefaultColor + "Lives - 1 " + Server.moneys + " per life");
p.SendMessage(c.blue + "4. " + Server.DefaultColor + "Sponges - 10 " + Server.moneys + " per sponge");
p.SendMessage(c.blue + "5. " + Server.DefaultColor + "Sponge Pack - 55 " + Server.moneys + " for 8 sponges");
if (p.group.name.ToLower() == "guest" && p.money >= 50)
p.SendMessage(c.blue + "6. " + Server.DefaultColor + "Rank Up - 50 (builder)" + Server.moneys);
else if (p.group.name.ToLower() == "builder" && p.money >= 150)
p.SendMessage(c.blue + "6. " + Server.DefaultColor + "Rank Up - 150 (advbuilder)" + Server.moneys);
else if (p.group.name.ToLower() == "advbuilder" && p.money >= 300)
p.SendMessage(c.blue + "6. " + Server.DefaultColor + "Rank Up - 300 (masterbuilder" + Server.moneys);
else if (p.group.name.ToLower() == "guest" && p.money <= 50)
p.SendMessage("You do not have enough " + Server.moneys + " (50)");
else if (p.group.name.ToLower() == "builder" && p.money <= 150)
p.SendMessage("You do not have enough " + Server.moneys + " (150)");
else if (p.group.name.ToLower() == "advbuilder" && p.money <= 300)
p.SendMessage("You do not have enough " + Server.moneys + " (300)");
else
p.SendMessage("Out of stock!");
p.SendMessage(c.blue + "7. " + Server.DefaultColor + "Login Message - 200 " + Server.moneys);
p.SendMessage(c.blue + "8. " + Server.DefaultColor + "Logout Message - 200 " + Server.moneys);
return;
}
示例14: Use
public override void Use(Player p, string message)
{
if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; }
Player who = Player.Find(message.Split(' ')[0]);
string whoTo, fromname;
if (who != null) whoTo = who.name;
else whoTo = message.Split(' ')[0];
if (p != null) fromname = p.name;
else fromname = "Console";
message = message.Substring(message.IndexOf(' ') + 1);
//DB
if (message.Length > 255 && Server.useMySQL) { Player.SendMessage(p, "Message was too long. The text below has been trimmed."); Player.SendMessage(p, message.Substring(256)); message = message.Remove(256); }
Database.executeQuery("CREATE TABLE if not exists `Inbox" + whoTo + "` (PlayerFrom CHAR(20), TimeSent DATETIME, Contents VARCHAR(255));");
if (!Server.useMySQL)
Server.s.Log(message.Replace("'", "\\'"));
Database.executeQuery("INSERT INTO `Inbox" + whoTo + "` (PlayerFrom, TimeSent, Contents) VALUES ('" + fromname + "', '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', '" + message.Replace("'", (Server.useMySQL ? "\\'" : "''")) + "')");
//DB
Player.SendMessage(p, "Message sent to &5" + whoTo + ".");
if (who != null) who.SendMessage("Message recieved from &5" + fromname + Server.DefaultColor + ".");
}
示例15: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
Player who = Player.Find(message.Split(' ')[0]);
if (who == null) { Player.SendMessage(p, "Could not find player specified."); return; }
if (message.Split(' ').Length > 1)
message = message.Substring(message.IndexOf(' ') + 1);
else
if (p == null && Server.devs.Contains(who.name.ToLower()) == false) message = "You were kicked by an IRC controller!"; else message = "You were kicked by " + p.name + "!";
if (p != null)
if (who == p)
{
Player.SendMessage(p, "You cannot kick yourself!");
return;
}
else if (who.group.Permission >= p.group.Permission && p != null)
{
Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " tried to kick " + who.color + who.name + " but failed.", false);
return;
}
if (Server.devs.Contains(who.name.ToLower()))
{
if (!Server.devs.Contains(p.name.ToLower()))
{
Player.SendMessage(p, "You can't kick a MCForge Developer!");
Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " tried to kick " + who.color + who.name + Server.DefaultColor + " but failed, because " + who.color + who.name + Server.DefaultColor + " is a developer", false);
return;
}
}
who.Kick(message);
}