本文整理汇总了C#中MCSong.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于MCSong命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, string message)
{
Player pl = Player.Find(message);
if (message == "") { Help(p); return; }
if (p == null)
{
if (pl == null) { Player.SendMessage(p, "Player \"" + message + "\"not found!"); return; }
if (!pl.warned) { Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " has not been warned!"); return; }
pl.warned = false;
Player.SendMessage(pl, "Unwarned by &cConsole");
Player.GlobalMessageOps("To Ops" + c.white + " - " + pl.color + pl.name + c.white + " was unwarned by &aConsole");
Server.s.Log(pl.name + " was unwarned by Console");
}
else
{
if (pl == null) { Player.SendMessage(p, "Player \"" + message + "\"not found!"); return; }
if (pl == p) { Player.SendMessage(p, "You cannot unwarn yourself!"); return; }
if (p.warned) { Player.SendMessage(p, "You cannot unwarn a player if you are warned!"); return; }
if (p.group.Permission <= pl.group.Permission) { Player.SendMessage(p, "You can't unwarn a player of an equal or higher rank!"); return; }
if (!pl.warned) { Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " has not been warned!"); return; }
pl.warned = false;
Player.SendMessage(pl, "Unwarned by " + p.color + p.name);
Player.GlobalMessageOps("To Ops" + c.white + " - " + pl.color + pl.name + c.white + " was unwarned by " + p.color + p.name);
Server.s.Log(pl.name + " was unwarned by " + p.name);
if (p.group.Permission < Server.opchatperm)
{
Player.SendMessage(p, pl.color + pl.name + c.white + "was unwarned by " + p.color + p.name);
}
}
}
示例2: Use
public override void Use(Player p, string message)
{
string[] parameters = message.Split(' ');
ushort[] click = p.lastClick;
if (message.IndexOf(' ') != -1)
{
if (parameters.Length != 3)
{
Help(p);
return;
}
else
{
for (int value = 0; value < 3; value++)
{
if (parameters[value].ToLower() == "x" || parameters[value].ToLower() == "y" || parameters[value].ToLower() == "z")
click[value] = p.lastClick[value];
else if (isValid(parameters[value], value, p))
click[value] = ushort.Parse(parameters[value]);
else
{
Player.SendMessage(p, "\"" + parameters[value] + "\" was not valid");
return;
}
}
}
}
p.manualChange(click[0], click[1], click[2], 0, Block.rock);
Player.SendMessage(p, "Clicked &b(" + click[0] + ", " + click[1] + ", " + click[2] + ")");
}
示例3: Use
public override void Use(Player p, string message)
{
if (p == null) { Player.SendMessage(p, "Command not useable from console"); return; }
if (p.level != Level.FindExact(p.name)) { Player.SendMessage(p, "You must be at your home to use this command"); return; }
Player pl = Player.Find(message.Split(' ')[0]);
Level lvl = Level.FindExact(p.name);
if (message.Split(' ')[1].Trim().ToLower() == "del")
{
if (pl == p) { Player.SendMessage(p, "You cannot disallow yourself from building in your home!"); return; }
p.level.ZoneList.ForEach(delegate(Level.Zone Zn)
{
if (Zn.Owner.Trim().ToLower() == Player.Find(message).name.Trim().ToLower())
{
MySQL.executeQuery("DELETE FROM `Zone" + lvl.name + "` WHERE Owner='" + Zn.Owner + "' AND SmallX='" + Zn.smallX + "' AND SMALLY='" + Zn.smallY + "' AND SMALLZ='" + Zn.smallZ + "' AND BIGX='" + Zn.bigX + "' AND BIGY='" + Zn.bigY + "' AND BIGZ='" + Zn.bigZ + "'");
lvl.ZoneList.Remove(Zn);
Player.SendMessage(p, "Removed zone for " + pl.name);
}
});
return;
}
Level.Zone zn;
zn.smallX = 0;
zn.smallY = 0;
zn.smallZ = 0;
zn.bigX = Convert.ToUInt16(lvl.width - 1);
zn.bigY = Convert.ToUInt16(lvl.height - 1);
zn.bigZ = Convert.ToUInt16(lvl.depth - 1);
zn.Owner = pl.name;
lvl.ZoneList.Add(zn);
MySQL.executeQuery("INSERT INTO `Zone" + lvl.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + zn.smallX + ", " + zn.smallY + ", " + zn.smallZ + ", " + zn.bigX + ", " + zn.bigY + ", " + zn.bigZ + ", '" + zn.Owner + "')");
Player.SendMessage(p, "Zoned entire map for " + pl.name);
}
示例4: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
if (message.ToLower() == "all")
{
foreach (Player pl in Player.players)
{
if (pl.level == p.level && pl != p)
{
unchecked { pl.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); }
pl.SendMessage("You were summoned by " + p.color + p.name + Server.DefaultColor + ".");
}
}
return;
}
Player who = Player.Find(message);
if (who == null || who.hidden) { Player.SendMessage(p, "There is no player \"" + message + "\"!"); return; }
if (p.level != who.level)
{
if (p.level.locked) { Player.SendMessage(p, "You can't summon players to a locked map!"); return; }
Player.SendMessage(p, who.name + " is in a different level.");
Player.SendMessage(p, "Force-fetching has started...");
who.ignorePermission = true;
Command.all.Find("goto").Use(who, p.level.name);
who.ignorePermission = false;
unchecked { who.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); }
Player.SendMessage(who, "You were summoned by " + p.color + p.name + Server.DefaultColor + ".");
return;
}
unchecked { who.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); }
who.SendMessage("You were summoned by " + p.color + p.name + Server.DefaultColor + ".");
}
示例5: Help
public override void Help(Player p)
{
Player.SendMessage(p, "/save - Saves the level you are currently in");
Player.SendMessage(p, "/save all - Saves all loaded levels.");
Player.SendMessage(p, "/save <map> - Saves the specified map.");
Player.SendMessage(p, "/save <map> <name> - Backups the map with a given restore name");
}
示例6: Use
public override void Use(Player p, string message)
{
if ((message.ToLower() == "create" || message.ToLower() == "") && p != null)
{
p.level.jailx = p.pos[0]; p.level.jaily = p.pos[1]; p.level.jailz = p.pos[2];
p.level.jailrotx = p.rot[0]; p.level.jailroty = p.rot[1];
Player.SendMessage(p, "Set Jail point.");
}
else
{
Player who = Player.Find(message);
if (who != null)
{
if (!who.jailed)
{
if (p != null) if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot jail someone of equal or greater rank."); return; }
if (who.level != p.level) Command.all.Find("goto").Use(who, p.level.name);
Player.GlobalDie(who, false);
Player.GlobalSpawn(who, p.level.jailx, p.level.jaily, p.level.jailz, p.level.jailrotx, p.level.jailroty, true);
who.jailed = true;
Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " was &8jailed", false);
}
else
{
who.jailed = false;
Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " was &afreed" + Server.DefaultColor + " from jail", false);
}
}
else
{
Player.SendMessage(p, "Could not find specified player.");
}
}
}
示例7: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
string fileName;
fileName = "extra/import/" + message + ".dat";
if (!Directory.Exists("extra/import")) Directory.CreateDirectory("extra/import");
if (!File.Exists(fileName))
{
Player.SendMessage(p, "Could not find .dat file");
return;
}
FileStream fs = File.OpenRead(fileName);
if (ConvertDat.Load(fs, message) != null)
{
Player.SendMessage(p, "Converted map!");
}
else
{
Player.SendMessage(p, "The map conversion failed.");
return;
}
fs.Close();
Command.all.Find("load").Use(p, message);
}
示例8: Use
public override void Use(Player p, string message)
{
if (message.Split(' ').Length > 1) { Help(p); return; }
if (p.BlockAction == 13 || p.BlockAction == 14)
{
p.BlockAction = 0; Player.SendMessage(p, "TNT mode is now &cOFF" + Server.DefaultColor + ".");
}
else if (message.ToLower() == "small" || message == "")
{
p.BlockAction = 13; Player.SendMessage(p, "TNT mode is now &aON" + Server.DefaultColor + ".");
}
else if (message.ToLower() == "big")
{
if (p.group.Permission > LevelPermission.AdvBuilder)
{
p.BlockAction = 14; Player.SendMessage(p, "TNT mode is now &aON" + Server.DefaultColor + ".");
}
else
{
Player.SendMessage(p, "This mode is reserved for OPs");
}
}
else
{
Help(p);
}
p.painting = false;
}
示例9: 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.");
}
示例10: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
Player who = Player.Find(message);
if (who == null)
{
Player.SendMessage(p, "Could not find player specified");
return;
}
ushort currentX = (ushort)(who.pos[0] / 32);
ushort currentY = (ushort)(who.pos[1] / 32);
ushort currentZ = (ushort)(who.pos[2] / 32);
ushort foundHeight = 0;
for (ushort yy = currentY; yy <= 1000; yy++)
{
if (!Block.Walkthrough(p.level.GetTile(currentX, yy, currentZ)) && p.level.GetTile(currentX, yy, currentZ) != Block.Zero)
{
foundHeight = (ushort)(yy - 1);
who.level.ChatLevel(who.color + who.name + Server.DefaultColor + " was slapped into the roof by " + p.color + p.name);
break;
}
}
if (foundHeight == 0)
{
who.level.ChatLevel(who.color + who.name + Server.DefaultColor + " was slapped sky high by " + p.color + p.name);
foundHeight = 1000;
}
unchecked { who.SendPos((byte)-1, who.pos[0], (ushort)(foundHeight * 32), who.pos[2], who.rot[0], who.rot[1]); }
}
示例11: Use
public override void Use(Player p, string message)
{
if (message != "") { Help(p); return; }
p.painting = !p.painting; if (p.painting) { Player.SendMessage(p, "Painting mode: &aON" + Server.DefaultColor + "."); }
else { Player.SendMessage(p, "Painting mode: &cOFF" + Server.DefaultColor + "."); }
p.BlockAction = 0;
}
示例12: Use
public override void Use(Player p, string message)
{
if (message != "")
{
Help(p);
return;
}
else
{
string hasirc;
string ircdetails = "";
if (Server.irc)
{
hasirc = "&aEnabled" + Server.DefaultColor + ".";
ircdetails = Server.ircServer + " > " + Server.ircChannel;
}
else
{
hasirc = "&cDisabled" + Server.DefaultColor + ".";
}
Player.SendMessage(p, "IRC is " + hasirc);
if (ircdetails != "")
{
Player.SendMessage(p, "Location: " + ircdetails);
}
}
}
示例13: Use
public override void Use(Player p, string message)
{
if (p == null) { Player.SendMessage(p, "Command not useable from console"); return; }
if (p.level != Level.FindExact(p.name)) { Player.SendMessage(p, "You must be at your home to use this command"); return; }
int totalFixed = 0;
for (int i = 0; i < p.level.blocks.Length; i++)
{
try
{
ushort x, y, z;
p.level.IntToPos(i, out x, out y, out z);
if (p.level.blocks[i] == Block.dirt)
{
if (Block.LightPass(p.level.blocks[p.level.IntOffset(i, 0, 1, 0)]))
{
p.level.Blockchange(p, x, y, z, Block.grass);
totalFixed++;
}
}
else if (p.level.blocks[i] == Block.grass)
{
if (!Block.LightPass(p.level.blocks[p.level.IntOffset(i, 0, 1, 0)]))
{
p.level.Blockchange(p, x, y, z, Block.dirt);
totalFixed++;
}
}
}
catch { }
}
Player.SendMessage(p, "Fixed " + totalFixed + " blocks.");
}
示例14: 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() +
", `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); }
}
示例15: Use
public override void Use(Player p, string message)
{
if (Server.PCCounter == null)
{
Player.SendMessage(p, "Starting PCCounter...one second");
Server.PCCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
Server.PCCounter.BeginInit();
Server.PCCounter.NextValue();
}
if (Server.ProcessCounter == null)
{
Player.SendMessage(p, "Starting ProcessCounter...one second");
Server.ProcessCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
Server.ProcessCounter.BeginInit();
Server.ProcessCounter.NextValue();
}
TimeSpan tp = Process.GetCurrentProcess().TotalProcessorTime;
TimeSpan up = (DateTime.Now - Process.GetCurrentProcess().StartTime);
//To get actual CPU% is OS dependant
string ProcessorUsage = "CPU Usage (Processes : All Processes):" + Server.ProcessCounter.NextValue() + " : " + Server.PCCounter.NextValue();
//Alternative Average?
//string ProcessorUsage = "CPU Usage is Not Implemented: So here is ProcessUsageTime/ProcessTotalTime:"+String.Format("00.00",(((tp.Ticks/up.Ticks))*100))+"%";
//reports Private Bytes because it is what the process has reserved for itself and is unsharable
string MemoryUsage = "Memory Usage: " + Math.Round((double)Process.GetCurrentProcess().PrivateMemorySize64 / 1048576).ToString() + " Megabytes";
string Uptime = "Uptime: " + up.Days + " Days " + up.Hours + " Hours " + up.Minutes + " Minutes " + up.Seconds + " Seconds";
string Threads = "Threads: " + Process.GetCurrentProcess().Threads.Count;
Player.SendMessage(p, Uptime);
Player.SendMessage(p, MemoryUsage);
Player.SendMessage(p, ProcessorUsage);
Player.SendMessage(p, Threads);
}