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


C# Player.MessageNoZone方法代码示例

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


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

示例1: 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

示例2: ZoneRenameHandler

        static void ZoneRenameHandler( Player player, Command cmd )
        {
            World playerWorld = player.World;
            if(playerWorld==null)PlayerOpException.ThrowNoWorld( player );

            // make sure that both parameters are given
            string oldName = cmd.Next();
            string newName = cmd.Next();
            if( oldName == null || newName == null ) {
                CdZoneRename.PrintUsage( player );
                return;
            }

            // make sure that the new name is valid
            if( !World.IsValidName( newName ) ) {
                player.Message( "\"{0}\" is not a valid zone name", newName );
                return;
            }

            // find the old zone
            var zones = player.WorldMap.Zones;
            Zone oldZone = zones.Find( oldName );
            if( oldZone == null ) {
                player.MessageNoZone( oldName );
                return;
            }

            // Check if a zone with "newName" name already exists
            Zone newZone = zones.FindExact( newName );
            if( newZone != null && newZone != oldZone ) {
                player.Message( "A zone with the name \"{0}\" already exists.", newName );
                return;
            }

            // check if any change is needed
            string fullOldName = oldZone.Name;
            if( fullOldName == newName ) {
                player.Message( "The zone is already named \"{0}\"", fullOldName );
                return;
            }

            // actually rename the zone
            zones.Rename( oldZone, newName );

            // announce the rename
            playerWorld.Players.Message( "&SZone \"{0}\" was renamed to \"{1}&S\" by {2}",
                                         fullOldName, oldZone.ClassyName, player.ClassyName );
            Logger.Log( LogType.UserActivity,
                        "Player {0} renamed zone \"{1}\" to \"{2}\" on world {3}",
                        player.Name, fullOldName, newName, playerWorld.Name );
        }
开发者ID:Desertive,项目名称:800craft,代码行数:51,代码来源:ZoneCommands.cs

示例3: ZoneInfoHandler

        static void ZoneInfoHandler( Player player, Command cmd )
        {
            string zoneName = cmd.Next();
            if( zoneName == null ) {
                player.Message( "No zone name specified. See &H/Help ZInfo" );
                return;
            }

            Zone zone = player.WorldMap.Zones.Find( zoneName );
            if( zone == null ) {
                player.MessageNoZone( zoneName );
                return;
            }

            player.Message( "About zone \"{0}\": size {1} x {2} x {3}, contains {4} blocks, editable by {5}+.",
                            zone.Name,
                            zone.Bounds.Width, zone.Bounds.Length, zone.Bounds.Height,
                            zone.Bounds.Volume,
                            zone.Controller.MinRank.ClassyName );

            player.Message( "  Zone center is at ({0},{1},{2}).",
                            (zone.Bounds.XMin + zone.Bounds.XMax) / 2,
                            (zone.Bounds.YMin + zone.Bounds.YMax) / 2,
                            (zone.Bounds.ZMin + zone.Bounds.ZMax) / 2 );

            if( zone.CreatedBy != null ) {
                player.Message( "  Zone created by {0}&S on {1:MMM d} at {1:h:mm} ({2} ago).",
                                zone.CreatedBy.ClassyName,
                                zone.CreatedDate,
                                DateTime.UtcNow.Subtract( zone.CreatedDate ).ToMiniString() );
            }

            if( zone.EditedBy != null ) {
                player.Message( "  Zone last edited by {0}&S on {1:MMM d} at {1:h:mm} ({2}d {3}h ago).",
                zone.EditedBy.ClassyName,
                zone.EditedDate,
                DateTime.UtcNow.Subtract( zone.EditedDate ).Days,
                DateTime.UtcNow.Subtract( zone.EditedDate ).Hours );
            }

            PlayerExceptions zoneExceptions = zone.ExceptionList;

            if( zoneExceptions.Included.Length > 0 ) {
                player.Message( "  Zone whitelist includes: {0}",
                                zoneExceptions.Included.JoinToClassyString() );
            }

            if( zoneExceptions.Excluded.Length > 0 ) {
                player.Message( "  Zone blacklist excludes: {0}",
                                zoneExceptions.Excluded.JoinToClassyString() );
            }
        }
