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


C# Player.NoAccessMessage方法代码示例

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


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

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

示例2: Hardened

 internal static void Hardened(Player player, Command cmd)
 {
     if (player.hardenedMode == BlockPlacementMode.Hardened) {
         player.hardenedMode = BlockPlacementMode.Normal;
         player.Message("Hardened blocks: OFF");
     } else if (player.Can(Permissions.PlaceHardenedBlocks)) {
         player.hardenedMode = BlockPlacementMode.Hardened;
         player.Message("Hardened blocks: ON");
     } else {
         player.NoAccessMessage( Permissions.PlaceHardenedBlocks );
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:12,代码来源:BlockCommands.cs

示例3: Grass

 internal static void Grass( Player player, Command cmd )
 {
     if( player.mode == BlockPlacementMode.Grass ) {
         player.mode = BlockPlacementMode.Normal;
         player.Message( "Grass: OFF" );
     } else if( player.Can( Permissions.PlaceGrass ) ) {
         player.mode = BlockPlacementMode.Grass;
         player.Message( "Grass: ON. Dirt blocks are replaced with grass." );
     } else {
         player.NoAccessMessage( Permissions.PlaceGrass );
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:12,代码来源:BlockCommands.cs

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

示例5: Say

        internal static void Say( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MutedMessage();
                return;
            }

            if( player.Can( Permission.Say ) ) {
                string msg = cmd.NextAll();
                if( player.Can( Permission.UseColorCodes ) && msg.Contains( "%" ) ) {
                    msg = Color.ReplacePercentCodes( msg );
                }
                if( msg != null && msg.Trim().Length > 0 ) {
                    player.Info.LinesWritten++;
                    Server.SendToAllExceptIgnored( player, "&Y{0}", null, msg.Trim() );
                    IRC.SendAction( String.Format( "&Y{0}", msg.Trim() ) );
                } else {
                    cdSay.PrintUsage( player );
                }
            } else {
                player.NoAccessMessage( Permission.Say );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:22,代码来源:ChatCommands.cs

示例6: Freeze

 internal static void Freeze( Player player, Command cmd )
 {
     if( player.Can( Permissions.Freeze ) ) {
         string name = cmd.Next();
         Player target = Server.FindPlayer( name );
         if( target != null ) {
             if( !target.isFrozen ) {
                 Server.SendToAll( Color.Sys + target.nick + " has been frozen by " + player.nick );
                 target.isFrozen = true;
             } else {
                 player.Message( target.GetLogName() + " is already frozen." );
             }
         } else {
             player.NoPlayerMessage( name );
         }
     } else {
         player.NoAccessMessage( Permissions.Freeze );
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:19,代码来源:StandardCommands.cs

示例7: DoBan

        internal static void DoBan( Player player, Command cmd, bool banIP, bool banAll, bool unban )
        {
            if( !player.Can( Permissions.Ban ) ) {
                player.NoAccessMessage( Permissions.Ban );
                return;
            } else if( banIP && !player.Can( Permissions.BanIP ) ) {
                player.NoAccessMessage( Permissions.BanIP );
                return;
            } else if( banAll && !player.Can( Permissions.BanAll ) ) {
                player.NoAccessMessage( Permissions.BanAll );
                return;
            }

            string arg = cmd.Next();
            string reason = cmd.NextAll();
            IPAddress address;
            Player offender = Server.FindPlayer( arg );
            PlayerInfo info = PlayerDB.FindPlayerInfoExact( arg );

            // ban by IP address
            if( banIP && IPAddress.TryParse( arg, out address ) ) {
                DoIPBan( player, address, reason, null, banAll, unban );

                // ban online players
            } else if( !unban && offender != null ) {

                // check permissions
                if( !player.info.playerClass.CanBan( offender.info.playerClass ) ) {
                    player.Message( "You can only ban players ranked " + player.info.playerClass.maxBan.color + player.info.playerClass.maxBan.name + Color.Sys + " or lower." );
                    player.Message( offender.GetLogName() + " is ranked " + offender.info.playerClass.name + "." );
                } else {
                    address = offender.info.lastIP;
                    if( banIP ) DoIPBan( player, address, reason, offender.name, banAll, unban );
                    if( offender.info.ProcessBan( player.name, reason ) ) {
                        Logger.Log( "{0} was banned by {1}.", LogType.UserActivity, offender.info.name, player.GetLogName() );
                        Server.SendToAll( Color.Red + offender.name + " was banned by " + player.nick, offender );
                        offender.session.Kick( "You were just banned by " + player.GetLogName() );
                    } else {
                        player.Message( offender.name + " is already banned." );
                    }
                }

                // ban offline players
            } else if( info != null ) {
                if( !player.info.playerClass.CanBan( info.playerClass ) ) {
                    PlayerClass maxRank = player.info.playerClass.maxBan;
                    if( maxRank == null ) {
                        player.Message( "You can only ban players ranked " + player.info.playerClass.color + player.info.playerClass.name + Color.Sys + " or lower." );
                    } else {
                        player.Message( "You can only ban players ranked " + maxRank.color + maxRank.name + Color.Sys + " or lower." );
                    }
                    player.Message( info.name + " is ranked " + info.playerClass.name + "." );
                } else {
                    address = info.lastIP;
                    if( banIP ) DoIPBan( player, address, reason, info.name, banAll, unban );
                    if( unban ) {
                        if( info.ProcessUnBan( player.name, reason ) ) {
                            Logger.Log( "{0} (offline) was unbanned by {1}", LogType.UserActivity, info.name, player.GetLogName() );
                            Server.SendToAll( Color.Red + info.name + " (offline) was unbanned by " + player.nick );
                        } else {
                            player.Message( info.name + " (offline) is not currenty banned." );
                        }
                    } else {
                        if( info.ProcessBan( player.name, reason ) ) {
                            Logger.Log( "{0} (offline) was banned by {1}.", LogType.UserActivity, info.name, player.GetLogName() );
                            Server.SendToAll( Color.Red + info.name + " (offline) was banned by " + player.nick );
                        } else {
                            player.Message( info.name + " (offline) is already banned." );
                        }
                    }
                }
            } else {
                player.NoPlayerMessage( arg );
                player.Message( "Use the FULL player name for ban/unban commands." );
            }
        }
开发者ID:asiekierka,项目名称:afCraft,代码行数:76,代码来源:StandardCommands.cs

示例8: ZoneRemove

 internal static void ZoneRemove( Player player, Command cmd )
 {
     if( !player.Can( Permissions.ManageZones ) ) {
         player.NoAccessMessage( Permissions.ManageZones );
         return;
     }
     string zoneName = cmd.Next();
     if( zoneName == null ) {
         player.Message( "Usage: " + Color.Help + "/zremove ZoneName" );
         return;
     }
     if( player.world.map.RemoveZone( zoneName ) ) {
         player.Message( "Zone \"" + zoneName + "\" removed." );
     } else {
         player.Message( "No zone with the name \"" + zoneName + "\" was found." );
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:17,代码来源:MapCommands.cs

示例9: ZoneAdd

        internal static void ZoneAdd( Player player, Command cmd )
        {
            //TODO: better method names & documentation
            if( !player.Can( Permissions.ManageZones ) ) {
                player.NoAccessMessage( Permissions.ManageZones );
                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[] zones = player.world.map.ListZones();
            if( zones.Length > 0 ) {
                foreach (Zone zonel in zones)
                {
                    if (zonel.name == name)
                    {
                        player.Message("Zone '" + name + "' already exists!");
                        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 = ClassList.ParseClass( property );

            if( minRank != null ) {
                zone.buildRank = minRank.rank;
                player.tag = zone;
                player.marksExpected = 2;
                player.marks.Clear();
                player.markCount = 0;
                player.selectionCallback = ZoneAddCallback;
                player.Message( "Zone: Place a block or type /mark to use your location." );
            } else {
                player.Message( "Unknown player class: " + property );
            }
        }
开发者ID:asiekierka,项目名称:afCraft,代码行数:50,代码来源:MapCommands.cs

示例10: Save

        internal static void Save( Player player, Command cmd )
        {
            if( !player.Can( Permissions.ManageWorlds ) ) {
                player.NoAccessMessage( Permissions.ManageWorlds );
                return;
            }

            string mapName = cmd.Next();
            if( mapName == null ) {
                player.Message( "Syntax: " + Color.Help + "/save mapName" );
                return;
            }

            string mapFileName = Path.GetFileName( mapName ) + ".fcm";
            player.Message( "Saving map to \"" + mapFileName + "\"..." );
            if( player.world.map.Save( mapFileName ) ) {
                player.Message( "Map saved succesfully." );
            } else {
                player.Message( "Map saving failed. See server logs for details." );
            }
        }
开发者ID:asiekierka,项目名称:afCraft,代码行数:21,代码来源:MapCommands.cs

示例11: Unfreeze

 internal static void Unfreeze( Player player, Command cmd )
 {
     if( player.Can( Permissions.Freeze ) ) {
         string name = cmd.Next();
         Player target = Server.FindPlayer( name );
         if( target != null ) {
             if( target.isFrozen ) {
                 Server.SendToAll( Color.Sys + target.nick + " is no longer frozen." );
                 target.isFrozen = false;
             } else {
                 player.Message( target.GetLogName() + " is currently not frozen." );
             }
         } else {
             player.NoPlayerMessage( name );
         }
     } else {
         player.NoAccessMessage( Permissions.Freeze );
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:19,代码来源:StandardCommands.cs

示例12: Kick

        // Kick a player. One argument (mandatory) - player name (can be partial).
        internal static void Kick( Player player, Command cmd )
        {
            if( !player.Can( Permissions.Kick ) ) {
                player.NoAccessMessage( Permissions.Kick );
                return;
            }

            string name = cmd.Next();
            if( name != null ) {
                string msg = cmd.NextAll();
                Player offender = Server.FindPlayer( name );
                if( offender != null ) {
                    if( !player.info.playerClass.CanKick( offender.info.playerClass ) ) {
                        player.Message( "You can only kick players ranked " + player.info.playerClass.maxKick.color + player.info.playerClass.maxKick.name + Color.Sys + " or lower." );
                        player.Message( offender.GetLogName() + " is ranked " + offender.info.playerClass.name + "." );
                    } else {
                        Server.SendToAll( Color.Red + offender.nick + " was kicked by " + player.nick );
                        if( msg != null && msg != "" ) {
                            Logger.Log( "{0} was kicked by {1}. Memo: {2}", LogType.UserActivity, offender.GetLogName(), player.GetLogName(), msg );
                            offender.session.Kick( "Kicked by " + player.GetLogName() + ": " + msg );
                        } else {
                            Logger.Log( "{0} was kicked by {1}", LogType.UserActivity, offender.GetLogName(), player.GetLogName() );
                            offender.session.Kick( "You have been kicked by " + player.GetLogName() );
                        }
                    }
                } else {
                    player.NoPlayerMessage( name );
                }
            } else {
                player.Message( "Usage: " + Color.Help + "/kick PlayerName [Message]" +
                                   Color.Sys + " or " + Color.Help + "/k PlayerName [Message]" );
            }
        }
开发者ID:asiekierka,项目名称:afCraft,代码行数:34,代码来源:StandardCommands.cs

示例13: Say

 internal static void Say( Player player, Command cmd )
 {
     if( player.Can( Permissions.Say ) ) {
         string msg = cmd.NextAll();
         if( msg != null && msg.Trim().Length > 0 ) {
             Server.SendToAll( Color.Say + msg.Trim() );
         } else {
             player.Message( "Usage: " + Color.Help + "/say message" );
         }
     } else {
         player.NoAccessMessage( Permissions.Say );
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:13,代码来源:StandardCommands.cs

示例14: Unlock

 internal static void Unlock( Player player, Command cmd )
 {
     if( !player.Can( Permissions.Lock ) ) {
         player.NoAccessMessage( Permissions.Lock );
         return;
     }
     string worldName = cmd.Next();
     World world = player.world;
     if( worldName != null ) {
         world = Server.FindWorld( worldName );
         if( world == null ) {
             player.Message( "No world found with the name \"" + worldName + "\"." );
             return;
         }
     }
     if( !world.isLocked ) {
         player.Message( "The world is already unlocked." );
     } else {
         world.Unlock();
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:21,代码来源:MapCommands.cs

示例15: UnlockAll

 internal static void UnlockAll( Player player, Command cmd )
 {
     if( !player.Can( Permissions.Lock ) ) {
         player.NoAccessMessage( Permissions.Lock );
         return;
     } else {
         lock( Server.worldListLock ) {
             foreach( World world in Server.worlds.Values ) {
                 world.Unlock();
             }
         }
         player.Message( "All worlds are now unlocked." );
     }
 }
开发者ID:asiekierka,项目名称:afCraft,代码行数:14,代码来源:MapCommands.cs


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