Advertisement
AFKGames

Fixed /xban

Dec 20th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MCForge.Commands
  4. {
  5.    public class CmdXBan : Command
  6.    {
  7.  
  8.       public override string name { get { return "xban"; } }
  9.       public override string shortcut { get { return ""; } }
  10.       public override string type { get { return ""; } }  
  11.       public override bool museumUsable { get { return false; } }
  12.       public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
  13.       public override void Use(Player p, string message)
  14.       {
  15.             //Find the player from the message.
  16.         Player who = Player.Find(message);
  17.            
  18.         //If the player is not online, send error message.
  19.             if (who == null)
  20.             {
  21.             Player.Sendmessage("%cError:" + Server.DefaultColor + "Player is not online");
  22.             return;
  23.             }
  24.             else
  25.         {
  26.                
  27.         //If the who player specified is a higher rank than you, send error message.
  28.         if (who.group.Permission > p.group.Permission)
  29.                 {
  30.                     Player.SendMessage(p, "You can't xban someone of equal or higher rank");
  31.                     return;
  32.                 }
  33.                 else
  34.         {          
  35.                  //Use commands to xban player, eg Undo and ban.
  36.              Command.all.Find("undo").Use(p, who.name + " 99999999");
  37.                  Command.all.Find("ban").Use(p, who.name);
  38.                      Command.all.Find("banip").Use(p, who.ip);
  39.                  Command.all.Find("kick").Use(p, who.name);
  40.                 }
  41.            
  42.             }
  43.          
  44.       }
  45.  
  46.       public override void Help(Player p)
  47.       {
  48.              Player.SendMessage(p, "/Xban - Bans and ipbans a player aswell as undoing their actions");
  49.       }
  50.  
  51.    }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement