本文整理汇总了C#中MCDawn.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于MCDawn命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: highlightStuff
public void highlightStuff(string[] fileContent, Int64 seconds, Player p)
{
Player.UndoPos Pos;
for (int i = fileContent.Length / 7; i >= 0; i--)
{
try
{
if (Convert.ToDateTime(fileContent[(i * 7) + 4].Replace('&', ' ')).AddSeconds(seconds) >= DateTime.Now)
{
Level foundLevel = Level.Find(fileContent[i * 7]);
if (foundLevel != null && foundLevel == p.level)
{
Pos.mapName = foundLevel.name;
Pos.x = Convert.ToUInt16(fileContent[(i * 7) + 1]);
Pos.y = Convert.ToUInt16(fileContent[(i * 7) + 2]);
Pos.z = Convert.ToUInt16(fileContent[(i * 7) + 3]);
Pos.type = foundLevel.GetTile(Pos.x, Pos.y, Pos.z);
if (Pos.type == Convert.ToByte(fileContent[(i * 7) + 6]) || Block.Convert(Pos.type) == Block.water || Block.Convert(Pos.type) == Block.lava)
{
if (Pos.type == Block.air || Block.Convert(Pos.type) == Block.water || Block.Convert(Pos.type) == Block.lava)
p.SendBlockchange(Pos.x, Pos.y, Pos.z, Block.red);
else p.SendBlockchange(Pos.x, Pos.y, Pos.z, Block.green);
}
}
}
else break;
}
catch { }
}
}
示例2: Use
public override void Use(Player p, string message)
{
Player who = Player.Find(message);
Level whomap = who.level;
if (who == null) { Player.SendMessage(p, "Player not found!"); }
if (who == p) { Player.SendMessage(p, "Can't detain your self!"); }
if (Server.devs.Contains(who.name) && !Server.devs.Contains(p.name))
{
Player.SendMessage(p, "You can't detain an MCDawn Developer!");
return;
}
if (who.group.Permission >= p.group.Permission)
{
Player.SendMessage(p, "Can't detain someone with equal or higher rank!");
return;
}
if (who.detained)
{
who.detained = false;
Player.GlobalMessage(who.color + who.name + Server.DefaultColor + " is now freed from detention by " + p.color + p.name + Server.DefaultColor + ".");
Command.all.Find("displayname").Use(who, who.name);
return;
}
who.detained = true;
Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " detained " + who.color + who.name + Server.DefaultColor + " on map: &a" + whomap.name + Server.DefaultColor + ".");
Command.all.Find("displayname").Use(who, who.name + " &c(detained)" + who.color + who.name);
}
示例3: Help
public override void Help(Player p)
{
Player.SendMessage(p, "/setrank <player> <rank> [reason] - 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, "Reason is optional.");
}
示例4: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
Player who = Player.Find(message);
if (who != null)
{
if (who.voice)
{
who.voice = false;
Player.SendMessage(p, "Removing voice status from " + who.name);
who.SendMessage("Your voice status has been revoked.");
who.voicestring = "";
}
else
{
who.voice = true;
Player.SendMessage(p, "Giving voice status to " + who.name);
who.SendMessage("You have received voice status.");
who.voicestring = "&f+";
}
}
else
{
Player.SendMessage(p, "There is no player online named \"" + message + "\"");
}
}
示例5: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
try
{
if (message.ToLower() == "all")
{
for (int i = 0; i < PlayerBot.playerbots.Count; i++)
{
if (PlayerBot.playerbots[i].level == p.level)
{
// PlayerBot.playerbots.Remove(PlayerBot.playerbots[i]);
PlayerBot Pb = PlayerBot.playerbots[i];
Pb.removeBot();
i--;
}
}
}
else
{
PlayerBot who = PlayerBot.Find(message);
if (who == null) { Player.SendMessage(p, "There is no bot " + who + "!"); return; }
if (p.level != who.level) { Player.SendMessage(p, who.name + " is in a different level."); return; }
who.removeBot();
Player.SendMessage(p, "Removed bot.");
}
}
catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Error caught"); }
}
示例6: Help
public override void Help(Player p)
{
Player.SendMessage(p, "/undo [player] [seconds] - Undoes the blockchanges made by [player] in the previous [seconds].");
Player.SendMessage(p, "/undo [player] all - Will undo 138 hours for [player] &c<Operator+>");
Player.SendMessage(p, "/undo [player] 0 - Will undo 30 minutes &c<Operator+>");
Player.SendMessage(p, "/undo physics [seconds] - Undoes the physics for the current map");
}
示例7: 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 `Commandblocks" + 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 `Commandblocks" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')");
}
else
{
MySQL.executeQuery("UPDATE `Commandblocks" + 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);
}
示例8: Use
public override void Use(Player p, string message)
{
if (p == null) { Player.SendMessage(p, "Command not usable in Console."); return; }
if (!p.group.CanExecute(Command.all.Find("static")) || !p.group.CanExecute(Command.all.Find("cuboid"))) { p.SendMessage("You must have access to both /static and /cuboid commands."); return; }
if (p.staticCommands) { p.staticCommands = false; p.ClearBlockchange(); p.BlockAction = 0; p.SendMessage("/zz has finished."); }
else { Command.all.Find("static").Use(p, "cuboid " + message); }
}
示例9: Use
public override void Use(Player p, string message)
{
if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; }
string foundBlah = Command.all.FindShort(message.Split(' ')[0]);
Command foundCmd;
if (foundBlah == "") foundCmd = Command.all.Find(message.Split(' ')[0]);
else foundCmd = Command.all.Find(foundBlah);
if (foundCmd == null) { Player.SendMessage(p, "Could not find command entered"); return; }
if (p != null && !p.group.CanExecute(foundCmd)) { Player.SendMessage(p, "This command is higher than your rank."); return; }
LevelPermission newPerm = Level.PermissionFromName(message.Split(' ')[1]);
if (newPerm == LevelPermission.Null) { Player.SendMessage(p, "Could not find rank specified"); return; }
if (p != null && newPerm > p.group.Permission) { Player.SendMessage(p, "Cannot set to a rank higher than yourself."); return; }
GrpCommands.rankAllowance newCmd = GrpCommands.allowedCommands.Find(rA => rA.commandName == foundCmd.name);
newCmd.lowestRank = newPerm;
GrpCommands.allowedCommands[GrpCommands.allowedCommands.FindIndex(rA => rA.commandName == foundCmd.name)] = newCmd;
GrpCommands.Save(GrpCommands.allowedCommands);
GrpCommands.fillRanks();
Player.GlobalMessage("&d" + foundCmd.name + Server.DefaultColor + "'s permission was changed to " + Level.PermissionToName(newPerm));
Server.s.Log(foundCmd.name + "'s permission was changed to " + Level.PermissionToName(newPerm));
}
示例10: Help
public override void Help(Player p)
{
Player.SendMessage(p, "/cmdbind [command] [num] - Binds [command] to [num]");
Player.SendMessage(p, "[num] must be between 0 and 9");
Player.SendMessage(p, "Use with \"/[num]\" &b(example: /2)");
Player.SendMessage(p, "Use /cmdbind [num] to see stored commands.");
}
示例11: Use
public override void Use(Player p, string message)
{
if (message == "" || message.Split(' ').Length < 2) { Help(p); return; }
Player toSend = Player.Find(message.Split(' ')[0]);
Player target = Player.Find(message.Split(' ')[1]);
if (toSend == null || target == null) { Player.SendMessage(p, "Player could not be found."); return; }
if (toSend == p)
{
if (target == p) { Player.SendMessage(p, "You can't teleport yourself to yourself."); return; }
else { Player.SendMessage(p, "Use /tp <player> next time. Teleporting now..."); Command.all.Find("tp").Use(p, target.name); }
return;
}
if (target == p) { Player.SendMessage(p, "Use /summon <player> next time. Summoning now..."); Command.all.Find("summon").Use(p, target.name); return; }
if (p.group.Permission < toSend.group.Permission) { Player.SendMessage(p, "Cannot teleport a player of higher rank."); return; }
if (target.level.name.Contains("cMuseum") || toSend.level.name.Contains("cMuseum")) { Player.SendMessage(p, "Player is in a museum!"); return; }
if (toSend.level != target.level)
{
Command.all.Find("goto").Use(toSend, target.level.name);
while (toSend.Loading) { }
}
if (toSend.level == target.level)
{
if (target.Loading)
{
Player.SendMessage(p, "Waiting for " + target.color + target.name + "&g to spawn...");
while (target.Loading) { }
}
while (toSend.Loading) { } //Wait for player to spawn in new map
unchecked { toSend.SendPos((byte)-1, target.pos[0], target.pos[1], target.pos[2], target.rot[0], 0); }
}
}
示例12: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
Level l; Group g;
if (message.Split(' ').Length > 1)
{
if (message.Split(' ').Length > 2) { Help(p); return; }
l = Level.Find(message.Split(' ')[0]);
if (l == null) { Player.SendMessage(p, "Level could not be found."); return; }
g = Group.Find(message.Split(' ')[1]);
if (g == null) { Player.SendMessage(p, "Rank could not be found."); return; }
if (p.group.Permission < g.Permission && p != null) { Player.SendMessage(p, "Cannot change SpeedHack rank to a higher rank."); return; }
if (p.group.Permission < l.speedHackRank.Permission && p != null) { Player.SendMessage(p, "Cannot change SpeedHack rank of a higher rank."); return; }
l.speedHackRank = g;
l.Save();
Player.GlobalMessage("SpeedHack rank on " + l.name + " changed to " + g.name);
}
else
{
if (p == null) { Player.SendMessage(p, "Please specify a level if you are using this from Console."); return; }
l = p.level;
g = Group.Find(message);
if (g == null) { Player.SendMessage(p, "Rank could not be found."); return; }
if (p.group.Permission < g.Permission) { Player.SendMessage(p, "Cannot change SpeedHack rank to a higher rank."); return; }
if (p.group.Permission < l.speedHackRank.Permission) { Player.SendMessage(p, "Cannot change SpeedHack rank of a higher rank."); return; }
l.speedHackRank = g;
l.Save();
Player.GlobalMessage("SpeedHack rank on " + l.name + " changed to " + g.name);
}
}
示例13: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
if (!PlayerBot.ValidName(message)) { Player.SendMessage(p, "bot name " + message + " not valid!"); return; }
PlayerBot.playerbots.Add(new PlayerBot(message, p.level, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0));
//who.SendMessage("You were summoned by " + p.color + p.name + "&e.");
}
示例14: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
ushort xx, yy, zz; int foundBlocks = 0;
for (xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
for (yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
for (zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
if (p.level.GetTile(xx, yy, zz) != cpos.toIgnore) foundBlocks++;
}
Player.SendMessage(p, foundBlocks + " blocks are between (" + cpos.x + ", " + cpos.y + ", " + cpos.z + ") and (" + x + ", " + y + ", " + z + ")");
ushort xdiff = (ushort)((Math.Max(cpos.x, x)) - Math.Min(cpos.x, x));
ushort ydiff = (ushort)((Math.Max(cpos.y, y)) - Math.Min(cpos.y, y));
ushort zdiff = (ushort)((Math.Max(cpos.z, z)) - Math.Min(cpos.z, z));
Player.SendMessage(p, "The selected area was " + xdiff + " blocks wide, " + ydiff + " blocks high, " + zdiff + " blocks deep.");
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例15: Use
public override void Use(Player p, string message)
{
if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; }
Level foundLevel = Level.Find(message.Split(' ')[0]);
string newName = message.Split(' ')[1];
if (File.Exists("levels/" + newName)) { Player.SendMessage(p, "Level already exists."); return; }
if (foundLevel == Server.mainLevel) { Player.SendMessage(p, "Cannot rename the main level."); return; }
if (foundLevel != null) foundLevel.Unload();
try
{
File.Move("levels/" + foundLevel.name + ".lvl", "levels/" + newName + ".lvl");
try
{
File.Move("levels/level properties/" + foundLevel.name + ".properties", "levels/level properties/" + newName + ".properties");
}
catch { }
try
{
File.Move("levels/level properties/" + foundLevel.name, "levels/level properties/" + newName + ".properties");
}
catch { }
MySQL.executeQuery("RENAME TABLE `Block" + foundLevel.name.ToLower() + "` TO `Block" + newName.ToLower() +
"`, `Portals" + foundLevel.name.ToLower() + "` TO `Portals" + newName.ToLower() +
"`, `Messages" + foundLevel.name.ToLower() + "` TO Messages" + newName.ToLower() +
"`, `Commandblocks" + foundLevel.name.ToLower() + "` TO Commandblocks" + newName.ToLower() +
", `Zone" + foundLevel.name.ToLower() + "` TO `Zone" + newName.ToLower() + "`");
Player.GlobalMessage("Renamed " + foundLevel.name + " to " + newName);
}
catch (Exception e) { Player.SendMessage(p, "Error when renaming."); Server.ErrorLog(e); }
}