本文整理汇总了C#中MCSong.Player.SetPrefix方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SetPrefix方法的具体用法?C# Player.SetPrefix怎么用?C# Player.SetPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCSong.Player
的用法示例。
在下文中一共展示了Player.SetPrefix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, string message)
{
if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Colors!"); return; }
if (message == "" || message.Split(' ').Length > 2) { Help(p); return; }
int pos = message.IndexOf(' ');
if (pos != -1)
{
Player who = Player.Find(message.Substring(0, pos));
if (who == null) { Player.SendMessage(p, "There is no player \"" + message.Substring(0, pos) + "\"!"); return; }
if (message.Substring(pos + 1) == "del")
{
MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + who.name + "'");
Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color reverted to " + who.group.color + "their group's default" + Server.DefaultColor + ".", false);
who.color = who.group.color;
Player.GlobalDie(who, false);
Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
who.SetPrefix();
return;
}
string color = c.Parse(message.Substring(pos + 1));
if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); }
else if (color == who.color) { Player.SendMessage(p, who.name + " already has that color."); }
else
{
//Player.GlobalChat(who, p.color + "*" + p.name + "&e changed " + who.color + Name(who.name) +
// " color to " + color +
// c.Name(color) + "&e.", false);
MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + who.name + "'");
Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
who.color = color;
Player.GlobalDie(who, false);
Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
who.SetPrefix();
}
}
else
{
if (message == "del")
{
MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + p.name + "'");
Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color reverted to " + p.group.color + "their group's default" + Server.DefaultColor + ".", false);
p.color = p.group.color;
Player.GlobalDie(p, false);
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
p.SetPrefix();
return;
}
string color = c.Parse(message);
if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); }
else if (color == p.color) { Player.SendMessage(p, "You already have that color."); }
else
{
MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + p.name + "'");
Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
p.color = color;
Player.GlobalDie(p, false);
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
p.SetPrefix();
}
}
}