本文整理汇总了C#中Player.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendMessage方法的具体用法?C# Player.SendMessage怎么用?C# Player.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.SendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(Player p, string[] args)
{
if (args.Length == 0) { p.SendMessage("You have to specify a message!"); return; }
string message = null;
foreach (string s in args) { message += s + " "; }
Player.UniversalChat(message);
}
示例2: Use
public override void Use(Player p, string message)
{
if (message != "")
{
if (!Server.voting)
{
string temp = message.Substring(0, 1) == "%" ? "" : Server.DefaultColor;
Server.voting = true;
Server.NoVotes = 0;
Server.YesVotes = 0;
Player.GlobalMessage(" " + c.green + "VOTE: " + temp + message + "(" + c.green + "Yes " + Server.DefaultColor + "/" + c.red + "No" + Server.DefaultColor + ")");
System.Threading.Thread.Sleep(15000);
Server.voting = false;
Player.GlobalMessage("The vote is in! " + c.green + "Y: " + Server.YesVotes + c.red + " N: " + Server.NoVotes);
Player.players.ForEach(delegate(Player winners)
{
winners.voted = false;
});
}
else
{
p.SendMessage("A vote is in progress!");
}
}
else
{
Help(p);
}
}
示例3: Use
public override void Use(Player p, params string[] args)
{
if (args.Length == 0) { Help(p); return; }
else if (args.Length == 1)
{
Random rand = new Random();
int seed = new Random().Next();
p.SendMessage("Creating world with seed: " + seed);
double x = 0; double y = 127; double z = 0;
World temp = new World(x, y, z, args[0], seed);
//while (Chunk.GetChunk((int)x, (int)z, temp).GetBlock((int)x, (int)(y - 1), (int)z) == 0)
// y--;
temp.SpawnY = y;
World.worlds.Add(temp);
p.SendMessage("World " + args[0] + " MADE!");
}
else if (args.Length == 2 || args.Length == 3)
{
int seed = Convert.ToInt32(args[1]);
p.SendMessage("Creating world with seed: " + seed);
double x = 0; double y = 127; double z = 0;
World temp = new World(x, y, z, args[0], seed);
if (args.Length == 3)
{
int limit = Convert.ToInt32(args[2]);
if (limit > 2)
temp.ChunkLimit = limit;
else { p.SendMessage("maxchunks cannot be less than 3. creating with maxchunks 3."); temp.ChunkLimit = 3; }
}
World.worlds.Add(temp);
p.SendMessage("World " + args[0] + " MADE!");
}
}
示例4: Help
public void Help(Player p)
{
p.SendMessage("/notify [user] <message> - Sends a message up the top right corner to WoM users.");
p.SendMessage("If no user is specified the message is sent to yourself.");
p.SendMessage("Supported users: [all], a specified level, or a specified player.");
p.SendMessage("Shortcuts: /alert");
}
示例5: Help
public override void Help(Player p)
{
p.SendMessage("/red - joins the red team.");
p.SendMessage("&cThese require Op+:");
p.SendMessage("/red spawn - sets the red teams spawn location for that map.");
p.SendMessage("/red flag - sets the red teams flag location for that map.");
}
示例6: Use
public override void Use(Player p, string message)
{
int number = message.Split(' ').Length;
if (number > 2) { Help(p); return; }
if (number == 2)
{
Server.s.Log(message);
string t = message.Split(' ')[0];
string s = message.Split(' ')[1];
if (t == "zombie")
{
bool asdfasdf = false;
Player.players.ForEach(delegate(Player player)
{
if (player.name == s)
{
p.SendMessage(s + " was queued.");
Server.queZombie = true;
Server.nextZombie = s;
asdfasdf = true;
return;
}
});
if (!asdfasdf)
{
p.SendMessage(s + " is not online.");
return;
}
}
else if (t == "level")
{
bool yes = false;
DirectoryInfo di = new DirectoryInfo("levels/");
FileInfo[] fi = di.GetFiles("*.lvl");
foreach (FileInfo file in fi)
{
if (file.Name.Replace(".lvl", "").ToLower().Equals(s.ToLower()))
{
yes = true;
}
}
if (yes)
{
p.SendMessage(s + " was queued.");
Server.queLevel = true;
Server.nextLevel = s.ToLower();
return;
}
else
{
p.SendMessage("Level does not exist.");
return;
}
}
else
{
p.SendMessage("You did not enter a valid option.");
}
}
}
示例7: Use
public override void Use(Player p, params string[] args)
{
p.SendMessage("Relighting all chunks! Please wait...", WrapMethod.Chat);
foreach (Chunk c in p.level.chunkData.Values.ToArray())
c.RecalculateLight();
p.SendMessage("Done!");
Command.all.Find("reveal").Use(p, "all");
}
示例8: HandleCommand
public void HandleCommand(UserManager<User> userManager, string message, Player player)
{
try
{
string commandText = message.Split(' ')[0];
message = message.Replace(commandText, "").Trim();
commandText = commandText.Replace("/", "").Replace(".", "");
string[] arguments = message.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
List<CommandAttribute> foundCommands = new List<CommandAttribute>();
foreach (var handlerEntry in _pluginCommands)
{
CommandAttribute commandAttribute = handlerEntry.Value;
if (!commandText.Equals(commandAttribute.Command, StringComparison.InvariantCultureIgnoreCase)) continue;
MethodInfo method = handlerEntry.Key;
if (method == null) return;
foundCommands.Add(commandAttribute);
var authorizationAttributes = method.GetCustomAttributes<AuthorizeAttribute>(true);
foreach (AuthorizeAttribute authorizationAttribute in authorizationAttributes)
{
if (userManager == null)
{
player.SendMessage($"UserManager not found. You are not permitted to use this command!");
return;
}
User user = userManager.FindByName(player.Username);
if (user == null)
{
player.SendMessage($"No registered user '{player.Username}' found. You are not permitted to use this command!");
return;
}
var userIdentity = userManager.CreateIdentity(user, "none");
if (!authorizationAttribute.OnAuthorization(new GenericPrincipal(userIdentity, new string[0])))
{
player.SendMessage("You are not permitted to use this command!");
return;
}
}
if (ExecuteCommand(method, player, arguments)) return;
}
foreach (var commandAttribute in foundCommands)
{
player.SendMessage($"Usage: {commandAttribute.Usage}");
}
}
catch (Exception ex)
{
Log.Warn(ex);
}
}
示例9: Use
public override void Use(Player p, string message)
{
if (!SharpControl.teleporting)
{
if (message == null || message == "") { Help(p); return; }
if (message == "stop")
{
if (!SharpControl.walkbool)
{
p.SendMessage(SharpControl.p.UserName + " isn't walking! You can't stop it."); return;
}
SharpControl.walkbool = false;
}
else
{
if (SharpControl.walkbool) { p.SendMessage(SharpControl.p.UserName + " is already walking. Stop with !walk stop."); return; }
int speedvar;
try { speedvar = Convert.ToInt32(message); }
catch { Help(p); return; }
if (speedvar < 1 || speedvar > 5) { p.SendMessage("Speed must be in between 1 and 5"); return; }
SharpControl.walkbool = true;
switch (speedvar)
{
case 1:
Thread walkinf500 = new Thread(new ThreadStart(() => WalkInf(500)));
walkinf500.IsBackground = true;
walkinf500.Start();
break;
case 2:
Thread walkinf400 = new Thread(new ThreadStart(() => WalkInf(400)));
walkinf400.IsBackground = true;
walkinf400.Start();
break;
case 3:
Thread walkinf300 = new Thread(new ThreadStart(() => WalkInf(300)));
walkinf300.IsBackground = true;
walkinf300.Start();
break;
case 4:
Thread walkinf200 = new Thread(new ThreadStart(() => WalkInf(200)));
walkinf200.IsBackground = true;
walkinf200.Start();
break;
case 5:
Thread walkinf100 = new Thread(new ThreadStart(() => WalkInf(100)));
walkinf100.IsBackground = true;
walkinf100.Start();
break;
}
}
}
else
{
p.SendMessage("Can't move while teleporting!");
}
}
示例10: BC1
public void BC1(Player p, BlockChangeEventArgs args)
{
p.ExtraData["Mark1"] = new Vector3S(args.X, args.Z, args.Y);
p.SendMessage("First coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")");
args.Unregister();
args.Cancel();
p.SendMessage("Break or place a block to select the second point.");
p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(BC2);
}
示例11: Use
public override void Use(Player p, string message)
{
p.flipHead = !p.flipHead;
if (p.flipHead)
p.SendMessage("Your head was broken!");
else
p.SendMessage("Your head was healed!");
}
示例12: Blockchange
public void Blockchange(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
Block b = Program.mainLevel.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b.type);
if (b == null) { p.SendMessage("No edits found for (" + x + "," + y + "," + z + ")."); return; }
//if (b.lastaction.Count == 0) { p.SendMessage("No edits found for (" + x + "," + y + "," + z + ")."); return; }
p.SendMessage("Last edits of (" + x + "," + y + "," + z + "):");
//b.lastaction.ForEach(delegate(Edit e) { p.SendMessage("> " + Player.GetColor(e.from) + e.from + ":&e " + e.before + " => " + e.after); });
}
示例13: Blockchange1
void Blockchange1(Player p, int x, int y, int z, short type)
{
p.ClearBlockChange();
p.SendBlockChange(x, (byte)y, z, p.level.GetBlock(x, y, z), p.level.GetMeta(x, y, z));
p.SendMessage("Position: " + x + "," + y + "," + z);
p.SendMessage("Type: " + p.level.GetBlock(x, y, z));
p.SendMessage("Meta: " + p.level.GetMeta(x, y, z));
p.SendMessage("Extra: " + p.level.GetExtra(x, y, z));
}
示例14: Use
public override void Use(Player p, params string[] args)
{
World.worlds.ForEach(delegate(World w)
{
p.SendMessage(w.name);
p.SendMessage("Chunks: " + w.chunkData.Count);
p.SendMessage("Physics: " + w.physics.CheckCount);
p.SendMessage("Updates: " + w.physics.UpdateCount);
});
}
示例15: SendChatMessage
public void SendChatMessage(Player player, string name, string message = null)
{
if (message != null)
player.SendMessage($"{name}: {message}");
else
{
message = name;
player.SendMessage(message);
}
}