コード例 #1
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        internal static void Ignore(Player player, Command cmd)
        {
            string name = cmd.Next();

            if (name != null)
            {
                PlayerInfo targetInfo;
                if (!PlayerDB.FindPlayerInfo(name, out targetInfo))
                {
                    PlayerInfo[] infos = PlayerDB.FindPlayers(name);
                    if (infos.Length == 1)
                    {
                        targetInfo = infos[0];
                    }
                    else if (infos.Length > 1)
                    {
                        player.ManyMatchesMessage("player", infos);
                        return;
                    }
                    else
                    {
                        player.NoPlayerMessage(name);
                        return;
                    }
                }
                else if (targetInfo == null)
                {
                    player.NoPlayerMessage(name);
                    return;
                }
                if (player.Ignore(targetInfo))
                {
                    player.MessageNow("You are now ignoring {0}", targetInfo.GetClassyName());
                }
                else
                {
                    player.MessageNow("You are already ignoring {0}", targetInfo.GetClassyName());
                }
            }
            else
            {
                PlayerInfo[] ignoreList = player.GetIgnoreList();
                if (ignoreList.Length > 0)
                {
                    player.MessageNow("Ignored players: {0}", ignoreList.JoinToClassyString());
                }
                else
                {
                    player.MessageNow("You are not currently ignoring anyone.");
                }
                return;
            }
        }
コード例 #2
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        static void IgnoreHandler(Player player, CommandReader cmd)
        {
            string name = cmd.Next();

            if (name != null)
            {
                if (cmd.HasNext)
                {
                    CdIgnore.PrintUsage(player);
                    return;
                }
                PlayerInfo targetInfo = PlayerDB.FindByPartialNameOrPrintMatches(player, name);
                if (targetInfo == null)
                {
                    return;
                }

                if (targetInfo == player.Info)
                {
                    player.MessageNow("You cannot ignore yourself.");
                    return;
                }

                if (player.Ignore(targetInfo))
                {
                    player.MessageNow("You are now ignoring {0}", targetInfo.ClassyName);
                }
                else
                {
                    player.MessageNow("You are already ignoring {0}", targetInfo.ClassyName);
                }
            }
            else
            {
                PlayerInfo[] ignoreList = player.IgnoreList;
                if (ignoreList.Length > 0)
                {
                    player.MessageNow("Ignored players: {0}", ignoreList.JoinToClassyString());
                }
                else
                {
                    player.MessageNow("You are not currently ignoring anyone.");
                }
            }
        }
コード例 #3
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        static void IgnoreHandler([NotNull] Player player, [NotNull] CommandReader cmd)
        {
            string name = cmd.Next();

            if (name != null)
            {
                if (cmd.HasNext)
                {
                    // too many parameters given
                    CdIgnore.PrintUsage(player);
                    return;
                }
                // A name was given -- let's find the target
                PlayerInfo targetInfo = PlayerDB.FindPlayerInfoOrPrintMatches(player,
                                                                              name,
                                                                              SearchOptions.ReturnSelfIfOnlyMatch);
                if (targetInfo == null)
                {
                    return;
                }
                if (targetInfo == player.Info)
                {
                    player.Message("You cannot &H/Ignore&S yourself.");
                    return;
                }

                if (player.Ignore(targetInfo))
                {
                    player.MessageNow("You are now ignoring {0}", targetInfo.ClassyName);
                }
                else
                {
                    player.MessageNow("You are already ignoring {0}", targetInfo.ClassyName);
                }
            }
            else
            {
                ListIgnoredPlayers(player);
            }
        }
コード例 #4
0
        private static void IgnoreHandler(Player player, Command cmd)
        {
            string name = cmd.Next();

            if (name != null)
            {
                if (cmd.HasNext)
                {
                    CdIgnore.PrintUsage(player);
                    return;
                }
                PlayerInfo targetInfo = PlayerDB.FindPlayerInfoOrPrintMatches(player, name);
                if (targetInfo == null)
                {
                    return;
                }

                if (player.Ignore(targetInfo))
                {
                    player.MessageNow("&WYou are now ignoring {0}&W.", targetInfo.ClassyName);
                }
                else
                {
                    player.MessageNow("&SYou are already ignoring {0}&S.", targetInfo.ClassyName);
                }
            }
            else
            {
                PlayerInfo[] ignoreList = player.IgnoreList;
                if (ignoreList.Length > 0)
                {
                    player.MessageNow("&WIgnored players: {0}&W.", ignoreList.JoinToClassyString());
                }
                else
                {
                    player.MessageNow("&SYou are not currently ignoring anyone.");
                }
                return;
            }
        }
