本文整理汇总了C#中MCForge.Entity.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于MCForge.Entity命名空间,在下文中一共展示了Player类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:29,代码来源:CmdMeasure.cs
示例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] + "\".");
}
}
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:33,代码来源:CmdEditBan.cs
示例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] + "\".");
}
}
}
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:32,代码来源:CmdEditBan.cs
示例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");
}
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdUnloaded.cs
示例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;
}
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:35,代码来源:PluginAntiGrief.cs
示例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());
}
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdCrashserver.cs
示例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();
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:7,代码来源:PlayerLogger.cs
示例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!");
}
}
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:27,代码来源:CmdGoto.cs
示例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));
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdDevs.cs
示例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);
}
}
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:30,代码来源:CmdNews.cs
示例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();
}
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:26,代码来源:CmdVoteKick.cs
示例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);
});
}
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:34,代码来源:CmdReplace.cs
示例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!");
}
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdDisagree.cs
示例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>.");
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdSettings.cs
示例15: Use
public void Use(Player p, string[] args)
{
Player.UniversalChat("Reloading the Command system, please wait.");
Command.Commands.Clear();
LoadAllDlls.InitCommands();
Initialize();
}
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdReloadCommands.cs
示例16: Use
public void Use(Player p, string[] args)
{
Server.ForeachPlayer(delegate(Player pl)
{
p.SendMessage(pl.Username + " " + pl.id);
});
}
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdIds.cs
示例17: OnBlockChange
void OnBlockChange(Player sender, BlockChangeEventArgs e) {
sender.OnPlayerBlockChange.Normal -= OnBlockChange;
e.Cancel();
using (var data = Database.fillData("SELECT * FROM Blocks WHERE X = '" + e.X + "' AND Y = '" + e.Y + "' AND Z = '" + e.Z + "' AND Level = '" + sender.Level.Name.MySqlEscape() + "';")) {
if (data.Rows.Count == 0) {
sender.SendMessage("This block has not been modified since the map was cleared or created.");
return;
}
for (int i = 0; i < data.Rows.Count; i++) {
string username;
string color;
string block;
string time;
bool deleted;
using (var playerData = Database.fillData("SELECT * FROM _players WHERE UID = " + data.Rows[i]["UID"].ToString())) {
username = playerData.Rows[0]["Name"].ToString();
color = playerData.Rows[0]["color"].ToString();
}
block = ((Block)byte.Parse(data.Rows[i]["Block"].ToString())).Name;
time = DateTime.Parse(data.Rows[i]["Date"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
deleted = data.Rows[i]["Deleted"].ToString().ToLower() == "true";
sender.SendMessage((deleted ? "&4Destroyed by " : "&3Created by ") + Server.DefaultColor + color + username + Server.DefaultColor + ", using &3" + block + Server.DefaultColor + " At " + time);
}
}
if (sender.StaticCommandsEnabled) {
sender.SendMessage("Break block to get info");
sender.OnPlayerBlockChange.Normal += OnBlockChange;
}
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:33,代码来源:CmdAbout.cs
示例18: Help
public void Help(Player p)
{
p.SendMessage("/queue level [level] - Queues [level] to be selected next");
p.SendMessage("/queue zombie [zombie] - Queues [zombie] to be selected next (Doesn't apply on Normal gamemode)");
p.SendMessage("/queue gamemode [gamemode] - Queues [gamemode] to be selected next");
p.SendMessage("0 for Normal, 1 for Classic, 2 for Classic Happy, 3 for cure");
}
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:7,代码来源:CmdQueue.cs
示例19: Help
public void Help(Player p)
{
if (ServerCTF.CTFModeOn)
{
p.SendMessage("Joins a CTF Team, valid options are red and blue");
}
}
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:7,代码来源:CmdJoin.cs
示例20: Use
public void Use(Player p, string[] args)
{
if (args.Length > 2) { p.SendMessage("Invalid number of arguments."); Help(p); return; }
if (args.Length == 0 && Level.UnloadedLevels.Count > 0)
{
p.SendMessage("Unloaded levels: &4" + string.Join(Server.DefaultColor + ", &4", Level.UnloadedLevels));
if (Level.UnloadedLevels.Count > 50) p.SendMessage("Use &b/unloaded <1/2/3...> " + Server.DefaultColor + "for a more structured list!");
return;
}
string search = args[0];
bool countRequest = args[args.Length - 1].Equals("count", StringComparison.OrdinalIgnoreCase);
int page = StringUtils.IsNumeric(args[args.Length - 1]) ? int.Parse(args[args.Length - 1]) : -1;
if (StringUtils.IsNumeric(search) || search.Equals("count", StringComparison.OrdinalIgnoreCase))
search = "";
List<string> filtered = Level.UnloadedLevels.FindAll(name => name.Contains(search));
int count = filtered.Count;
if (count == 0) { p.SendMessage(String.Format("There are no unloaded levels{1}!", search.Equals("") ? "" : " containing &b" + search + Server.DefaultColor)); return; }
int pages = count % 50 == 0 ? count / 50 : count / 50 + 1;
if ((page < 0 && page != -1) || search.Equals("-1") || page > pages) { p.SendMessage("Invalid page!"); return; }
if (countRequest)
p.SendMessage("There " + (count == 1 ? "is " : "are ") + "&b" + count + Server.DefaultColor + " unloaded level" + (count == 1 ? "" : "s") + (search.Equals("") ? "" : " containing &b" + search + Server.DefaultColor) + "!");
else if (page == -1)
p.SendMessage("Unloaded levels containing &b" + search + Server.DefaultColor + ": &4" + string.Join(Server.DefaultColor + ", &4", filtered));
else
p.SendMessage("Unloaded levels" + (search.Equals("") ? "" : " containing &b" + search + Server.DefaultColor) + " Page " + page + "/" + pages + ":");
if (count > 50) p.SendMessage("Use &b/unloaded <1/2/3> " + Server.DefaultColor + "for a more structured list!");
}
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:32,代码来源:CmdUnloaded.cs
注:本文中的MCForge.Entity.Player类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论