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


C# Command.Next方法代码示例

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


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

示例1: TrollHandler

 static void TrollHandler(Player player, Command cmd)
 {
     string Name = cmd.Next();
     if (Name == null)
     {
         player.Message("Player not found. Please specify valid name.");
         return;
     }
     if (!Player.IsValidName(Name))
         return;
     Player target = Server.FindPlayerOrPrintMatches(player, Name, true, true);
     if (target == null)
         return;
     string options = cmd.Next();
     if (options == null)
     {
         CdTroll.PrintUsage(player);
         return;
     }
     string Message = cmd.NextAll();
     if (Message.Length < 1 && options.ToLower() != "leave")
     {
         player.Message("&WError: Please enter a message for {0}.", target.ClassyName);
         return;
     }
     switch (options.ToLower())
     {
         case "pm":
             if (player.Can(Permission.UseColorCodes) && Message.Contains("%"))
             {
                 Message = Color.ReplacePercentCodes(Message);
             }
             Server.Players.Message("&Pfrom {0}: {1}",
                 target.Name, Message);
             break;
         case "ac":
             Chat.SendAdmin(target, Message);
             break;
         case "st":
         case "staff":
             Chat.SendStaff(target, Message);
             break;
         case "i":
         case "impersonate":
         case "msg":
         case "message":
         case "m":
             Server.Message("{0}&S&F: {1}",
                               target.ClassyName, Message);
             break;
         case "leave":
         case "disconnect":
         case "gtfo":
             Server.Players.Message("&SPlayer {0}&S left the server.",
                 target.ClassyName);
             break;
         default: player.Message("Invalid option. Please choose st, ac, pm, message or leave");
             break;
     }
 }
开发者ID:727021,项目名称:800craft,代码行数:60,代码来源:TrollPlugin.cs

示例2: FuncDrawOperation

        protected FuncDrawOperation(Player player, Command cmd)
            : base(player)
        {
            string strFunc = cmd.Next();
            if (string.IsNullOrWhiteSpace(strFunc))
            {
                player.Message("&WEmpty function expression");
                return;
            }
            if (strFunc.Length < 3)
            {
                player.Message("&WExpression is too short (should be like z=f(x,y))");
                return;
            }

            strFunc = strFunc.ToLower();

            _vaxis = GetAxis(SimpleParser.PreparseAssignment(ref strFunc));

            _expression = SimpleParser.Parse(strFunc, GetVarArray(_vaxis));

            Player.Message("Expression parsed as "+_expression.Print());
            string scalingStr=cmd.Next();
            _scaler = new Scaler(scalingStr);
        }
开发者ID:Eeyle,项目名称:LegendCraftSource,代码行数:25,代码来源:FuncDrawOperation.cs