开发者ID:Desertive,项目名称:800craft,代码行数:52,代码来源:ZoneCommands.cs

示例4: ZoneMarkHandler

        static void ZoneMarkHandler( Player player, Command cmd )
        {
            if( player.SelectionMarksExpected == 0 ) {
                player.MessageNow( "Cannot use ZMark - no selection in progress." );
            } else if( player.SelectionMarksExpected == 2 ) {
                string zoneName = cmd.Next();
                if( zoneName == null ) {
                    CdZoneMark.PrintUsage( player );
                    return;
                }

                Zone zone = player.WorldMap.Zones.Find( zoneName );
                if( zone == null ) {
                    player.MessageNoZone( zoneName );
                    return;
                }

                player.SelectionResetMarks();
                player.SelectionAddMark( zone.Bounds.MinVertex, false );
                player.SelectionAddMark( zone.Bounds.MaxVertex, true );
            } else {
                player.MessageNow( "ZMark can only be used for 2-block selection." );
            }
        }
开发者ID:Desertive,项目名称:800craft,代码行数:24,代码来源:ZoneCommands.cs

示例5: TPZone

 static void TPZone(Player player, Command cmd)
 {
     string zoneName = cmd.Next();
     if (zoneName == null){
         player.Message("No zone name specified. See &W/Help tpzone");
         return;
     }else{
         Zone zone = player.World.Map.Zones.Find(zoneName);
         if (zone == null){
             player.MessageNoZone(zoneName);
             return;
         }
         Position zPos = new Position((((zone.Bounds.XMin + zone.Bounds.XMax) / 2) * 32),
             (((zone.Bounds.YMin + zone.Bounds.YMax) / 2) * 32),
             (((zone.Bounds.ZMin + zone.Bounds.ZMax) / 2) + 2) * 32);
         player.TeleportTo((zPos));
         player.Message("&WTeleporting you to zone " + zone.ClassyName);
     }
 }
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:19,代码来源:ModerationCommands.cs