コード例 #5
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        static void IgnoreHandler( Player player, Command cmd ) {
            string name = cmd.Next();
            if( name != null ) {
                if( cmd.HasNext ) {
                    CdIgnore.PrintUsage( player );
                    return;
                }
                PlayerInfo targetInfo = PlayerDB.FindPlayerInfoOrPrintMatches( player, name );
                if( targetInfo == null ) return;

                if( player.Ignore( targetInfo ) ) {
                    player.MessageNow( "You are now ignoring {0}", targetInfo.ClassyName );
                } else {
                    player.MessageNow( "You are already ignoring {0}", targetInfo.ClassyName );
                }

            } else {
                PlayerInfo[] ignoreList = player.IgnoreList;
                if( ignoreList.Length > 0 ) {
                    player.MessageNow( "Ignored players: {0}", ignoreList.JoinToClassyString() );
                } else {
                    player.MessageNow( "You are not currently ignoring anyone." );
                }
                return;
            }
        }
コード例 #6
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        internal static void Ignore( Player player, Command cmd ) {
            string name = cmd.Next();
            if( name != null ) {
                PlayerInfo targetInfo;
                if( !PlayerDB.FindPlayerInfo( name, out targetInfo ) ) {
                    PlayerInfo[] infos = PlayerDB.FindPlayers( name );
                    if( infos.Length == 1 ) {
                        targetInfo = infos[0];
                    } else if( infos.Length > 1 ) {
                        player.ManyMatchesMessage( "player", infos );
                        return;
                    } else {
                        player.NoPlayerMessage( name );
                        return;
                    }
                } else if( targetInfo == null ) {
                    player.NoPlayerMessage( name );
                    return;
                }
                if( player.Ignore( targetInfo ) ) {
                    player.MessageNow( "You are now ignoring {0}", targetInfo.GetClassyName() );
                } else {
                    player.MessageNow( "You are already ignoring {0}", targetInfo.GetClassyName() );
                }

            } else {
                PlayerInfo[] ignoreList = player.GetIgnoreList();
                if( ignoreList.Length > 0 ) {
                    player.MessageNow( "Ignored players: {0}", ignoreList.JoinToClassyString() );
                } else {
                    player.MessageNow( "You are not currently ignoring anyone." );
                }
                return;
            }
        }
コード例 #7
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        static void IgnoreHandler( Player player, CommandReader cmd ) {
            string name = cmd.Next();
            if( name != null ) {
                if( cmd.HasNext ) {
                    // too many parameters given
                    CdIgnore.PrintUsage( player );
                    return;
                }
                // A name was given -- let's find the target
                PlayerInfo targetInfo = PlayerDB.FindPlayerInfoOrPrintMatches( player, name, SearchOptions.ReturnSelfIfNoMatches );
                if( targetInfo == null ) return;
                if( targetInfo == player.Info ) {
                    player.Message( "You cannot &H/Ignore&S yourself." );
                    return;
                }

                if( player.Ignore( targetInfo ) ) {
                    player.MessageNow( "You are now ignoring {0}", targetInfo.ClassyName );
                } else {
                    player.MessageNow( "You are already ignoring {0}", targetInfo.ClassyName );
                }

            } else {
                ListIgnoredPlayers( player );
            }
        }
コード例 #8
0
ファイル: ChatCommands.cs プロジェクト: Magi1053/ProCraft
        static void IgnoreHandler(Player player, CommandReader cmd) {
            string name = cmd.Next();
            if (!string.IsNullOrEmpty(name)) {
                if (name.ToLower() == "irc") {
                    if (player.Info.ReadIRC == true) {
                        player.Info.ReadIRC = false;
                        player.Message("You are now ignoring &iIRC");
                        string message = String.Format("\u212C&SPlayer {0}&S is now Ignoring IRC", player.ClassyName);
                        if (!player.Info.IsHidden) {
                            IRC.SendChannelMessage(message);
                        }
                    } else {
                        player.Message("You are already ignoring &iIRC");
                    }
                    return;
                }
                if (cmd.HasNext) {
                    CdIgnore.PrintUsage(player);
                    return;
                }
                PlayerInfo targetInfo = PlayerDB.FindPlayerInfoOrPrintMatches(player, name, SearchOptions.ReturnSelfIfOnlyMatch);
                if (targetInfo == null) return;

                if (player.Ignore(targetInfo)) {
                    player.Message("You are now ignoring {0}", targetInfo.ClassyName);
                } else {
                    player.Message("You are already ignoring {0}", targetInfo.ClassyName);
                }

            } else {
                PlayerInfo[] ignoreList = player.IgnoreList;
                if (ignoreList.Length > 0) {
                    player.Message("Ignored players: {0}", ignoreList.JoinToClassyString());
                } else {
                    player.Message("You are not currently ignoring anyone.");
                }
            }
        }