當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。