示例6: ZoneEditHandler

        static void ZoneEditHandler( Player player, Command cmd )
        {
            bool changesWereMade = false;
            string zoneName = cmd.Next();
            if( zoneName == null ) {
                player.Message( "No zone name specified. See &H/Help ZEdit" );
                return;
            }

            Zone zone = player.WorldMap.Zones.Find( zoneName );
            if( zone == null ) {
                player.MessageNoZone( zoneName );
                return;
            }

            string name;
            while( (name = cmd.Next()) != null ) {
                if( name.Length < 2 ) continue;

                if( name.StartsWith( "+" ) ) {
                    PlayerInfo info = PlayerDB.FindPlayerInfoOrPrintMatches( player, name.Substring( 1 ) );
                    if( info == null ) return;

                    // prevent players from whitelisting themselves to bypass protection
                    if( !player.Info.Rank.AllowSecurityCircumvention && player.Info == info ) {
                        if( !zone.Controller.Check( info ) ) {
                            player.Message( "You must be {0}+&S to add yourself to this zone's whitelist.",
                                            zone.Controller.MinRank.ClassyName );
                            continue;
                        }
                    }

                    switch( zone.Controller.Include( info ) ) {
                        case PermissionOverride.Deny:
                            player.Message( "{0}&S is no longer excluded from zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            changesWereMade = true;
                            break;
                        case PermissionOverride.None:
                            player.Message( "{0}&S is now included in zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            changesWereMade = true;
                            break;
                        case PermissionOverride.Allow:
                            player.Message( "{0}&S is already included in zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            break;
                    }

                } else if( name.StartsWith( "-" ) ) {
                    PlayerInfo info = PlayerDB.FindPlayerInfoOrPrintMatches( player, name.Substring( 1 ) );
                    if( info == null ) return;

                    switch( zone.Controller.Exclude( info ) ) {
                        case PermissionOverride.Deny:
                            player.Message( "{0}&S is already excluded from zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            break;
                        case PermissionOverride.None:
                            player.Message( "{0}&S is now excluded from zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            changesWereMade = true;
                            break;
                        case PermissionOverride.Allow:
                            player.Message( "{0}&S is no longer included in zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            changesWereMade = true;
                            break;
                    }

                } else {
                    Rank minRank = RankManager.FindRank( name );

                    if( minRank != null ) {
                        // prevent players from lowering rank so bypass protection
                        if( !player.Info.Rank.AllowSecurityCircumvention &&
                            zone.Controller.MinRank > player.Info.Rank && minRank <= player.Info.Rank ) {
                            player.Message( "You are not allowed to lower the zone's rank." );
                            continue;
                        }

                        if( zone.Controller.MinRank != minRank ) {
                            zone.Controller.MinRank = minRank;
                            player.Message( "Permission for zone \"{0}\" changed to {1}+",
                                            zone.Name,
                                            minRank.ClassyName );
                            changesWereMade = true;
                        }
                    } else {
                        player.MessageNoRank( name );
                    }
                }

                if( changesWereMade ) {
                    zone.Edit( player.Info );
                } else {
                    player.Message( "No changes were made to the zone." );
                }
            }
        }
开发者ID:Desertive,项目名称:800craft,代码行数:100,代码来源:ZoneCommands.cs

示例7: ZoneRemoveHandler

        static void ZoneRemoveHandler( Player player, CommandReader cmd ) {
            if( player.World == null ) PlayerOpException.ThrowNoWorld( player );

            string zoneName = cmd.Next();
            if( zoneName == null || cmd.HasNext ) {
                CdZoneRemove.PrintUsage( player );
                return;
            }

            if( zoneName == "*" ) {
                if( !cmd.IsConfirmed ) {
                    Logger.Log( LogType.UserActivity,
                                "ZRemove: Asked {0} to confirm removing all zones on world {1}",
                                player.Name, player.World.Name );
                    player.Confirm( cmd,
                                    "&WRemove ALL zones on this world ({0}&W)? This cannot be undone.&S",
                                    player.World.ClassyName );
                    return;
                }
                player.WorldMap.Zones.Clear();
                Logger.Log( LogType.UserActivity,
                            "Player {0} removed all zones on world {1}",
                            player.Name, player.World.Name );
                Server.Message( "Player {0}&S removed all zones on world {1}",
                                player.ClassyName, player.World.ClassyName );
                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 ) {
                    Logger.Log( LogType.UserActivity,
                                "ZRemove: Asked {0} to confirm removing zone {1} from world {2}",
                                player.Name, zone.Name, player.World.Name );
                    player.Confirm( cmd, "Remove zone {0}&S?", zone.ClassyName );
                    return;
                }

                if( zones.Remove( zone.Name ) ) {
                    Logger.Log( LogType.UserActivity,
                                "Player {0} removed zone {1} from world {2}",
                                player.Name, zone.Name, player.World.Name );
                    player.Message( "Zone \"{0}\" removed.", zone.Name );
                }

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

示例8: TeleportHandler

        private static void TeleportHandler(Player player, CommandReader cmd) {
            string name = cmd.Next();
            if (name == null) {
                CdTeleport.PrintUsage(player);
                return;
            }
            if (player.World.Name.ToLower() == "maze") {
                player.Message("Hey no cheating!");
                return;
            }
            if (name == "zone") {
                string zoneName = cmd.Next();
                if (zoneName == null) {
                    player.Message("No zone name specified. See &H/Help tpzone");
                    return;
                } else {
                    Zone zone = player.World.Map.Zones.Find(zoneName);
                    if (zone == null) {
                        player.MessageNoZone(zoneName);
                        return;
                    }
                    int zoneX = (zone.Bounds.XMin + zone.Bounds.XMax)/2;
                    int zoneY = (zone.Bounds.YMin + zone.Bounds.YMax)/2;
                    int zoneZ = (zone.Bounds.ZMin + zone.Bounds.ZMax)/2;
                    retry2:
                    if (player.World.map.GetBlock(zoneX, zoneY, zoneZ - 1) == Block.Air) {
                        zoneZ = zoneZ - 1;
                        goto retry2;
                    }
                    retry:
                    if (player.World.map.GetBlock(zoneX, zoneY, zoneZ) != Block.Air ||
                        player.World.map.GetBlock(zoneX, zoneY, zoneZ + 1) != Block.Air) {
                        zoneZ = zoneZ + 1;
                        goto retry;
                    }
					Position zPos = new Position((zoneX) * 32 + 16, (zoneY) * 32 + 16, (zoneZ) * 32 + 64);
					if (player.World != null) {
						player.LastWorld = player.World;
						player.LastPosition = player.Position;
					}
                    player.TeleportTo((zPos));
                    player.Message("&sTeleporting you to zone " + zone.ClassyName);
                    return;
                }
            }
            if (name == "random" || name == "rand") {
                Random rand = new Random();
                int x = rand.Next(0, player.WorldMap.Width);
                int y = rand.Next(0, player.WorldMap.Length);
                int z = player.Position.Z/32 + 1;
                retry2:
                if (player.World.map.GetBlock(x, y, z - 3) == Block.Air) {
                    z = z - 1;
                    goto retry2;
                }
                retry:
                if (player.World.map.GetBlock(x, y, z - 2) != Block.Air ||
                    player.World.map.GetBlock(x, y, z - 1) != Block.Air) {
                    z = z + 1;
                    goto retry;
                }

				if (player.World != null) {
					player.LastWorld = player.World;
					player.LastPosition = player.Position;
				}
                player.TeleportTo(new Position {
                    X = (short) (x*32 + 16),
                    Y = (short) (y*32 + 16),
                    Z = (short) (z*32 + 16),
                    R = player.Position.R,
                    L = player.Position.L
                });
                player.Message("Teleported to: ({0}, {1}, {2})", x, y, z);
                return;
            }

            if (cmd.Next() != null) {
                cmd.Rewind();
                int x, y, z, rot, lot;
                rot = player.Position.R;
                lot = player.Position.L;
                if (cmd.NextInt(out x) && cmd.NextInt(out y) && cmd.NextInt(out z)) {
                    if (cmd.HasNext) {
                        if (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");
                                }
                                if (lot > 255 || lot < 0) {
                                    player.Message("L must be inbetween 0 and 255. Set to player L");
                                }
                            }
                        }
                    }
                    if (x <= -1024 || x >= 1024 || y <= -1024 || y >= 1024 || z <= -1024 || z >= 1024) {
                        player.Message("Coordinates are outside the valid range!");

					} else {
						if (player.World != null) {
//.........这里部分代码省略.........
开发者ID:Magi1053,项目名称:ProCraft,代码行数:101,代码来源:ModerationCommands.cs

示例9: ZoneEditHandler

        static void ZoneEditHandler( Player player, CommandReader cmd ) {
            World playerWorld = player.World;
            if( playerWorld == null ) PlayerOpException.ThrowNoWorld( player );
            bool changesWereMade = false;
            string zoneName = cmd.Next();
            if( zoneName == null ) {
                player.Message( "No zone name specified. See &H/Help ZEdit" );
                return;
            }

            Zone zone = player.WorldMap.Zones.Find( zoneName );
            if( zone == null ) {
                player.MessageNoZone( zoneName );
                return;
            }

            string nextToken;
            while( (nextToken = cmd.Next()) != null ) {
                // Clear whitelist
                if( nextToken.Equals( "-*" ) ) {
                    PlayerInfo[] oldWhitelist = zone.Controller.ExceptionList.Included;
                    if( oldWhitelist.Length > 0 ) {
                        zone.Controller.ResetIncludedList();
                        player.Message( "Whitelist of zone {0}&S cleared: {1}",
                                        zone.ClassyName, oldWhitelist.JoinToClassyString() );
                        Logger.Log( LogType.UserActivity,
                                    "Player {0} cleared whitelist of zone {1} on world {2}: {3}",
                                    player.Name, zone.Name, playerWorld.Name,
                                    oldWhitelist.JoinToString( pi => pi.Name ) );
                    } else {
                        player.Message( "Whitelist of zone {0}&S is empty.",
                                        zone.ClassyName );
                    }
                    continue;
                }

                // Clear blacklist
                if( nextToken.Equals( "+*" ) ) {
                    PlayerInfo[] oldBlacklist = zone.Controller.ExceptionList.Excluded;
                    if( oldBlacklist.Length > 0 ) {
                        zone.Controller.ResetExcludedList();
                        player.Message( "Blacklist of zone {0}&S cleared: {1}",
                                        zone.ClassyName, oldBlacklist.JoinToClassyString() );
                        Logger.Log( LogType.UserActivity,
                                    "Player {0} cleared blacklist of zone {1} on world {2}: {3}",
                                    player.Name, zone.Name, playerWorld.Name,
                                    oldBlacklist.JoinToString( pi => pi.Name ) );
                    } else {
                        player.Message( "Blacklist of zone {0}&S is empty.",
                                        zone.ClassyName );
                    }
                    continue;
                }

                if( nextToken.StartsWith( "+" ) ) {
                    PlayerInfo info = PlayerDB.FindPlayerInfoOrPrintMatches( player, nextToken.Substring( 1 ), SearchOptions.IncludeSelf );
                    if( info == null ) return;

                    // prevent players from whitelisting themselves to bypass protection
                    if( !player.Info.Rank.AllowSecurityCircumvention && player.Info == info ) {
                        switch( zone.Controller.CheckDetailed( info ) ) {
                            case SecurityCheckResult.BlackListed:
                                player.Message( "You are not allowed to remove yourself from the blacklist of zone {0}",
                                                zone.ClassyName );
                                continue;
                            case SecurityCheckResult.RankTooLow:
                                player.Message( "You must be {0}+&S to add yourself to the whitelist of zone {1}",
                                                zone.Controller.MinRank.ClassyName, zone.ClassyName );
                                continue;
                        }
                    }

                    switch( zone.Controller.Include( info ) ) {
                        case PermissionOverride.Deny:
                            player.Message( "{0}&S is no longer excluded from zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            changesWereMade = true;
                            break;
                        case PermissionOverride.None:
                            player.Message( "{0}&S is now included in zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            changesWereMade = true;
                            break;
                        case PermissionOverride.Allow:
                            player.Message( "{0}&S is already included in zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            break;
                    }

                } else if( nextToken.StartsWith( "-" ) ) {
                    PlayerInfo info = PlayerDB.FindPlayerInfoOrPrintMatches( player, nextToken.Substring( 1 ), SearchOptions.IncludeSelf );
                    if( info == null ) return;

                    switch( zone.Controller.Exclude( info ) ) {
                        case PermissionOverride.Deny:
                            player.Message( "{0}&S is already excluded from zone {1}",
                                            info.ClassyName, zone.ClassyName );
                            break;
                        case PermissionOverride.None:
                            player.Message( "{0}&S is now excluded from zone {1}",
//.........这里部分代码省略.........
开发者ID:fragmer,项目名称:fCraft,代码行数:101,代码来源:ZoneCommands.cs

示例10: TPZone

        static void TPZone(Player player, Command cmd)
        {
            string zoneName = cmd.Next();
            if (zoneName == null)
            {
                player.Message("No zone name specified. See &Z/help tpzone");
                return;
            }

            else
            {
                Zone zone = player.World.Map.Zones.Find(zoneName);
                if (zone == null)
                {
                    player.MessageNoZone(zoneName);
                    return;
                }
                TPHandler2(player, new Command("/tp " + ((zone.Bounds.XMin + zone.Bounds.XMax) / 2) + " " + ((zone.Bounds.YMin + zone.Bounds.YMax) / 2) + " " + (((zone.Bounds.ZMin + zone.Bounds.ZMax) / 2) + 2)));
            }
        }
开发者ID:Desertive,项目名称:800craft,代码行数:20,代码来源:ModerationCommands.cs

示例11: SignRemoveHandler

        static void SignRemoveHandler(Player player, CommandReader cmd)
        {
            if (player.World == null) PlayerOpException.ThrowNoWorld(player);

            string zoneName = "Sign_" + cmd.Next();
            if (zoneName == "Sign_")
            {
                CdSignRemove.PrintUsage(player);
                return;
            }

            ZoneCollection zones = player.WorldMap.Zones;
            Zone zone = zones.Find(zoneName);
            if (zone != null)
            {
                if (!cmd.IsConfirmed)
                {
                    Logger.Log(LogType.UserActivity,
                                "SRemove: Asked {0} to confirm removing Sign {1} from world {2}",
                                player.Name, zone.Name, player.World.Name);
                    player.Confirm(cmd, "Remove Sign {0}&S?", zone.ClassyName);
                    return;
                }

                if (zones.Remove(zone.Name))
                {
                    Logger.Log(LogType.UserActivity,
                                "{0} {1} &sremoved Sign {2} from world {3}",
                                player.Info.Rank.Name, player.Name, zone.Name, player.World.Name);
                    player.Message("Sign \"{0}\" removed.", zone.Name);
                }

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

示例12: ZoneRemoveHandler

        static void ZoneRemoveHandler( Player player, CommandReader cmd ) {
            if( player.World == null ) PlayerOpException.ThrowNoWorld( player );

            string zoneName = cmd.Next();
            if( zoneName == null || cmd.HasNext ) {
                CdZoneRemove.PrintUsage( player );
                return;
            }

            if( zoneName == "*" ) {
                if( !cmd.IsConfirmed ) {
                    Logger.Log( LogType.UserActivity,
                                "ZRemove: Asked {0} to confirm removing all zones on world {1}",
                                player.Name, player.World.Name );
                    player.Confirm( cmd,
                                    "&WRemove ALL zones on this world ({0}&W)? This cannot be undone.&S",
                                    player.World.ClassyName );
                    return;
                }
                player.WorldMap.Zones.Clear();
                Logger.Log( LogType.UserActivity,
                            "{0} {1} &sremoved all zones on world {2}",
                            player.Info.Rank.Name, player.Name, player.World.Name );
                Server.Message( "{0} {1}&S removed all zones on world {2}",
                                player.Info.Rank.Name, player.ClassyName, player.World.ClassyName );
                return;
            }
            ZoneCollection zones = player.WorldMap.Zones;
            Zone zone = zones.Find( zoneName );
            if (zone == null) {
                player.MessageNoZone(zoneName);
                return;
            }
            if (!canManageSpecialZone(zone.Name.ToLower(), player)) {
                return;
            }

            if (zone.Name.ToLower().StartsWith("command_")) {
                if (player.Info.Rank != RankManager.HighestRank) {
                    player.Message("You cannot affect command zones.");
                    return;
                }
            }
            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 ) {
                    Logger.Log( LogType.UserActivity,
                                "ZRemove: Asked {0} to confirm removing zone {1} from world {2}",
                                player.Name, zone.Name, player.World.Name );
                    player.Confirm( cmd, "Remove zone {0}&S?", zone.ClassyName );
                    return;
                }

                if( zones.Remove( zone.Name ) ) {
                        foreach (Player p in player.World.Players.Where(a => a.Supports(CpeExtension.SelectionCuboid))) {
                            p.Send(Packet.MakeRemoveSelection(zone.ZoneID));
                    }
                    Logger.Log( LogType.UserActivity,
                                "{0} {1} &sremoved zone {2} from world {3}",
                                player.Info.Rank.Name, player.Name, zone.Name, player.World.Name );
                    player.Message( "Zone \"{0}\" removed.", zone.Name );
                }

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

示例13: ZoneEditHandler

        static void ZoneEditHandler( Player player, CommandReader cmd ) {
            if( player.World == null ) PlayerOpException.ThrowNoWorld( player );
            bool changesWereMade = false;
            string zoneName = cmd.Next();
            if( zoneName == null ) {
                player.Message( "No zone name specified. See &H/Help ZEdit" );
                return;
            }

            Zone zone = player.WorldMap.Zones.Find( zoneName );
            if( zone == null ) {
                player.MessageNoZone( zoneName );
                return;
            }
            if (!canManageSpecialZone(zone.Name.ToLower(), player)) {
                return;
            }

            if (zone.Name.ToLower().StartsWith("command_")) {
                if (player.Info.Rank != RankManager.HighestRank) {
                    player.Message("You cannot affect command zones.");
                    return;
                }
            }

            //player.Message(cmd.RawMessage);
            //player.Message(cmd.RawMessage.Substring(cmd.Offset));
            if (cmd.RawMessage.Substring(cmd.Offset + 1).StartsWith("#"))
                {
                    zone.Sign = cmd.NextAll().Substring(1);
                    if (zone.Sign.Length == 0 || zone.Sign == null)
                    {
                        if (!Directory.Exists("./Signs/")) Directory.CreateDirectory("./Signs/");
                        if (!Directory.Exists("./Signs/" + player.World.Name + "/")) Directory.CreateDirectory("./Signs/" + player.World.Name + "/"); 
                        if (File.Exists("./Signs/" + player.World.Name + "/" + zone.Name + ".txt")) File.Delete("./Signs/" + player.World.Name + "/" + zone.Name + ".txt");
                        player.Message("&SSign Text for zone {0}&S was removed.", zone.ClassyName);
                        zone.Sign = null;
                    }
                    else
                    {
                        if (!Directory.Exists("./Signs/")) Directory.CreateDirectory("./Signs/");
                        if (!Directory.Exists("./Signs/" + player.World.Name + "/")) Directory.CreateDirectory("./Signs/" + player.World.Name + "/"); 
                        File.WriteAllText("./Signs/" + player.World.Name + "/" + zone.Name + ".txt", cmd.NextAll().Substring(1).Replace("%n", "/n"));
                        player.Message("&SSign Text for zone {0}&S changed to {1}", zone.ClassyName, zone.Sign);
                        zone.Sign = null;
                    }
                    return;
                }

            string nextToken;
            while( (nextToken = cmd.Next()) != null ) {
                // Clear whitelist
                if( nextToken.Equals( "-*" ) ) {
                    PlayerInfo[] oldWhitelist = zone.Controller.ExceptionList.Included;
                    if( oldWhitelist.Length > 0 ) {
                        zone.Controller.ResetIncludedList();
                        player.Message( "Whitelist of zone {0}&S cleared: {1}",
                                        zone.ClassyName, oldWhitelist.JoinToClassyString() );
                        Logger.Log( LogType.UserActivity,
                                    "{0} {1} &scleared whitelist of zone {2} on world {3}: {4}",
                                    player.Info.Rank.Name, player.Name, zone.Name, player.World.Name,
                                    oldWhitelist.JoinToString( pi => pi.Name ) );
                    } else {
                        player.Message( "Whitelist of zone {0}&S is empty.",
                                        zone.ClassyName );
                    }
                    continue;
                }

                // Clear blacklist
                if( nextToken.Equals( "+*" ) ) {
                    PlayerInfo[] oldBlacklist = zone.Controller.ExceptionList.Excluded;
                    if( oldBlacklist.Length > 0 ) {
                        zone.Controller.ResetExcludedList();
                        player.Message( "Blacklist of zone {0}&S cleared: {1}",
                                        zone.ClassyName, oldBlacklist.JoinToClassyString() );
                        Logger.Log( LogType.UserActivity,
                                    "{0} {1} &scleared blacklist of zone {2} on world {3}: {4}",
                                    player.Info.Rank.Name, player.Name, zone.Name, player.World.Name,
                                    oldBlacklist.JoinToString( pi => pi.Name ) );
                    } else {
                        player.Message( "Blacklist of zone {0}&S is empty.",
                                        zone.ClassyName );
                    }
                    continue;
                }

                if( nextToken.StartsWith( "+" ) ) {
                    PlayerInfo info = PlayerDB.FindPlayerInfoOrPrintMatches( player, nextToken.Substring( 1 ), SearchOptions.IncludeSelf );
                    if( info == null ) return;

                    // prevent players from whitelisting themselves to bypass protection
                    if (!player.Info.Rank.AllowSecurityCircumvention && player.Info == info)
                    {
                        switch( zone.Controller.CheckDetailed( info ) ) {
                            case SecurityCheckResult.BlackListed:
                                player.Message( "You are not allowed to remove yourself from the blacklist of zone {0}",
                                                zone.ClassyName );
                                continue;
                            case SecurityCheckResult.RankTooLow:
//.........这里部分代码省略.........
开发者ID:Magi1053,项目名称:ProCraft,代码行数:101,代码来源:ZoneCommands.cs


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