本文整理汇总了C#中MCSharp.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于MCSharp命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, string message)
{
if (message != "")
{
Player target = Player.Find(message);
if (target != null)
{
if (!target.hidden)
{
if (p.level != target.level)
{
target.ChangeLevel(p.level.name);
}
unchecked
{
target.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
}
target.SendMessage("You were summoned by " + p.color + p.name + "&e.");
}
else
{
p.SendMessage("There is no player \"" + message + "\"!");
}
}
else
{
p.SendMessage("There is no player \"" + message + "\"!");
}
}
else
{
Help(p);
}
}
示例2: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message == "")
{
playerList = "";
foreach (var pl in Player.players)
{
if (pl.hidden && p.Rank >= pl.Rank)
{
playerList += pl.color + pl.name + "&e, ";
}
}
if (playerList == "")
{
p.SendMessage("No one is currently hidden.");
}
else
{
p.SendMessage("Hidden Players: " + playerList.Trim(trimmings));
}
}
else
{
Help(p);
}
}
示例3: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message != "") // Exempt or remove from exempt
{
// Seperate message string
//int pos = message.IndexOf(' ');
string tempName = message.ToLower();
// If the name is in the file, remove it
if (Server.griefExempted.Contains(tempName))
{
Server.griefExempted.Remove(tempName);
p.SendMessage(tempName + " was " + c.red + "removed" + c.yellow + " from anti-grief exemption");
}
else
{
Server.griefExempted.Add(tempName);
p.SendMessage(tempName + " was " + c.green + "added" + c.yellow + " to anti-grief exemption");
}
}
else // Return usage
{
Help(p);
}
}
示例4: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
string strPlayers;
foreach (Map level in Server.levels)
{
strPlayers = "";
foreach (Player pl in Player.players)
{
if (!p.hidden || p.Rank > pl.Rank)
{
if (pl.level == level)
{
strPlayers += pl.color + pl.name + "&e, ";
}
}
}
if (strPlayers != "")
{
strPlayers = strPlayers.Remove(strPlayers.Length - 4);
}
else
{
strPlayers = "No players on this level";
}
p.SendMessage(player.level.name + ": " + strPlayers);
}
}
示例5: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message == "")
{
if (p.isWhisperChat)
{
p.SendMessage("Disable whisper chat before using /opchat"); // Think of maybe disabling it automatically?
}
else
{
p.isOpChat = !p.isOpChat;
if (p.isOpChat)
{
p.SendMessage("Operator chat: &aON&e.");
}
else
{
p.SendMessage("Operator chat: &cOFF&e.");
}
}
}
else
{
Help(p);
}
}
示例6: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message == "") // blank name, disable whispering
{
if (p.isWhisperChat)
{
p.SendMessage("No longer whispering: " + p.whisperTarget + ".");
p.isWhisperChat = false;
}
else
{
p.SendMessage("Whisper chat is already disabled.");
}
}
else if (p.isOpChat)
{
p.SendMessage("Disable opchat before using /whisper");
}
else
{
p.isWhisperChat = false;
Player target = Player.Find(message);
if (target != null)
{
p.whisperTarget = target.name;
p.isWhisperChat = true;
p.SendMessage("Now whispering: " + target.color + target.name + "&e.");
}
else
{
p.SendMessage(LanguageString.NoSuchPlayer);
}
}
}
示例7: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message == "")
{
string strModerators = "";
foreach (var pl in Player.players)
{
if (pl.Rank == GroupEnum.Operator && (!pl.hidden || p.Rank >= pl.Rank))
{
strModerators += pl.color + pl.name + ", ";
}
}
if (strModerators == "")
{
strModerators = "No moderators currently online";
}
else
{
strModerators = strModerators.Remove(strModerators.Length - 2);
}
p.SendMessage("Online Moderators: " + strModerators);
}
else
{
Help(p);
}
}
示例8: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
Regex regex = new Regex(@"^([0-9]{1,3}\.){3}[0-9]{1,3}$");
if (message == "") { if (p != null)Help(p); return; }
Player who = null;
who = Player.Find(message);
if (who != null) { message = who.ip; }
if (message.Equals("127.0.0.1")) { if (p != null) { p.SendMessage("You can't ip-ban the server!"); } return; }
if (!regex.IsMatch(message)) { if (p != null)p.SendMessage("Not a valid ip!"); return; }
if (p != null) { if (p.ip == message) { p.SendMessage("You can't ip-ban yourself.!"); return; } }
if (Server.bannedIP.Contains(message)) { if (p != null)p.SendMessage(message + " is already ip-banned."); return; }
Player.GlobalMessage(message + " got &8ip-banned&e!");
if (p != null)
{ IRCBot.Say("IP-BANNED: " + message.ToLower() + " by " + p.name); }
else
{ IRCBot.Say("IP-BANNED: " + message.ToLower() + " by console"); }
Server.bannedIP.Add(message);
Logger.Log("IP-BANNED: " + message.ToLower());
List<Player> kickList = new List<Player>();
foreach (Player pl in Player.players)
{
if (message.Equals(pl.ip)) { kickList.Add(pl); } //Kicks anyone off with matching ip for convinience
}
foreach (Player pl in kickList)
{
pl.Kick("Kicked by ipban");
}
}
示例9: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message != "")
{
Player target = Player.Find(message);
if (target == null || (target.hidden && p.Rank < target.Rank))
{
if (Player.left.ContainsKey(message.ToLower()))
{
string playerName = message.ToLower();
string ip = Player.left[playerName];
message = "&e" + playerName + " is " + Player.GetColor(playerName) + Player.GetGroup(playerName).Name + "&e.";
if (p.Rank >= GroupEnum.Operator)
{
message += " IP: " + ip + ".";
}
p.SendChat(p, message);
}
else
{
p.SendMessage("No entry found for \"" + message + "\".");
}
}
else
{
p.SendMessage(target.color + target.name + "&e is online, use /whois instead.");
}
}
else
{
Help(p);
}
}
示例10: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message != "")
{
Player target = Player.Find(message);
if (target == null)
{
if (Player.lastSeen.ContainsKey(message.ToLower()))
{
string lastOnline = message + " was last seen on: " + Player.lastSeen[message.ToLower()].ToLongDateString() + " at: " + Player.lastSeen[message.ToLower()].ToShortTimeString() + TimeZone.CurrentTimeZone.ToString();
p.SendMessage(lastOnline);
}
else
{
p.SendMessage("Player not found!");
}
}
else
{
if (target.hidden && p.Rank < target.Rank)
{
p.SendMessage("Player not found!");
}
else
{
p.SendMessage(target.name + " is currently playing!");
}
}
}
else
{
Help(p);
}
}
示例11: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message == "")
{
try
{
if (File.Exists("news.txt"))
{
List<string> news = new List<string>();
StreamReader wm = File.OpenText("news.txt");
while (!wm.EndOfStream)
news.Add(wm.ReadLine());
wm.Close();
foreach (string w in news)
p.SendMessage(w);
}
else
{
p.SendMessage("No news today!");
}
}
catch
{
Logger.Log("Error reading news.txt");
}
}
else
{
Help(p);
}
}
示例12: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message == "")
{
// Toggle OFF
if (p.BlockAction == 8)
{
p.BlockAction = 0;
p.SendMessage("BuildOp mode: &cOFF&e.");
}
else // Toggle ON
{
// Disable painting
p.painting = false;
// Clear all bindings, creates faulty blocks otherwise
int bindCount = p.ClearBindings();
// Set the block action to buildop
p.BlockAction = 8;
if (bindCount > 0)
{
p.SendMessage("Cleared " + bindCount + " block bind(s).");
}
p.SendMessage("BuildOp Mode: &aON&e. Now Placing op_materials");
}
}
else
{
Help(p);
}
}
示例13: SendRules
/// <summary>
/// Sends the rules to a target player
/// </summary>
/// <param name="target">Target player that rules are being sent to.</param>
private void SendRules(Player target)
{
try
{
if (target.level == Server.mainLevel && Server.mainLevel.permissionbuild == LevelPermission.Guest)
{
target.SendMessage("You are currently on the guest map where anyone can build");
}
List<string> rules = new List<string>();
// Read in rules
StreamReader r = File.OpenText("rules.txt");
while (!r.EndOfStream)
rules.Add(r.ReadLine());
r.Close();
// Send the user the rules
target.SendMessage("Server Rules:");
foreach (string rule in rules)
target.SendMessage(rule);
}
catch
{
Logger.Log("Error reading rules.txt in SendRules()", LogType.Error);
}
}
示例14: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message == "")
{
string strOperators = "";
Player.players.ForEach(delegate(Player pl)
{
if (pl.Rank == GroupEnum.Operator && (!pl.hidden || p.Rank >= pl.Rank))
{
strOperators += pl.color + pl.name + ", ";
}
});
if (strOperators == "")
{
strOperators = "No operators currently online";
}
else
{
strOperators = strOperators.Remove(strOperators.Length - 2);
}
p.SendMessage("Online Operators: " + strOperators);
}
else
{
Help(p);
}
}
示例15: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message == "")
{
p.SendMessage("Currently on &b" + p.level.name + "&e X:" + p.level.width.ToString() + " Y:" + p.level.depth.ToString() + " Z:" + p.level.height.ToString());
switch (p.level.Physics)
{
case Physics.Off:
p.SendMessage("Physics is &cOFF&e.");
break;
case Physics.Normal:
p.SendMessage("Physics is &aNormal&e.");
break;
case Physics.Advanced:
p.SendMessage("Physics is &aAdvanced&e.");
break;
}
p.SendMessage("Build rank = " + Map.PermissionToName(p.level.permissionbuild) + " : Visit rank = " + Map.PermissionToName(p.level.permissionvisit) + ".");
}
else
{
Help(p);
}
}