本文整理汇总了C#中MCForge.Entity.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于MCForge.Entity命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(Player p, string[] args) {
CatchPos cpos = new CatchPos();
if (args.Length != 0) {
cpos.ignore = new List<byte>();
for (int i = 0; i < args.Length; i++) {
try {
cpos.ignore.Add(Block.NameToBlock(args[i]));
}
catch {
p.SendMessage("Could not find the block '" + args[i] + "'");
return;
}
}
string s = "";
for (int i = 0; i < cpos.ignore.Count; i++) {
s += ((Block)cpos.ignore[i]).Name;
if (i == cpos.ignore.Count - 2) s += " and ";
else if (i != cpos.ignore.Count - 1) s += ", ";
}
p.SendMessage("Ignoring " + s + ".");
}
//else
//cpos.ignore.Add(Block.NameToByte("unknown")); //So it doesn't ignore air.
p.SendMessage("Place two blocks to determine the edges.");
//p.CatchNextBlockchange(new Player.BlockChangeDelegate(CatchBlock), (object)cpos);
p.SetDatapass("CmdMeasure_cpos", cpos);
p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock);
}
示例2: Use
public void Use(Player p, string[] args)
{
int _ = 0;
string message = "";
for (int i = 1; i <= args.Length; i++)
{
message += args[i] + " ";
}
string newreason = message.Trim().Substring(args[0].Length + 1);
string[] lines = File.ReadAllLines("bans/BanInfo.txt");
if (lines.Length < 1) { p.SendMessage("Could not find ban information for \"" + args[0] + "\"."); return; }
foreach (string line in lines)
{
if (line.Split('`')[0] == args[0])
{
string date = line.Split('`')[2];
string time = line.Split('`')[3];
string banner = line.Split('`')[4];
for (int o = 1; o <= lines.Length; o++)
{
if (lines[o].Split('`')[0] == args[0]) lines[o] = args[0] + "`" + newreason + "`" + date + "`" + time + "`" + banner;
}
File.WriteAllLines("bans/BanInfo.txt", lines);
p.SendMessage("Successfully set " + args[0] + "'s ban reason to \"" + newreason + "\".");
}
else
{
_++;
if (_ == 1)
p.SendMessage("Could not find ban information for \"" + args[0] + "\".");
}
}
}
示例3: Use
public void Use(Player p, string[] args)
{
int _ = 0;
string _newreason = "";
string newreason = _newreason.Substring(args[0].IndexOf(" ") + 1);
string[] lines = File.ReadAllLines("Bans/Ban Info.txt");
if (lines.Length < 1) { p.SendMessage("Could not find ban information for \"" + args[0] + "\"."); return; }
foreach (string line in lines)
{
if (line.Split('`')[0] == args[0])
{
string date = line.Split('`')[2];
string time = line.Split('`')[3];
string banner = line.Split('`')[4];
List<string> temp = new List<string>();
foreach (string l in lines)
{
if (!l.StartsWith(args[0]))
temp.Add(l);
temp.Add(args[0] + "`" + newreason + "`" + date + "`" + time + "`" + banner);
}
File.WriteAllLines("baninfo.txt", temp.ToArray());
p.SendMessage("Successfully set " + args[0] + "'s ban reason to \"" + newreason + "\".");
}
else
{
_++;
if (_ == 1)
p.SendMessage("Could not find ban information for \"" + args[0] + "\".");
}
}
}
示例4: Help
public void Help(Player p)
{
p.SendMessage("/unloaded - shows unloaded levels");
p.SendMessage("/unloaded [filter] <1/2/3> - shows a more structured list");
p.SendMessage("/unloaded [filter] count - shows the number of unloaded levels");
p.SendMessage("If [filter] is specified only levels containing the word will be included");
}
示例5: OnAllPlayersCommand_Normal
void OnAllPlayersCommand_Normal(Player sender, CommandEventArgs args) {
if (args.Command != "ag")
return;
args.Cancel();
if (args.Args.Length < 2) {
Help(sender);
return;
}
if (args.Args[0].ToLower() == "allow") {
Player who = Player.Find(args.Args[1]);
if (who == null || who is ConsolePlayer) {
sender.SendMessage("The specified player was not found");
return;
}
AllowList.AddValue<string, Player>(sender.Username, who);
return;
}
else if (args.Args[0].ToLower() == "disallow") {
Player who = Player.Find(args.Args[1]);
if (who == null || who is ConsolePlayer) {
sender.SendMessage("The specified player was not found");
return;
}
AllowList.RemoveValue<string, Player>(sender.Username, who);
return;
}
}
示例6: Use
public void Use(Player p, string[] args)
{
if (args.Length > 0) { Help(p); }
string random = Path.GetRandomFileName();
random = random.Replace(".", "");
p.Kick("SERVER CRASH ERROR CODE x8" + random.ToUpper());
}
示例7: OnConnect
public void OnConnect(Player p)
{
if (!all && players.Contains(p.Username.ToLower()) && !File.Exists("logs/Separate/" + p.Username + ".txt"))
File.Create("logs/Separate/" + p.Username + ".txt");
if (all)
File.Create("logs/Separate/" + p.Username + ".txt").Close();
}
示例8: Use
public void Use(Player p, string[] args)
{
Level tempLevel = Level.FindLevel(args[0]);
if (tempLevel != null)
{
//TODO Need to despawn here
#region Send and Spawn
p.IsLoading = true;
p.Level = tempLevel;
short x = (short)((0.5 + tempLevel.SpawnPos.x) * 32);
short y = (short)((1 + tempLevel.SpawnPos.y) * 32);
short z = (short)((0.5 + tempLevel.SpawnPos.z) * 32);
p.Pos = new Vector3(x, z, y);
p.Rot = tempLevel.SpawnRot;
p.oldPos = p.Pos;
p.oldRot = p.Rot;
p.SendSpawn(p);
p.IsLoading = false;
#endregion
//TODO Need to respawn here
Player.UniversalChat(p.Username + " went to " + args[0] + "!");
}
else
{
p.SendMessage("This level does not exist!");
}
}
示例9: Use
public void Use(Player p, string[] args)
{
string send = Colors.yellow + "MCForge Development Team: &9";
foreach (string s in Server.Devs)
send += s + Colors.white + ", &9";
p.SendMessage(send.Remove(send.Length - 2, 2));
}
示例10: Use
public void Use(Player p, string[] args)
{
if (!File.Exists("text/news.txt"))
{
File.Create("text/news.txt").Close();
Logger.Log("[File] Created news.txt", Color.White, Color.Black);
p.SendMessage("No News file was available!");
return;
}
string[] lines = File.ReadAllLines("text/news.txt");
DateTime editdate = File.GetLastWriteTime("text/news.txt");
if (args.Length == 0)
{
p.SendMessage("News as of " + editdate.ToShortDateString() + ":");
foreach (string line in lines)
{
p.SendMessage(line);
}
}
else
{
Player who = Player.Find(args[0].ToLower());
who.SendMessage("News as of " + editdate.ToShortDateString() + ":");
foreach (string line in lines)
{
who.SendMessage(line);
}
}
}
示例11: Use
public void Use(Player p, string[] args)
{
if (Server.voting) { p.SendMessage("A vote is already in progress!"); return; }
Player who = null;
if (args.Length == 0) { who = null; }
else { who = Player.Find(args[0]); }
if (who == null) { p.SendMessage("Cannot find that player!"); return; }
if (Server.devs.Contains(who.Username)) { p.SendMessage("You can't votekick a MCForge Developer!"); return; }
Server.kicker = who;
ResetVotes();
Server.voting = true;
Server.kickvote = true;
Player.UniversalChat("VOTE: Kick " + who.Username + "?");
Player.UniversalChat("Use: %aYes " + Server.DefaultColor + "or %cNo " + Server.DefaultColor + "to vote!");
Thread.Sleep(15000);
Player.UniversalChat("The votes are in! %aYes: " + Server.YesVotes + " %cNo: " + Server.NoVotes + Server.DefaultColor + "!");
if (Server.YesVotes > Server.NoVotes) { who.Kick("Votekick'd"); return; }
else if (Server.NoVotes > Server.YesVotes || Server.YesVotes == Server.NoVotes) { Player.UniversalChat("Looks like " + who.Username + " is staying!"); return; }
Server.ForeachPlayer(delegate(Player pl)
{
pl.ExtraData.CreateIfNotExist("Voted", false);
pl.ExtraData["Voted"] = false;
});
Server.voting = false;
ResetVotes();
}
示例12: CatchBlock2
public void CatchBlock2(Player sender, BlockChangeEventArgs args)
{
ushort x = args.X;
ushort y = args.Y;
ushort z = args.Z;
byte NewType = args.Holding;
bool placed = (args.Action == ActionType.Place);
CatchPos FirstBlock = (CatchPos)sender.GetDatapass("CmdReplace_cpos"); ;
unchecked {
if (FirstBlock.type != (byte)-1) {
NewType = FirstBlock.type;
}
}
List<Pos> buffer = new List<Pos>();
for (ushort xx = Math.Min((ushort)(FirstBlock.pos.x), x); xx <= Math.Max((ushort)(FirstBlock.pos.x), x); ++xx) {
for (ushort zz = Math.Min((ushort)(FirstBlock.pos.z), z); zz <= Math.Max((ushort)(FirstBlock.pos.z), z); ++zz) {
for (ushort yy = Math.Min((ushort)(FirstBlock.pos.y), y); yy <= Math.Max((ushort)(FirstBlock.pos.y), y); ++yy) {
Vector3S loop = new Vector3S(xx, zz, yy);
if (sender.Level.GetBlock(loop) == NewType) {
BufferAdd(buffer, loop);
}
}
}
}
//Group Max Blocks permissions here
sender.SendMessage(buffer.Count.ToString() + " blocks.");
//Level Blockqueue .-.
buffer.ForEach(delegate(Pos pos) {
sender.Level.BlockChange((ushort)(pos.pos.x), (ushort)(pos.pos.z), (ushort)(pos.pos.y), FirstBlock.type2);
});
}
示例13: Use
public void Use(Player p, string[] args)
{
p.ExtraData.CreateIfNotExist("ReadRules", false);
if (Server.agreed.Contains(p.Username)) { p.SendMessage("You have already agreed to the rules!"); return; }
if (!(bool)p.ExtraData["ReadRules"]) { p.SendMessage("You need to read the /rules before you can disagree!"); return; }
p.Kick("Kicked for disagreeing to the rules!");
}
示例14: Help
public void Help(Player p) {
p.SendMessage("Usage: /settings <key> [value]");
p.SendMessage("To get a value, do not add a value at the end of the command.");
p.SendMessage("To set a value, add a value at the end of the command.");
p.SendMessage("ex: /settings motd Welcome $user");
p.SendMessage("To get a description of a setting, type /settings help <key>.");
}
示例15: Use
public void Use(Player p, string[] args)
{
Player.UniversalChat("Reloading the Command system, please wait.");
Command.Commands.Clear();
LoadAllDlls.InitCommands();
Initialize();
}