void wrap_ChatCommand(Player player, string cmd, string[] args) { if (cmd == "give" || cmd == "#") { if ((player.Permissions & PermissionsMask.Give) != PermissionsMask.Give) { wrap.Say("You do not have permission to execute this command, peasant."); return; } if (args.Length < 1) { wrap.Say("Syntax: !{0} ID [Number]"); return; } byte num = 1; short item = 0; if (!short.TryParse(args[0], out item)) { wrap.Say("Failed to parse argument #1, which should be a number between 1 and " + short.MaxValue.ToString() + "."); return; } if (args.Length == 2) { if (!byte.TryParse(args[1], out num)) { wrap.Say("Failed to parse argument #2, which should be a number between 1 and 64."); return; } } wrap.Give(player.Name, item, num); } }
void wrap_ChatCommand(Player player, string cmd, string[] args) { if (cmd == "who") { string[] p = new string[wrap.CurrentPlayers.Count]; int i = 0; foreach (KeyValuePair <string, string> kvp in wrap.CurrentPlayers) { p[i++] = kvp.Key; } wrap.Say(string.Join(", ", p)); } }
void wrap_ChatCommand(Player player, string cmd, string[] args) { if (cmd == "ban" || cmd == "b") { if ((player.Permissions & PermissionsMask.Ban) != PermissionsMask.Ban) { wrap.Say("You do not have permission to execute this command, peasant."); return; } if (args.Length < 1) { wrap.Say("Syntax: !ban UserName"); return; } wrap.Say(string.Format("{0} banned {1} from the server.", player.Name, args[0])); wrap.Ban(args[0]); wrap.Kick(args[0]); } if (cmd == "unban") { if ((player.Permissions & PermissionsMask.Ban) != PermissionsMask.Ban) { wrap.Say("You do not have permission to execute this command, peasant."); return; } if (args.Length < 1) { wrap.Say("Syntax: !unban UserName"); return; } wrap.Say(string.Format("{0} unbanned {1} from the server.", player.Name, args[0])); wrap.Unban(args[0]); } if (cmd == "kick") { if ((player.Permissions & PermissionsMask.Kick) != PermissionsMask.Kick) { wrap.Say("You do not have permission to execute this command, peasant."); return; } if (args.Length < 1) { wrap.Say("Syntax: !kick UserName"); return; } wrap.Kick(args[0]); } }