示例3: DoZone

        void DoZone( Player player, Command cmd ) {
            if( !player.Can( Permissions.SetSpawn ) ) {
                world.NoAccessMessage( player );
                return;
            }

            string name = cmd.Next();
            if( name == null ) {
                player.Message( "No zone name specified. See " + Color.Help + "/help zone" );
                return;
            }
            if( !Player.IsValidName( name ) ) {
                player.Message( "\"" + name + "\" is not a valid zone name" );
                return;
            }
            Zone zone = new Zone();
            zone.name = name;

            string property = cmd.Next();
            if( property == null ) {
                player.Message( "No zone rank/whitelist/blacklist specified. See " + Color.Help + "/help zone" );
                return;
            }
            PlayerClass minRank = world.classes.ParseClass( property );
            
            if( minRank != null ) {
                zone.buildRank = minRank.rank;
                player.tag = zone;
                player.marksExpected = 2;
                player.marks.Clear();
                player.markCount = 0;
                player.selectionCallback = MakeZone;
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:34,代码来源:MapCommands.cs

示例4: PayHandler

        static void PayHandler(Player player, Command cmd)
        {
            string targetName = cmd.Next();
            string money = cmd.Next();
            int amount;

            if (money == null)
            {
                player.Message("&ePlease select the amount of bits you wish to send.");
                return;
            }

            Player target = Server.FindPlayerOrPrintMatches(player, targetName, false, true);
            if (target == null)
            {
                player.Message("&ePlease select a player to pay bits towards.");
                return;
            }

            if (!int.TryParse(money, out amount))
            {
                player.Message("&ePlease select from a whole number.");
                return;
            }

            PayHandler(player, new Command("/economy pay " + target + " " + money));
        }
开发者ID:venofox,项目名称:AtomicCraft,代码行数:27,代码来源:Economy.cs

示例5: SetParametrization

        public static void SetParametrization(Player p, Command cmd)
        {
            string strFunc = cmd.Next();
            if (string.IsNullOrWhiteSpace(strFunc))
            {
                p.Message("Error: empty parametrization expression");
                return;
            }
            if (strFunc.Length < 3)
            {
                p.Message("Error: expression is too short (should be like x=f(t,u,v))");
                return;
            }

            strFunc = strFunc.ToLower();

            try
            {
                string coordVar = SimpleParser.PreparseAssignment(ref strFunc);
                CheckCoordVar(coordVar);

                Expression expression = SimpleParser.Parse(strFunc, new string[] { "t", "u", "v" });

                p.Message("Expression parsed as " + coordVar + "=" + expression.Print());

                GetPlayerParametrizationCoordsStorage(p)[VarNameToIdx(coordVar[0])] = expression;
            }
            catch (Exception e)
            {
                p.Message("Error: "+e.Message);
            }
        }
开发者ID:GMathioud,项目名称:MyCraft,代码行数:32,代码来源:PrepareParametrizedManifold.cs

示例6: CModeWater

 internal static void CModeWater(Player player, Command cmd)
 {
     if (!player.Can(Permissions.ControlPhysics))
     {
         player.NoAccessMessage(Permissions.ControlPhysics);
         return;
     }
     string blockpar = cmd.Next();
     string wmt = "";
     int BlockAddr = -1;
     try { BlockAddr = Convert.ToInt32(blockpar); }
     catch
     {
         player.Message("Incorrect parameter!"); return;
     }
     if (BlockAddr < 3 && BlockAddr >= 0)
     {
         player.world.map.modeWater = BlockAddr;
         switch (BlockAddr)
         {
             case 0: wmt = "'none'"; break;
             case 1: wmt = "'infinite'"; break;
             case 2: wmt = "'finite'"; break;
         }
         player.Message("Water mode set to " + wmt + ".");
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:27,代码来源:MapCommands.cs

示例7: Compass

        void Compass( Player player, Command cmd ) {
            int offset = (int)(player.pos.r / 255f * 64f) + 32;
            string name = cmd.Next();

            if( name != null ) {
                Player target = world.FindPlayer( name );
                if( target != null ) {
                    player.Message( "Coordinates of player \"" + target.name + "\":" );
                    offset = (int)(target.pos.r / 255f * 64f) + 32;
                } else {
                    world.NoPlayerMessage( player, name );
                    return;
                }
            }

            player.Message( Color.Silver, String.Format( "({0},{1},{2}) - {3}[{4}{5}{6}{3}{7}]",
                            player.pos.x / 32,
                            player.pos.y / 32,
                            player.pos.h / 32,
                            Color.White,
                            compass.Substring( offset - 12, 11 ),
                            Color.Red,
                            compass.Substring( offset - 1, 3 ),
                            compass.Substring( offset + 2, 11 ) ) );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:25,代码来源:InfoCommands.cs

示例8: DumpStats

        internal static void DumpStats( Player player, Command cmd ) {
            string fileName = cmd.Next();
            if( fileName == null ) {
                cdDumpStats.PrintUsage( player );
                return;
            }

            if( !Paths.Contains( Paths.WorkingPath, fileName ) ) {
                player.UnsafePathMessage();
                return;
            }

            if( Paths.IsProtectedFileName( Path.GetFileName( fileName ) ) ) {
                player.Message( "You may not use this file." );
                return;
            }

            if( Path.HasExtension( fileName ) &&
                !Path.GetExtension( fileName ).Equals( ".txt", StringComparison.OrdinalIgnoreCase ) ) {
                player.Message( "Stats filename must end with .txt" );
                return;
            }

            if( File.Exists( fileName ) && !cmd.IsConfirmed ) {
                player.AskForConfirmation( cmd, "File \"{0}\" already exists. Overwrite?", Path.GetFileName( fileName ) );
                return;
            }

            if( !Paths.TestFile( "dumpstats file", fileName, false, true, false ) ) {
                player.Message( "Cannot create specified file. See log for details." );
                return;
            }

            PlayerInfo[] infos;
            using( FileStream fs = File.Create( fileName ) ) {
                using( StreamWriter writer = new StreamWriter( fs ) ) {
                    infos = PlayerDB.GetPlayerListCopy();
                    if( infos.Length == 0 ) {
                        writer.WriteLine( "{0} (0 players)", "(TOTAL)" );
                        writer.WriteLine();
                    } else {
                        DumpPlayerGroupStats( writer, infos, "(TOTAL)" );
                    }

                    foreach( Rank rank in RankManager.Ranks ) {
                        infos = PlayerDB.GetPlayerListCopy( rank );
                        if( infos.Length == 0 ) {
                            writer.WriteLine( "{0} (0 players)", rank.Name );
                            writer.WriteLine();
                        } else {
                            DumpPlayerGroupStats( writer, infos, rank.Name );
                        }
                    }
                }
            }

            player.Message( "Stats saved to \"{0}\"", Path.GetFileName( fileName ) );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:58,代码来源:MaintenanceCommands.cs

示例9: InequalityDrawOperation

        public InequalityDrawOperation( Player player, Command cmd )
            : base(player)
        {
            string strFunc = cmd.Next();
            if ( string.IsNullOrWhiteSpace( strFunc ) )
                throw new ArgumentException( "empty inequality expression" );
            if ( strFunc.Length < 3 )
                throw new ArgumentException( "expression is too short (should be like f(x,y,z)>g(x,y,z))" );

            strFunc = strFunc.ToLower();

            _expression = SimpleParser.Parse( strFunc, new string[] { "x", "y", "z" } );
            if ( !_expression.IsInEquality() )
                throw new ArgumentException( "the expression given is not an inequality (should be like f(x,y,z)>g(x,y,z))" );

            player.Message( "Expression parsed as " + _expression.Print() );
            string scalingStr = cmd.Next();
            _scaler = new Scaler( scalingStr );
        }
开发者ID:GlennMR,项目名称:800craft,代码行数:19,代码来源:InequalityDrawOperation.cs

示例10: EqualityDrawOperation

        public EqualityDrawOperation( Player player, Command cmd )
            : base(player)
        {
            string strFunc = cmd.Next();
            if ( string.IsNullOrWhiteSpace( strFunc ) ) {
                player.Message( "empty equality expression" );
                return;
            }
            if ( strFunc.Length < 3 ) {
                player.Message( "expression is too short (should be like f(x,y,z)=g(x,y,z))" );
                return;
            }

            strFunc = strFunc.ToLower();

            _expression = SimpleParser.ParseAsEquality( strFunc, new string[] { "x", "y", "z" } );

            player.Message( "Expression parsed as " + _expression.Print() );
            string scalingStr = cmd.Next();
            _scaler = new Scaler( scalingStr );
        }
开发者ID:GlennMR,项目名称:800craft,代码行数:21,代码来源:EqualityDrawOperation.cs

示例11: WorldInfo

        internal static void WorldInfo( Player player, Command cmd ) {
            string worldName = cmd.Next();
            if( worldName == null ) {
                if( player.World == null ) {
                    player.Message( "Please specify a world name when calling /winfo form console." );
                    return;
                } else {
                    worldName = player.World.Name;
                }
            }

            World world = WorldManager.FindWorldOrPrintMatches( player, worldName );
            if( world == null ) return;

            player.Message( "World {0}&S has {1} player(s) on.",
                            world.GetClassyName(),
                            world.CountVisiblePlayers(player) );

            Map map = world.Map;

            // If map is not currently loaded, grab its header from disk
            if( map == null ) {
                try {
                    map = MapUtility.LoadHeader( Path.Combine( Paths.MapPath, world.GetMapName() ) );
                } catch( Exception ex ) {
                    player.Message( "Map information could not be loaded: {0}: {1}",
                                    ex.GetType().Name, ex.Message );
                }
            }

            if( map != null ) {
                player.Message( "Map dimensions are {0} x {1} x {2}",
                                map.WidthX, map.WidthY, map.Height );
            }

            // Print access/build limits
            world.AccessSecurity.PrintDescription( player, world, "world", "accessed" );
            world.BuildSecurity.PrintDescription( player, world, "world", "modified" );

            // Print lock/unlock information
            if( world.IsLocked ) {
                player.Message( "{0}&S was locked {1} ago by {2}",
                                world.GetClassyName(),
                                DateTime.UtcNow.Subtract( world.LockedDate ).ToMiniString(),
                                world.LockedBy );
            } else if( world.UnlockedBy != null ) {
                player.Message( "{0}&S was unlocked {1} ago by {2}",
                                world.GetClassyName(),
                                DateTime.UtcNow.Subtract( world.UnlockedDate ).ToMiniString(),
                                world.UnlockedBy );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:52,代码来源:WorldCommands.cs

示例12: Draw

        void Draw( Player player, Command command, DrawMode mode ) {
            if( !player.Can( Permissions.Draw ) ) {
                world.NoAccessMessage( player );
                return;
            }
            if( player.drawingInProgress ) {
                player.Message( "Another draw command is already in progress. Please wait." );
                return;
            }
            string blockName = command.Next();
            Block block;
            if( blockName == null || blockName == "" ) {
                if( mode == DrawMode.Cuboid ) {
                    player.Message( "Usage: " + Color.Help + "/cuboid blockName" + Color.Sys + " or " + Color.Help + "/cub blockName" );
                } else {
                    player.Message( "Usage: " + Color.Help + "/ellipsoid blockName" + Color.Sys + " or " + Color.Help + "/ell blockName" );
                }
                return;
            }
            try {
                block = Map.GetBlockByName( blockName );
            } catch( Exception ) {
                player.Message( "Unknown block name: " + blockName );
                return;
            }
            player.tag = block;

            Permissions permission = Permissions.Build;
            switch( block ) {
                case Block.Admincrete: permission = Permissions.PlaceAdmincrete; break;
                case Block.Air: permission = Permissions.Delete; break;
                case Block.Water:
                case Block.StillWater: permission = Permissions.PlaceWater; break;
                case Block.Lava:
                case Block.StillLava: permission = Permissions.PlaceLava; break;
            }
            if( !player.Can( permission ) ) {
                player.Message( "You are not allowed to draw with this block." );
                return;
            }

            player.marksExpected = 2;
            player.markCount = 0;
            player.marks.Clear();
            player.Message( mode.ToString() + ": Place a block or type /mark to use your location." );

            if( mode == DrawMode.Cuboid ) {
                player.selectionCallback = DrawCuboid;
            } else {
                player.selectionCallback = DrawEllipsoid;
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:52,代码来源:DrawCommands.cs

示例13: ProcessCommand

 public static void ProcessCommand( Player p, Command cmd )
 {
     string command = cmd.Next();
     if ( String.IsNullOrWhiteSpace( command ) ) {
         p.Message( "&WLife command is missing or empty" );
         return;
     }
     LifeCommand c;
     if ( !Commands.TryGetValue( command.ToLower(), out c ) ) {
         p.Message( "&WUnknown life command " + command + ". &hType '/life help' for the list of commands." );
         return;
     }
     c.F( p, cmd );
 }
开发者ID:GlennMR,项目名称:800craft,代码行数:14,代码来源:LifeHandler.cs

示例14: ItemEntAdd

 internal static void ItemEntAdd(Player player, Command cmd)
 {
     string blockpar = cmd.Next();
     ItemEntType IPar1 = ItemEntType.Null;
     //byte IPar2 = 255;
     try { IPar1 = (ItemEntType)Convert.ToInt32(blockpar); }
     catch
     {
         try { IPar1 = Map.GetItemEntityByName(blockpar); }
         catch { player.Message("Incorrect parameter 1!"); return; }
     }
     blockpar = cmd.Next();
     string[] tmpsa = new string[16];
     int i = 0;
     while (blockpar != "" && blockpar != null)
     {
         tmpsa[i] = blockpar;
         i++;
         blockpar = cmd.Next();
     }
     player.ientpl = i;
     player.ientp = tmpsa;
     if (player.ientmode == BlockPlacementMode.ItemEnt)
     {
         player.ientmode = BlockPlacementMode.Normal;
         player.Message("ItemEntity mode: OFF");
     }
     else if (player.Can(Permissions.PlaceItemEnt))
     {
         player.ientmode = BlockPlacementMode.ItemEnt;
         player.Message("ItemEntity mode: ON. Your next blocks will be ItemEntities.");
         player.ienttype = IPar1;
         /*
         if (IPar2 >= 0 && IPar2 <= 49)
         {
             player.isIentBTDef = true;
             player.ientbt = IPar2;
         }
         */
     }
     else
     {
         player.NoAccessMessage(Permissions.PlaceItemEnt);
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:45,代码来源:BlockCommands.cs

示例15: Bring

 internal static void Bring( Player player, Command cmd )
 {
     if( player.Can( Permissions.Bring ) ) {
         string name = cmd.Next();
         Player target = player.world.FindPlayer( name );
         if( target != null ) {
             Position pos = player.pos;
             pos.x += 1;
             pos.y += 1;
             pos.h += 1;
             target.Send( PacketWriter.MakeTeleport( 255, pos ) );
         } else {
             player.NoPlayerMessage( name );
         }
     } else {
         player.NoAccessMessage( Permissions.Bring );
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:18,代码来源:StandardCommands.cs


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