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


C# Player.MessageNoWorld方法代码示例

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


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

示例1: PortalH

        private static void PortalH(Player player, Command command)
        {
            try
            {
                String option = command.Next();

                if (option == null)
                {
                    CdPortal.PrintUsage(player);
                }
                else if (option.ToLower().Equals("create"))
                {
                    if (player.Can(Permission.ManagePortal))
                    {
                        string world = command.Next();

                        if (world != null && WorldManager.FindWorldExact(world) != null)
                        {
                            DrawOperation operation = new CuboidDrawOperation(player);
                            NormalBrush brush = new NormalBrush(Block.Water, Block.Water);

                            string blockTypeOrName = command.Next();

                            if (blockTypeOrName != null && blockTypeOrName.ToLower().Equals("lava"))
                            {
                                brush = new NormalBrush(Block.Lava, Block.Lava);
                            }
                            else if (blockTypeOrName != null && !blockTypeOrName.ToLower().Equals("water"))
                            {
                                player.Message("Invalid block, choose between water or lava.");
                                return;
                            }

                            string portalName = command.Next();

                            if (portalName == null)
                            {
                                player.PortalName = null;
                            }
                            else
                            {
                                if (!Portal.DoesNameExist(player.World, portalName))
                                {
                                    player.PortalName = portalName;
                                }
                                else
                                {
                                    player.Message("A portal with name {0} already exists in this world.", portalName);
                                    return;
                                }
                            }

                            operation.Brush = brush;
                            player.PortalWorld = world;

                            player.SelectionStart(operation.ExpectedMarks, PortalCreateCallback, operation, Permission.Draw);
                            player.Message("Click {0} blocks or use &H/Mark&S to mark the area of the portal.", operation.ExpectedMarks);
                        }
                        else
                        {
                            if (world == null)
                            {
                                player.Message("No world specified.");
                            }
                            else
                            {
                                player.MessageNoWorld(world);
                            }
                        }
                    }
                    else
                    {
                        player.MessageNoAccess(Permission.ManagePortal);
                    }
                }
                else if (option.ToLower().Equals("remove"))
                {
                    if (player.Can(Permission.ManagePortal))
                    {
                        string portalName = command.Next();

                        if (portalName == null)
                        {
                            player.Message("No portal name specified.");
                        }
                        else
                        {
                            if (player.World.Portals != null && player.World.Portals.Count > 0)
                            {
                                bool found = false;
                                Portal portalFound = null;

                                lock (player.World.Portals.SyncRoot)
                                {
                                    foreach (Portal portal in player.World.Portals)
                                    {
                                        if (portal.Name.Equals(portalName))
                                        {
                                            portalFound = portal;
                                            found = true;
//.........这里部分代码省略.........
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:101,代码来源:WorldCommands.cs

示例2: JoinHandler

        static void JoinHandler(Player player, Command cmd)
        {
            string worldName = cmd.Next();
            if (worldName == null)
            {
                CdJoin.PrintUsage(player);
                return;
            }

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

            World[] worlds = WorldManager.FindWorlds(player, worldName);

            if (worlds.Length > 1)
            {
                player.MessageManyMatches("world", worlds);

            }
            else if (worlds.Length == 1)
            {
                World world = worlds[0];
                player.LastUsedWorldName = world.Name;
                switch (world.AccessSecurity.CheckDetailed(player.Info))
                {
                    case SecurityCheckResult.Allowed:
                    case SecurityCheckResult.WhiteListed:
                        if (world.IsFull)
                        {
                            player.Message("Cannot join {0}&S: world is full.", world.ClassyName);
                            return;
                        }
                        player.StopSpectating();
                        if (!player.JoinWorldNow(world, true, WorldChangeReason.ManualJoin))
                        {
                            player.Message("ERROR: Failed to join world. See log for details.");
                        }
                        break;
                    case SecurityCheckResult.BlackListed:
                        player.Message("Cannot join world {0}&S: you are blacklisted.",
                                        world.ClassyName);
                        break;
                    case SecurityCheckResult.RankTooLow:
                        player.Message("Cannot join world {0}&S: must be {1}+",
                                        world.ClassyName, world.AccessSecurity.MinRank.ClassyName);
                        break;
                }

            }
            else
            {
                // no worlds found - see if player meant to type in "/Join" and not "/TP"
                Player[] players = Server.FindPlayers(player, worldName, true);
                if (players.Length == 1)
                {
                    player.LastUsedPlayerName = players[0].Name;
                    player.StopSpectating();
                    player.ParseMessage("/TP " + players[0].Name, false, true);
                }
                else
                {
                    player.MessageNoWorld(worldName);
                }
            }
        }
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:75,代码来源:WorldCommands.cs

示例3: HaxHandler

 private static void HaxHandler(Player player, Command cmd)
 {
     string worldName = cmd.Next();
     if (string.IsNullOrEmpty(worldName) || worldName.Length < 1)
     {
         CdHax.PrintUsage(player);
         return;
     }
     World world = WorldManager.FindWorldOrPrintMatches(player, worldName);
     if (world == null)
     {
         player.MessageNoWorld(worldName);
         return;
     }
     string hax = cmd.Next();
     if (string.IsNullOrEmpty(hax) || hax.Length < 1)
     {
         CdHax.PrintUsage(player);
         return;
     }
     if (hax.ToLower() == "on" || hax.ToLower() == "true")
     {
         if (world.Hax == true)
         {
             player.Message("&sHax are already enabled on {0}", world.ClassyName);
             return;
         }
         world.Hax = true;
         Server.Message("&sHax have been enabled on {0}", world.ClassyName);
         foreach (Player p in world.Players)
         {
             p.JoinWorld(player.World, WorldChangeReason.Rejoin);
         }
         return;
     }
     if (hax.ToLower() == "off" || hax.ToLower() == "false")
     {
         if (world.Hax == false)
         {
             player.Message("&sHax are already disabled on {0}", world.ClassyName);
             return;
         }
         world.Hax = false;
         Server.Message("&sHax have been disabled on {0}", world.ClassyName);
         foreach (Player p in world.Players) //make all players rejoin to force changes
         {
             p.JoinWorld(player.World, WorldChangeReason.Rejoin);
         }
         return;
     }
 }
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:51,代码来源:WorldCommands.cs

示例4: PortalH

        private static void PortalH(Player player, CommandReader cmd) {
            try {
                string option = cmd.Next();
                if (string.IsNullOrEmpty(option)) {
                    CdPortal.PrintUsage(player);
                    return;
                }
                switch (option.ToLower()) {
                    case "create":
                    case "add":
                        if (player.Can(Permission.CreatePortals)) {
                            string addWorld = cmd.Next();
                            if (!string.IsNullOrEmpty(addWorld) && WorldManager.FindWorldExact(addWorld) != null) {
                                DrawOperation operation = new CuboidDrawOperation(player);
                                NormalBrush brush = new NormalBrush(Block.Water, Block.Water);

                                string blockTypeOrName = cmd.Next();
                                Block pblock;
                                if (blockTypeOrName != null && Map.GetBlockByName(blockTypeOrName, false, out pblock)) {
                                    if ((!validPBlocks.Contains(pblock) && pblock <= Block.StoneBrick) || (pblock == Block.Air && player.Info.Rank != RankManager.HighestRank)) {
                                        player.Message("Invalid block, choose a non-solid block");
                                        return;
                                    } else {
                                        brush = new NormalBrush(pblock, pblock);
                                    }
                                }
                                string addPortalName = cmd.Next();
                                if (string.IsNullOrEmpty(addPortalName)) {
                                    player.PortalName = null;
                                } else {
                                    if (!Portal.DoesNameExist(player.World, addPortalName)) {
                                        player.PortalName = addPortalName;
                                    } else {
                                        player.Message("A portal with name {0} already exists in this world.", addPortalName);
                                        return;
                                    }
                                }
                                World tpWorld = WorldManager.FindWorldExact(addWorld);
                                if (cmd.HasNext) {
                                    int x, y, z, rot = player.Position.R, lot = player.Position.L;
                                    if (cmd.NextInt(out x) && cmd.NextInt(out y) && cmd.NextInt(out z)) {
                                        if (cmd.HasNext && cmd.HasNext) {
                                            if (cmd.NextInt(out rot) && cmd.NextInt(out lot)) {
                                                if (rot > 255 || rot < 0) {
                                                    player.Message("R must be inbetween 0 and 255. Set to player R");
                                                    rot = player.Position.R;
                                                }
                                                if (lot > 255 || lot < 0) {
                                                    player.Message("L must be inbetween 0 and 255. Set to player L");
                                                    lot = player.Position.L;
                                                }
                                            }
                                        }
                                        if (x < 1 || x >= 1024 || y < 1 || y >= 1024 || z < 1 || z >= 1024) {
                                            player.Message("Coordinates are outside the valid range!");
                                            return;
                                        } else {
                                            player.PortalTPPos = new Position((short)(x * 32), (short)(y * 32), (short)(z * 32), (byte)rot, (byte)lot);
                                        }
                                    } else {
                                        player.PortalTPPos = tpWorld.map == null ? new Position(0, 0, 0) : tpWorld.map.Spawn;
                                    }
                                } else {
                                    player.PortalTPPos = tpWorld.map == null ? new Position(0, 0, 0) : tpWorld.map.Spawn;
                                }
                                operation.Brush = brush;
                                player.PortalWorld = addWorld;
                                player.SelectionStart(operation.ExpectedMarks, PortalCreateCallback, operation, Permission.CreatePortals);
                                player.Message("Click {0} blocks or use &H/Mark&S to mark the area of the portal.", operation.ExpectedMarks);
                            } else {
                                if (string.IsNullOrEmpty(addWorld)) {
                                    player.Message("No world specified.");
                                } else {
                                    player.MessageNoWorld(addWorld);
                                }
                            }
                        } else {
                            player.MessageNoAccess(Permission.CreatePortals);
                        }
                        break;
                    case "remove":
                    case "delete":
                        if (player.Can(Permission.CreatePortals)) {
                            string remPortalName = cmd.Next();
                            string remWString = cmd.Next();
                            World remWorld = player.World;
                            if (!string.IsNullOrEmpty(remWString)) {
                                remWorld = WorldManager.FindWorldOrPrintMatches(player, remWString);
                            }
                            if (remWorld == null) {
                                return;
                            }
                            if (string.IsNullOrEmpty(remPortalName)) {
                                player.Message("No portal name specified.");
                            } else {
                                if (remWorld.Portals != null && remWorld.Portals.Count > 0) {
                                    bool found = false;
                                    Portal portalFound = null;
                                    lock (remWorld.Portals.SyncRoot) {
                                        foreach (Portal portal in remWorld.Portals) {
//.........这里部分代码省略.........
开发者ID:Magi1053,项目名称:ProCraft,代码行数:101,代码来源:WorldCommands.cs

示例5: 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 ) {
                player.MessageNoWorld( worldName );
                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 {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;
            }
            #region 800Craft
            //Copyright (C) <2012> <Jon Baker>
            if ( variable.ToLower() == "terrain" ) {
                if ( valueText == null ) {
                    player.Message( "&A/Env [WorldName] terrain [Normal, arbot, cool, deadly, shroom, prometheus, woodpunk, fall, snow, tron, " +
                    "mario, highres, 8bit, simple, indev, messa, portal, dokucraft, doomcraft, hexeretic, zelda " );
                    return;
                }
                switch ( valueText.ToLower() ) {
                    case "normal":
                        world.Terrain = "bc4acee575474f5266105430c3cc628b8b3948a2";
                        break;
                    case "arbot":
                        world.Terrain = "1e3eb03d8efaa862679d36c9044ce47e861ea25e";
                        break;
                    case "cool":
                        world.Terrain = "165917066357092a2e7f6b0ec358c05b36b0efa7";
                        break;
                    case "deadly":
                        world.Terrain = "cb45307db4addbaac1504529fef79d773a6e31f5";
                        break;
                    case "shroom":
                        world.Terrain = "f31b086dbae92cc1741476a3697506192b8f5814";
                        break;
                    case "prometheus":
                        world.Terrain = "f66479f2d6c812806c3e768442d45a08a868ad16";
                        break;
                    case "woodpunk":
                        world.Terrain = "dff99c37e4a792e10c3b775e6bded725f18ed6fe";
                        break;
                    case "simple":
                        world.Terrain = "85f783c3a70c0c9d523eb39e080c2ed95f45bfc2";
                        break;
                    case "highres":
                        world.Terrain = "f3dac271d7bce9954baad46e183a6a910a30d13b";
                        break;
                    case "hexeretic":
                        world.Terrain = "d8e75476281087c8482ac636a8b8e4a59fadd525";
                        break;
                    case "tron":
                        world.Terrain = "ba851c9544ba5e4eed3a8fc9b8b5bf25a4dd45e0";
                        break;
                    case "8bit":
                        world.Terrain = "5a3fb1994e2ae526815ceaaca3a4dac0051aa890";
                        break;
                    case "mario":
                        world.Terrain = "e98a37ddccbc6144306bd08f41248324965c4e5a";
                        break;
                    case "fall":
                        world.Terrain = "b7c6dcb7a858639077f95ef94e8e2d51bedc3307";
                        break;
                    case "dokucraft":
                        world.Terrain = "a101cadafd02019e14d727d3329a923a40ef040b";
                        break;
                    case "indev":
                        world.Terrain = "73d1ef4441725bdcc9ac3616205faa3dff46e12a";
                        break;
                    case "doomcraft":
                        world.Terrain = "8b72beb6fea6ed1e01c1e32e08edf5f784bc919c";
                        break;
                    case "messa":
                        world.Terrain = "db0feeac8702704a3146a71365622db55fb5a4c4";
                        break;
                    case "portal":
                        world.Terrain = "d4b455134394763296994d0c819b0ac0ea338457";
                        break;
                    case "snow":
                        world.Terrain = "0b18fb3b41874ac5fbcb43532d62e6b742adc25e";
//.........这里部分代码省略.........
开发者ID:727021,项目名称:800craft,代码行数:101,代码来源:WorldCommands.cs

示例6: JoinHandler

        static void JoinHandler( Player player, CommandReader cmd ) {
            string worldName = cmd.Next();
            if( worldName == null ) {
                CdJoin.PrintUsage( player );
                return;
            }

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

            World[] worlds = WorldManager.FindWorlds( player, worldName );

            if( worlds.Length > 1 ) {
                player.MessageManyMatches( "world", worlds );

            } else if( worlds.Length == 1 ) {
                World world = worlds[0];
                player.LastUsedWorldName = world.Name;
                switch( world.AccessSecurity.CheckDetailed( player.Info ) ) {
                    case SecurityCheckResult.Allowed:
                    case SecurityCheckResult.WhiteListed:
                        if( world.IsFull ) {
                            player.Message( "Cannot join {0}&S: world is full.", world.ClassyName );
                            return;
                        }
                        player.StopSpectating();
                        if( !player.JoinWorldNow( world, true, WorldChangeContext.ManualJoin ) ) {
                            player.Message( "ERROR: Failed to join world. See log for details." );
                        }
                        break;
                    case SecurityCheckResult.BlackListed:
                        player.Message( "Cannot join world {0}&S: you are blacklisted.",
                                        world.ClassyName );
                        break;
                    case SecurityCheckResult.RankTooLow:
                        player.Message( "Cannot join world {0}&S: must be {1}+",
                                        world.ClassyName, world.AccessSecurity.MinRank.ClassyName );
                        break;
                    // TODO: Uncomment
                    //case SecurityCheckResult.RankTooHigh:
                    //    player.Message("Cannot join world {0}&S: must be {1}-",
                    //                    world.ClassyName, world.AccessSecurity.MaxRank.ClassyName);
                    //    break;
                }

            } else {
                player.MessageNoWorld( worldName );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:55,代码来源:WorldCommands.cs


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