コード例 #1
0
ファイル: PluginCommand.cs プロジェクト: Mitch528/BukkitNET
        public override bool Execute(ICommandSender sender, string commandLabel, string[] args)
        {
            bool success = false;

            if (!owningPlugin.IsEnabled())
            {
                return(false);
            }

            if (!TestPermission(sender))
            {
                return(true);
            }

            try
            {
                success = executor.OnCommand(sender, this, commandLabel, args);
            }
            catch (Exception ex)
            {
                throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + owningPlugin.GetPluginInfo().FullName, ex);
            }

            if (!success && usageMessage.Length > 0)
            {
                foreach (string line in usageMessage.Replace("<command>", commandLabel).Split('\n'))
                {
                    sender.SendMessage(line);
                }
            }

            return(success);
        }