当前位置: 首页>>代码示例>>C#>>正文


C# Player.Confirm方法代码示例

本文整理汇总了C#中fCraft.Player.Confirm方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Confirm方法的具体用法?C# Player.Confirm怎么用?C# Player.Confirm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fCraft.Player的用法示例。


在下文中一共展示了Player.Confirm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WorldBringHandler

        static void WorldBringHandler( Player player, CommandReader cmd ) {
            string playerName = cmd.Next();
            string worldName = cmd.Next();
            if( playerName == null || worldName == null ) {
                CdWorldBring.PrintUsage( player );
                return;
            }

            Player target = Server.FindPlayerOrPrintMatches(player, playerName, SearchOptions.Default);
            World world = WorldManager.FindWorldOrPrintMatches( player, worldName );

            if( target == null || world == null ) return;

            if (target == player)
            {
                player.Message( "&WYou cannot &H/WBring&W yourself." );
                return;
            }

            if( !player.Can( Permission.Bring, target.Info.Rank ) ) {
                player.Message( "You may only bring players ranked {0}&S or lower.",
                                player.Info.Rank.GetLimit( Permission.Bring ).ClassyName );
                player.Message( "{0}&S is ranked {1}",
                                target.ClassyName, target.Info.Rank.ClassyName );
                return;
            }

            if( world == target.World ) {
                player.Message( "{0}&S is already in world {1}&S. They were brought to spawn.",
								target.ClassyName, world.ClassyName);

				if (target.World != null) {
					target.LastWorld = target.World;
					target.LastPosition = target.Position;
				}
                target.TeleportTo( target.WorldMap.Spawn );
                return;
            }

            SecurityCheckResult check = world.AccessSecurity.CheckDetailed( target.Info );
            if( check == SecurityCheckResult.RankTooLow ) {
                if( player.CanJoin( world ) ) {
                    if( cmd.IsConfirmed ) {
                        BringPlayerToWorld( player, target, world, true, false );
                    } else {
                        //Allow banned players to be moved about...
                        if (target.Info.Rank.Name == "Banned")
                        {
                            player.Message("&sYou CAN move banned players about... It is considered bad form though...");
                        }
                        Logger.Log( LogType.UserActivity,
                                    "WBring: Asked {0} to confirm overriding world permissions to bring player {1} to world {2}",
                                    player.Name, target.Name, world.Name );
                        player.Confirm( cmd,
                                        "{0} {1}&S is ranked too low to join {2}&S. Override world permissions?",
                                        target.Info.Rank.ClassyName,
                                        target.ClassyName,
                                        world.ClassyName );
                    }
                } else {
                    player.Message( "Neither you nor {0}&S are allowed to join world {1}",
                                    target.ClassyName, world.ClassyName );
                }
            } else {
                //Allow banned players to be moved about...
                if (target.Info.Rank.Name == "Banned")
                {
                    player.Message("&sYou CAN move banned players about... It is considered bad form though...");
                }
                BringPlayerToWorld( player, target, world, false, false );
            }
        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:72,代码来源:ModerationCommands.cs

示例2: ImportBans

        static void ImportBans( Player player, Command cmd )
        {
            string serverName = cmd.Next();
            string file = cmd.Next();

            // Make sure all parameters are specified
            if( serverName == null || file == null ) {
                CdImport.PrintUsage( player );
                return;
            }

            // Check if file exists
            if( !File.Exists( file ) ) {
                player.Message( "File not found: {0}", file );
                return;
            }

            string[] names;

            switch( serverName.ToLower() ) {
                case "mcsharp":
                case "mczall":
                case "mclawl":
                    try {
                        names = File.ReadAllLines( file );
                    } catch( Exception ex ) {
                        Logger.Log( LogType.Error,
                                    "Could not open \"{0}\" to import bans: {1}",
                                    file, ex );
                        return;
                    }
                    break;
                default:
                    player.Message( "fCraft does not support importing from {0}", serverName );
                    return;
            }

            if( !cmd.IsConfirmed ) {
                player.Confirm( cmd, "You are about to import {0} bans.", names.Length );
                return;
            }

            string reason = "(import from " + serverName + ")";
            foreach( string name in names ) {
                if( Player.IsValidName( name ) ) {
                    PlayerInfo info = PlayerDB.FindPlayerInfoExact( name ) ??
                                      PlayerDB.AddFakeEntry( name, RankChangeType.Default );
                    info.Ban( player, reason, true, true );

                } else {
                    IPAddress ip;
                    if( Server.IsIP( name ) && IPAddress.TryParse( name, out ip ) ) {
                        ip.BanIP( player, reason, true, true );
                    } else {
                        player.Message( "Could not parse \"{0}\" as either name or IP. Skipping.", name );
                    }
                }
            }

            PlayerDB.Save();
            IPBanList.Save();
        }
开发者ID:Blingpancakeman,项目名称:800craft,代码行数:62,代码来源:MaintenanceCommands.cs

示例3: MassRankHandler

        static void MassRankHandler( Player player, Command cmd )
        {
            string fromRankName = cmd.Next();
            string toRankName = cmd.Next();
            string reason = cmd.NextAll();
            if( fromRankName == null || toRankName == null ) {
                CdMassRank.PrintUsage( player );
                return;
            }

            Rank fromRank = RankManager.FindRank( fromRankName );
            if( fromRank == null ) {
                player.MessageNoRank( fromRankName );
                return;
            }

            Rank toRank = RankManager.FindRank( toRankName );
            if( toRank == null ) {
                player.MessageNoRank( toRankName );
                return;
            }

            if( fromRank == toRank ) {
                player.Message( "Ranks must be different" );
                return;
            }

            int playerCount = fromRank.PlayerCount;
            string verb = (fromRank > toRank ? "demot" : "promot");

            if( !cmd.IsConfirmed ) {
                player.Confirm( cmd, "About to {0}e {1} players.", verb, playerCount );
                return;
            }

            player.Message( "MassRank: {0}ing {1} players...",
                            verb, playerCount );

            int affected = PlayerDB.MassRankChange( player, fromRank, toRank, reason );
            player.Message( "MassRank: done, {0} records affected.", affected );
        }
开发者ID:Blingpancakeman,项目名称:800craft,代码行数:41,代码来源:MaintenanceCommands.cs

示例4: WorldBringHandler

        static void WorldBringHandler( Player player, CommandReader cmd ) {
            string playerName = cmd.Next();
            string worldName = cmd.Next();
            if( playerName == null || worldName == null ) {
                CdWorldBring.PrintUsage( player );
                return;
            }

            Player target = Server.FindPlayerOrPrintMatches( player, playerName, false, false, true );
            World world = WorldManager.FindWorldOrPrintMatches( player, worldName );

            if( target == null || world == null ) return;

            if( !player.Can( Permission.Bring, target.Info.Rank ) ) {
                player.Message( "You may only bring players ranked {0}&S or lower.",
                                player.Info.Rank.GetLimit( Permission.Bring ).ClassyName );
                player.Message( "{0}&S is ranked {1}",
                                target.ClassyName, target.Info.Rank.ClassyName );
                return;
            }

            if( world == target.World ) {
                player.Message( "Player {0}&S is already in world {1}&S. They were brought to spawn.",
                                target.ClassyName, world.ClassyName );
                target.TeleportTo( target.WorldMap.Spawn );
                return;
            }

            SecurityCheckResult check = world.AccessSecurity.CheckDetailed( target.Info );
            if( check == SecurityCheckResult.RankTooLow ) {
                if( player.CanJoin( world ) ) {
                    if( cmd.IsConfirmed ) {
                        BringPlayerToWorld( player, target, world, true, false );
                    } else {
                        Logger.Log( LogType.UserActivity,
                                    "WBring: Asked {0} to confirm overriding world permissions to bring player {1} to world {2}",
                                    player.Name, target.Name, world.Name );
                        player.Confirm( cmd,
                                        "Player {0}&S is ranked too low to join {1}&S. Override world permissions?",
                                        target.ClassyName,
                                        world.ClassyName );
                    }
                } else {
                    player.Message( "Neither you nor {0}&S are allowed to join world {1}",
                                    target.ClassyName, world.ClassyName );
                }
            } else {
                BringPlayerToWorld( player, target, world, false, false );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:50,代码来源:ModerationCommands.cs

示例5: DoPlayerDB

        static void DoPlayerDB( Player player, Command cmd )
        {
            string p1Name = cmd.Next();
            string p2Name = cmd.Next();
            if( p1Name == null || p2Name == null ) {
                CdInfoSwap.PrintUsage( player );
                return;
            }

            PlayerInfo p1 = PlayerDB.FindPlayerInfoOrPrintMatches( player, p1Name );
            if( p1 == null ) return;
            PlayerInfo p2 = PlayerDB.FindPlayerInfoOrPrintMatches( player, p2Name );
            if( p2 == null ) return;

            if( p1 == p2 ) {
                player.Message( "InfoSwap: Please specify 2 different players." );
                return;
            }

            if( p1.IsOnline || p2.IsOnline ) {
                player.Message( "InfoSwap: Both players must be offline to swap info." );
                return;
            }

            if( !cmd.IsConfirmed ) {
                player.Confirm( cmd, "InfoSwap: Swap stats of players {0}&S and {1}&S?", p1.ClassyName, p2.ClassyName );
                return;
            } else {
                PlayerDB.SwapPlayerInfo( p1, p2 );
                player.Message( "InfoSwap: Stats of {0}&S and {1}&S have been swapped.",
                                p1.ClassyName, p2.ClassyName );
            }
        }
开发者ID:Blingpancakeman,项目名称:800craft,代码行数:33,代码来源:MaintenanceCommands.cs

示例6: UndoAreaTimeSelectionCallback

        static void UndoAreaTimeSelectionCallback( Player player, Vector3I[] marks, object tag )
        {
            World playerWorld = player.World;
            if( playerWorld == null ) PlayerOpException.ThrowNoWorld( player );

            UndoAreaTimeArgs args = (UndoAreaTimeArgs)tag;
            args.World = playerWorld;
            args.Area = new BoundingBox( marks[0], marks[1] );
            BlockDBEntry[] changes = playerWorld.BlockDB.Lookup( args.Target, args.Area, args.Time );
            if( changes.Length > 0 ) {
                player.Confirm( UndoAreaTimeConfirmCallback, args, "Undo changes ({0}) made by {1}&S in this area in the last {2}?",
                                changes.Length, args.Target.ClassyName, args.Time.ToMiniString() );
            } else {
                player.Message( "UndoArea: Nothing to undo in this area." );
            }
        }
开发者ID:Eeyle,项目名称:LegendCraftSource,代码行数:16,代码来源:BuildingCommands.cs

示例7: RankHandler

        static void RankHandler( Player player, CommandReader cmd ) {
            string name = cmd.Next();
            string newRankName = cmd.Next();

            // Check arguments
            if( name == null || newRankName == null ) {
                CdRank.PrintUsage( player );
                player.Message( "See &H/Ranks&S for list of ranks." );
                return;
            }

            // Parse rank name
            Rank newRank = RankManager.FindRank( newRankName );
            if( newRank == null ) {
                player.MessageNoRank( newRankName );
                return;
            }

            if( name == "-" ) {
                if( player.LastUsedPlayerName != null ) {
                    name = player.LastUsedPlayerName;
                } else {
                    player.Message( "Cannot repeat player name: you haven't used any names yet." );
                    return;
                }
            }
            PlayerInfo targetInfo;

            // Find player by name
            if( name.StartsWith( "!" ) ) {
                name = name.Substring( 1 );
                Player target = Server.FindPlayerExact( player, name, false );
                if( target == null ) {
                    player.MessageNoPlayer( name );
                    return;
                }
                targetInfo = target.Info;
            } else {
                targetInfo = PlayerDB.FindPlayerInfoExact( name );
            }

            // Handle non-existent players
            if( targetInfo == null ) {
                if( !player.Can( Permission.EditPlayerDB ) ) {
                    player.MessageNoPlayer( name );
                    return;
                }
                if( !Player.IsValidName( name ) ) {
                    player.MessageInvalidPlayerName( name );
                    CdRank.PrintUsage( player );
                    return;
                }
                if( cmd.IsConfirmed ) {
                    if( newRank > RankManager.DefaultRank ) {
                        targetInfo = PlayerDB.AddFakeEntry( name, RankChangeType.Promoted );
                    } else {
                        targetInfo = PlayerDB.AddFakeEntry( name, RankChangeType.Demoted );
                    }
                } else {
                    Logger.Log( LogType.UserActivity,
                                "Rank: Asked {0} to confirm adding unrecognized name \"{1}\" to the database.",
                                player.Name, name );
                    player.Confirm( cmd,
                                    "Warning: Player \"{0}\" is not in the database (possible typo). Type the full name or",
                                    name );
                    return;
                }
            }

            try {
                player.LastUsedPlayerName = targetInfo.Name;
                targetInfo.ChangeRank( player, newRank, cmd.NextAll(), true, true, false );
            } catch( PlayerOpException ex ) {
                player.Message( ex.MessageColored );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:76,代码来源:ModerationCommands.cs

示例8: RankHandler

        public static void RankHandler( Player player, Command cmd )
        {
            string name = cmd.Next();
            string newRankName = cmd.Next();

            // Check arguments
            if( name == null || newRankName == null ) {
                CdRank.PrintUsage( player );
                player.Message( "See &H/Ranks&S for list of ranks." );
                return;
            }

            // Parse rank name
            Rank newRank = RankManager.FindRank( newRankName );
            if( newRank == null ) {
                player.MessageNoRank( newRankName );
                return;
            }

            // Parse player name
            if( name == "-" ) {
                if( player.LastUsedPlayerName != null ) {
                    name = player.LastUsedPlayerName;
                } else {
                    player.Message( "Cannot repeat player name: you haven't used any names yet." );
                    return;
                }
            }
            PlayerInfo targetInfo = PlayerDB.FindPlayerInfoExact( name );

            if( targetInfo == null ) {
                if( !player.Can( Permission.EditPlayerDB ) ) {
                    player.MessageNoPlayer( name );
                    return;
                }
                if( !Player.IsValidName( name ) ) {
                    player.MessageInvalidPlayerName( name );
                    CdRank.PrintUsage( player );
                    return;
                }
                if( cmd.IsConfirmed ) {
                    if( newRank > RankManager.DefaultRank ) {
                        targetInfo = PlayerDB.AddFakeEntry( name, RankChangeType.Promoted );
                    } else {
                        targetInfo = PlayerDB.AddFakeEntry( name, RankChangeType.Demoted );
                    }
                } else {
                    player.Confirm( cmd,
                                    "Warning: Player \"{0}\" is not in the database (possible typo). Type the full name or",
                                    name );
                    return;
                }
            }

            try {
                player.LastUsedPlayerName = targetInfo.Name;

                //reset temprank values
                if (targetInfo.isTempRanked)
                {
                    targetInfo.isTempRanked = false;
                    targetInfo.tempRankTime = TimeSpan.FromSeconds(0);
                }
                targetInfo.ChangeRank( player, newRank, cmd.NextAll(), true, true, false );
            } catch( PlayerOpException ex ) {
                player.Message( ex.MessageColored );
            }
        }
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:68,代码来源:ModerationCommands.cs

示例9: BlockDBHandler


//.........这里部分代码省略.........
                switch (op.ToLower())
                {
                    case "on":
                        // enables BlockDB
                        if (db.EnabledState == YesNoAuto.Yes)
                        {
                            player.Message("BlockDB is already manually enabled on world {0}", world.ClassyName);

                        }
                        else if (db.EnabledState == YesNoAuto.Auto && db.IsEnabled)
                        {
                            db.EnabledState = YesNoAuto.Yes;
                            WorldManager.SaveWorldList();
                            player.Message("BlockDB was auto-enabled, and is now manually enabled on world {0}", world.ClassyName);

                        }
                        else
                        {
                            db.EnabledState = YesNoAuto.Yes;
                            WorldManager.SaveWorldList();
                            player.Message("BlockDB is now manually enabled on world {0}", world.ClassyName);
                        }
                        break;

                    case "off":
                        // disables BlockDB
                        if (db.EnabledState == YesNoAuto.No)
                        {
                            player.Message("BlockDB is already manually disabled on world {0}", world.ClassyName);

                        }
                        else if (db.IsEnabled)
                        {
                            if (cmd.IsConfirmed)
                            {
                                db.EnabledState = YesNoAuto.No;
                                WorldManager.SaveWorldList();
                                player.Message("BlockDB is now manually disabled on world {0}&S. Use &H/BlockDB {1} clear&S to delete all the data.",
                                                world.ClassyName, world.Name);
                            }
                            else
                            {
                                player.Confirm(cmd,
                                                "Disable BlockDB on world {0}&S? Block changes will stop being recorded.",
                                                world.ClassyName);
                            }
                        }
                        else
                        {
                            db.EnabledState = YesNoAuto.No;
                            WorldManager.SaveWorldList();
                            player.Message("BlockDB was auto-disabled, and is now manually disabled on world {0}&S.",
                                            world.ClassyName);
                        }
                        break;

                    case "auto":
                        if (db.EnabledState == YesNoAuto.Auto)
                        {
                            player.Message("BlockDB is already set to automatically enable/disable itself on world {0}", world.ClassyName);
                        }
                        else
                        {
                            db.EnabledState = YesNoAuto.Auto;
                            WorldManager.SaveWorldList();
                            if (db.IsEnabled)
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:67,代码来源:WorldCommands.cs

示例10: EconomyHandler

        static void EconomyHandler(Player player, Command cmd)
        {
            try
            {
                string option = cmd.Next();
                string targetName = cmd.Next();
                string amount = cmd.Next();
                int amountnum;
                if (option == null)
                {
                    CdEconomy.PrintUsage(player);
                }
                if (option == "give")
                {
                    if (!player.Can(Permission.ManageEconomy))
                    {
                        player.Message("You do not have the required permisions to use that command!");
                        return;
                    }
                    Player target = Server.FindPlayerOrPrintMatches(player, targetName, false, true);
                    if (targetName == null)
                    {
                        player.Message("&ePlease type in a player's name to give bits towards.");
                        return;
                    }
                    if (target == null)
                    {
                        return;
                    }
                    else
                    {
                        if (!int.TryParse(amount, out amountnum))
                        {
                            player.Message("&ePlease select from a whole number.");
                            return;
                        }
                        if (cmd.IsConfirmed)
                        {
                            //actually give the player the money
                            int tNewMoney = target.Info.Money + amountnum;
                            player.Message("&eYou have given {0} &C{1} &ebit(s).", target.ClassyName, amountnum);
                            target.Message("&e{0} &ehas given you {1} &ebit(s).", player.ClassyName, amountnum);
                            Server.Players.Except(target).Except(player).Message("&e{0} &ewas given {1} &ebit(s) from {2}&e.", target.ClassyName, amountnum, player.ClassyName);
                            target.Info.Money = tNewMoney;
                            return;
                        }
                        else
                        {
                            player.Confirm(cmd, "&eAre you sure you want to give {0} &C{1} &ebits?&s", target.ClassyName, amountnum);
                            return;
                        }

                    }
                }
                if (option == "take")
                {
                    if (!player.Can(Permission.ManageEconomy))
                    {
                        player.Message("You do not have the required permisions to use that command!");
                        return;
                    }
                    Player target = Server.FindPlayerOrPrintMatches(player, targetName, false, true);
                    if (targetName == null)
                    {
                        player.Message("&ePlease type in a player's name to take bits away from.");
                        return;
                    }
                    if (target == null)
                    {
                        return;
                    }
                    else
                    {
                        if (!int.TryParse(amount, out amountnum))
                        {
                            player.Message("&eThe amount must be a number!");
                            return;
                        }

                        if (cmd.IsConfirmed)
                        {
                            if (amountnum > target.Info.Money)
                            {
                                player.Message("{0}&e doesn't have that many bits!", target.ClassyName);
                                return;
                            }
                            else
                            {
                                //actually give the player the money
                                int tNewMoney = target.Info.Money - amountnum;
                                player.Message("&eYou have taken &c{1}&e from {0}.", target.ClassyName, amountnum);
                                target.Message("&e{0} &ehas taken {1} &ebit(s) from you.", player.ClassyName, amountnum);
                                Server.Players.Except(target).Except(player).Message("&e{0} &etook {1} &ebit(s) from {2}&e.", player.ClassyName, amountnum, target.ClassyName);
                                target.Info.Money = tNewMoney;
                                return;
                            }
                        }
                        else
                        {
                            player.Confirm(cmd, "&eAre you sure you want to take &c{1} &ebits from {0}&e?&s", target.ClassyName, amountnum);
//.........这里部分代码省略.........
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:101,代码来源:ModerationCommands.cs

示例11: PayHandler

        static void PayHandler(Player player, Command cmd)
        {
            string targetName = cmd.Next();
            string amount = cmd.Next();
            int amountnum;
            //lotsa idiot proofing in this one ^.^

            if (targetName == null)
            {
                player.Message("&ePlease type in a player's name to pay bits towards.");
                return;
            }
            Player target = Server.FindPlayerOrPrintMatches(player, targetName, false, true);
            if (target == player)
            {
                player.Message("You can't pay yourself >.> Doesn't work like that.");
                return;
            }

            if (target == null)
            {
                return;
            }
            else
            {
                if (!int.TryParse(amount, out amountnum))
                {
                    player.Message("&eThe amount must be a positive whole number!");
                    return;
                }
                if (amountnum < 1)
                {
                    player.Message("&eThe amount must be a positive whole number!");
                    return;
                }

                if (cmd.IsConfirmed)
                {
                    if (amountnum > player.Info.Money)
                    {
                        player.Message("You don't have that many bits!");
                        return;
                    }
                    else
                    {
                        //show him da monai
                        int pNewMoney = player.Info.Money - amountnum;
                        int tNewMoney = target.Info.Money + amountnum;
                        player.Message("&eYou have paid &C{1}&e to {0}&e.", target.ClassyName, amountnum);
                        target.Message("&e{0} &ehas paid you {1} &ebit(s).", player.ClassyName, amountnum);
                        Server.Players.Except(target).Except(player).Message("&e{0} &ewas paid {1} &ebit(s) from {2}&e.", target.ClassyName, amountnum, player.ClassyName);
                        player.Info.Money = pNewMoney;
                        target.Info.Money = tNewMoney;
                        return;
                    }
                }
                else
                {
                    player.Confirm(cmd, "&eAre you sure you want to pay {0}&e {1} &ebits?", target.ClassyName, amountnum);
                    return;
                }

            }
        }
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:64,代码来源:ModerationCommands.cs

示例12: EconomyHandler

        static void EconomyHandler(Player player, Command cmd)
        {
            try
            {
                string option = cmd.Next();
                string targetName = cmd.Next();
                string amount = cmd.Next();
                int amountnum;
                if (option == null)
                {
                    CdEconomy.PrintUsage(player);
                }
                if (option == "give")
                {
                    Player target = Server.FindPlayerOrPrintMatches(player, targetName, false, true);
                    if (!player.Can(Permission.ManageEconomy))
                    {
                        player.Message("&cYou do not have permission to use that command!");
                        return;
                    }

                    if (targetName == null)
                    {
                        player.Message("&ePlease type in a player's name to give " + ConfigKey.CurrencyKeyPl.GetString() + " to.");
                        return;
                    }


                    if (target == null)
                    {
                        return;
                    }
                    else
                    {
                        if ((player.Can(Permission.GiveSelf)) && (target == player)) //Giving yourself da monai
                        {
                            if (!int.TryParse(amount, out amountnum))
                            {
                                player.Message("&eThe amount must be a number without any decimals!");
                                return;
                            }
                            if (cmd.IsConfirmed)
                            {
                                //actually give the player the money
                                int tNewMoney = target.Info.Money + amountnum;

                                if (amountnum == 1)
                                {
                                    player.Message("&eYou have given {0} &C" + ConfigKey.CurrencyKeySl.GetString() + " &ecoin.", target.ClassyName, amountnum);
                                    target.Message("&e{0} &ehas given you {1} &e" + ConfigKey.CurrencyKeySl.GetString(), player.ClassyName, amountnum);
                                    Server.Players.Except(target).Except(player).Message("&e{0} &ewas given {1} &e" + ConfigKey.CurrencyKeySl.GetString() + " by {2}&e.", target.ClassyName, amountnum, player.ClassyName);
                                }
                                else
                                {
                                    player.Message("&eYou have given {0} &C{1} &e" + ConfigKey.CurrencyKeyPl.GetString(), target.ClassyName, amountnum);
                                    target.Message("&e{0} &ehas given you {1} &e" + ConfigKey.CurrencyKeyPl.GetString(), player.ClassyName, amountnum);
                                    Server.Players.Except(target).Except(player).Message("&e{0} &ewas given {1} &e" + ConfigKey.CurrencyKeyPl.GetString() + " by {2}&e.", target.ClassyName, amountnum, player.ClassyName);
                                }

                                target.Info.Money = tNewMoney;
                                return;
                            }
                            else
                            {
                                if (amountnum == 1)
                                {
                                    player.Confirm(cmd, "&eAre you sure you want to give {0} &C{1} &e " + ConfigKey.CurrencyKeySl.GetString() + "?", target.ClassyName, amountnum);
                                    return;
                                }
                                else
                                {
                                    player.Confirm(cmd, "&eAre you sure you want to give {0} &C{1} &e " + ConfigKey.CurrencyKeyPl.GetString() + "?", target.ClassyName, amountnum);
                                    return;
                                }
                            }

                        } //der
                        else if ((!player.Can(Permission.GiveSelf)) && (target == player)) //Not letting dat scum give himslef da monai
                        {
                            player.Message("&eYou cannot give yourself " + ConfigKey.CurrencyKeyPl.GetString());
                            return;
                        }

                        else if (!int.TryParse(amount, out amountnum))
                        {
                            player.Message("&eThe amount must be a number without any decimals!");
                            return;
                        }
                        if (cmd.IsConfirmed)
                        {
                            //actually give the player the money
                            int tNewMoney = target.Info.Money + amountnum;

                            if (amountnum == 1)
                            {
                                player.Message("&eYou have given {0} &C" + ConfigKey.CurrencyKeySl.GetString() + " &ecoin.", target.ClassyName, amountnum);
                                target.Message("&e{0} &ehas given you {1} &e" + ConfigKey.CurrencyKeySl.GetString(), player.ClassyName, amountnum);
                                Server.Players.Except(target).Except(player).Message("&e{0} &ewas given {1} &e" + ConfigKey.CurrencyKeySl.GetString() + " by {2}&e.", target.ClassyName, amountnum, player.ClassyName);
                            }
                            else
//.........这里部分代码省略.........
开发者ID:GMathioud,项目名称:MyCraft,代码行数:101,代码来源:ModerationCommands.cs

示例13: RealmCreate

        public static void RealmCreate(Player player, Command cmd, string themeName, string templateName)
        {
            MapGenTemplate template;
            MapGenTheme theme;

            int wx, wy, height = 128;
            if (!(cmd.NextInt(out wx) && cmd.NextInt(out wy) && cmd.NextInt(out height)))
            {
                if (player.World != null)
                {
                    wx = 128;
                    wy = 128;
                    height = 128;
                }
                else
                {
                    player.Message("When used from console, /gen requires map dimensions.");

                    return;
                }
                cmd.Rewind();
                cmd.Next();
                cmd.Next();
            }

            if (!Map.IsValidDimension(wx))
            {
                player.Message("Cannot make map with width {0}: dimensions must be multiples of 16.", wx);
                return;
            }
            else if (!Map.IsValidDimension(wy))
            {
                player.Message("Cannot make map with length {0}: dimensions must be multiples of 16.", wy);
                return;
            }
            else if (!Map.IsValidDimension(height))
            {
                player.Message("Cannot make map with height {0}: dimensions must be multiples of 16.", height);
                return;
            }

            string fileName = player.Name;
            string fullFileName = null;

            if (fileName == null)
            {
                if (player.World == null)
                {
                    player.Message("When used from console, /gen requires FileName.");

                    return;
                }
                if (!cmd.IsConfirmed)
                {
                    player.Confirm(cmd, "Replace this realm's map with a generated one?");
                    return;
                }
            }
            else
            {
                fileName = fileName.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
                if (!fileName.EndsWith(".fcm", StringComparison.OrdinalIgnoreCase))
                {
                    fileName += ".fcm";
                }
                fullFileName = Path.Combine(Paths.MapPath, fileName);
                if (!Paths.IsValidPath(fullFileName))
                {
                    player.Message("Invalid filename.");
                    return;
                }
                if (!Paths.Contains(Paths.MapPath, fullFileName))
                {
                    player.MessageUnsafePath();
                    return;
                }
                string dirName = fullFileName.Substring(0, fullFileName.LastIndexOf(Path.DirectorySeparatorChar));
                if (!Directory.Exists(dirName))
                {
                    Directory.CreateDirectory(dirName);
                }
                if (!cmd.IsConfirmed && File.Exists(fullFileName))
                {
                    player.Confirm(cmd, "The mapfile \"{0}\" already exists. Overwrite?", fileName);
                    return;
                }
            }

            bool noTrees;
            if (themeName.Equals("grass", StringComparison.OrdinalIgnoreCase))
            {
                theme = MapGenTheme.Forest;
                noTrees = true;
            }
            else
            {
                try
                {
                    theme = (MapGenTheme)Enum.Parse(typeof(MapGenTheme), themeName, true);
                    noTrees = (theme != MapGenTheme.Forest);
//.........这里部分代码省略.........
开发者ID:727021,项目名称:800craft,代码行数:101,代码来源:RealmHandler.cs

示例14: EnvHandler

        static void EnvHandler( Player player, Command cmd ) {
            if( !ConfigKey.WoMEnableEnvExtensions.Enabled() ) {
                player.Message( "Env command is disabled on this server." );
                return;
            }
            string worldName = cmd.Next();
            World world;
            if( worldName == null ) {
                world = player.World;
                if( world == null ) {
                    player.Message( "When used from console, /Env requires a world name." );
                    return;
                }
            } else {
                world = WorldManager.FindWorldOrPrintMatches( player, worldName );
                if( world == null ) return;
            }

            string variable = cmd.Next();
            string valueText = cmd.Next();
            if( variable == null ) {
                player.Message( "Environment settings for world {0}&S:", world.ClassyName );
                player.Message( "  Cloud: {0}   Fog: {1}   Sky: {2}",
                                world.CloudColor == -1 ? "normal" : '#' + world.CloudColor.ToString( "X6" ),
                                world.FogColor == -1 ? "normal" : '#' + world.FogColor.ToString( "X6" ),
                                world.SkyColor == -1 ? "normal" : '#' + world.SkyColor.ToString( "X6" ) );
                player.Message( "  Edge level: {0}  Edge texture: {1}",
                                world.EdgeLevel == -1 ? "normal" : world.EdgeLevel + " blocks",
                                world.EdgeBlock );
                if( !player.IsUsingWoM ) {
                    player.Message( "  You need WoM client to see the changes." );
                }
                return;
            }

            if( variable.Equals( "normal", StringComparison.OrdinalIgnoreCase ) ) {
                if( cmd.IsConfirmed ) {
                    world.FogColor = -1;
                    world.CloudColor = -1;
                    world.SkyColor = -1;
                    world.EdgeLevel = -1;
                    world.EdgeBlock = Block.Water;
                    player.Message( "Reset enviroment settings for world {0}", world.ClassyName );
                    WorldManager.SaveWorldList();
                } else {
                    player.Confirm( cmd, "Reset enviroment settings for world {0}&S?", world.ClassyName );
                }
                return;
            }

            if( valueText == null ) {
                CdEnv.PrintUsage( player );
                return;
            }

            int value = 0;
            if( valueText.Equals( "normal", StringComparison.OrdinalIgnoreCase ) ) {
                value = -1;
            }

            switch( variable.ToLower() ) {
                case "fog":
                    if( value == -1 ) {
                        player.Message( "Reset fog color for {0}&S to normal", world.ClassyName );
                    } else {
                        try {
                            value = ParseHexColor( valueText );
                        } catch( FormatException ) {
                            player.Message( "Env: \"{0}\" is not a valid RGB color code.", valueText );
                            return;
                        }
                        player.Message( "Set fog color for {0}&S to #{1:X6}", world.ClassyName, value );
                    }
                    world.FogColor = value;
                    break;

                case "cloud":
                case "clouds":
                    if( value == -1 ) {
                        player.Message( "Reset cloud color for {0}&S to normal", world.ClassyName );
                    } else {
                        try {
                            value = ParseHexColor( valueText );
                        } catch( FormatException ) {
                            player.Message( "Env: \"{0}\" is not a valid RGB color code.", valueText );
                            return;
                        }
                        player.Message( "Set cloud color for {0}&S to #{1:X6}", world.ClassyName, value );
                    }
                    world.CloudColor = value;
                    break;

                case "sky":
                    if( value == -1 ) {
                        player.Message( "Reset sky color for {0}&S to normal", world.ClassyName );
                    } else {
                        try {
                            value = ParseHexColor( valueText );
                        } catch( FormatException ) {
                            player.Message( "Env: \"{0}\" is not a valid RGB color code.", valueText );
//.........这里部分代码省略.........
开发者ID:fragmer,项目名称:fCraft,代码行数:101,代码来源:WorldCommands.cs

示例15: ZoneRemoveHandler

        static void ZoneRemoveHandler( Player player, Command cmd )
        {
            string zoneName = cmd.Next();
            if( zoneName == null ) {
                CdZoneRemove.PrintUsage( player );
                return;
            }

            ZoneCollection zones = player.WorldMap.Zones;
            Zone zone = zones.Find( zoneName );
            if( zone != null ) {
                if( !player.Info.Rank.AllowSecurityCircumvention ) {
                    switch( zone.Controller.CheckDetailed( player.Info ) ) {
                        case SecurityCheckResult.BlackListed:
                            player.Message( "You are not allowed to remove zone {0}: you are blacklisted.", zone.ClassyName );
                            return;
                        case SecurityCheckResult.RankTooLow:
                            player.Message( "You are not allowed to remove zone {0}.", zone.ClassyName );
                            return;
                    }
                }
                if( !cmd.IsConfirmed ) {
                    player.Confirm( cmd, "You are about to remove zone {0}&S.", zone.ClassyName );
                    return;
                }

                if( zones.Remove( zone.Name ) ) {
                    player.Message( "Zone \"{0}\" removed.", zone.Name );
                }

            } else {
                player.MessageNoZone( zoneName );
            }
        }
开发者ID:Desertive,项目名称:800craft,代码行数:34,代码来源:ZoneCommands.cs


注:本文中的fCraft.Player.Confirm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。