本文整理汇总了C#中fCraft.Player.ManyMatchesMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Player.ManyMatchesMessage方法的具体用法?C# Player.ManyMatchesMessage怎么用?C# Player.ManyMatchesMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.ManyMatchesMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Join
internal static void Join( Player player, Command cmd ) {
string worldName = cmd.Next();
if( worldName == null ) {
cdJoin.PrintUsage( player );
return;
}
World[] worlds = WorldManager.FindWorlds( worldName );
SearchingForWorldEventArgs e = new SearchingForWorldEventArgs( player, worldName, worlds.ToList(), true );
WorldManager.RaiseSearchingForWorldEvent( e );
worlds = e.Matches.ToArray();
if( worlds.Length > 1 ) {
player.ManyMatchesMessage( "world", worlds );
} else if( worlds.Length == 1 ) {
World world = worlds[0];
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.GetClassyName() );
return;
}
player.StopSpectating();
if( !player.Session.JoinWorldNow( world, false, true ) ) {
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.GetClassyName(), world.AccessSecurity.MinRank.GetClassyName() );
break;
case SecurityCheckResult.RankTooLow:
player.Message( "Cannot join world {0}&S: must be {1}+",
world.GetClassyName(), world.AccessSecurity.MinRank.GetClassyName() );
break;
}
} else {
// no worlds found - see if player meant to type in "/join" and not "/tp"
Player[] players = Server.FindPlayers( player, worldName );
if( players.Length == 1 ) {
player.StopSpectating();
player.ParseMessage( "/tp " + players[0].Name, false );
} else {
player.NoWorldMessage( worldName );
}
}
}
示例2: Unignore
internal static void Unignore( Player player, Command cmd ) {
string name = cmd.Next();
if( name != null ) {
PlayerInfo targetInfo;
if( !PlayerDB.FindPlayerInfo( name, out targetInfo ) ) {
PlayerInfo[] infos = PlayerDB.FindPlayers( name );
if( infos.Length == 1 ) {
targetInfo = infos[0];
} else if( infos.Length > 1 ) {
player.ManyMatchesMessage( "player", infos );
return;
} else {
player.NoPlayerMessage( name );
return;
}
} else if( targetInfo == null ) {
player.NoPlayerMessage( name );
return;
}
if( player.Unignore( targetInfo ) ) {
player.MessageNow( "You are no longer ignoring {0}", targetInfo.GetClassyName() );
} else {
player.MessageNow( "You are not currently ignoring {0}", targetInfo.GetClassyName() );
}
} else {
PlayerInfo[] ignoreList = player.GetIgnoreList();
if( ignoreList.Length > 0 ) {
player.MessageNow( "Ignored players: {0}", ignoreList.JoinToClassyString() );
} else {
player.MessageNow( "You are not currently ignoring anyone." );
}
return;
}
}
示例3: FindPlayerOrPrintMatches
/// <summary>Find player by name using autocompletion (returns only whose whom player can see)
/// Returns null and prints message if none or multiple players matched.</summary>
/// <param name="player">Player who initiated the search. This is where messages are sent.</param>
/// <param name="name">Full or partial name of the search target.</param>
/// <param name="includeHidden">Whether to include hidden players in the search.</param>
/// <returns>Player object, or null if no player was found.</returns>
public static Player FindPlayerOrPrintMatches( Player player, string name, bool includeHidden ) {
if( player == null ) throw new ArgumentNullException( "player" );
if( name == null ) throw new ArgumentNullException( "name" );
Player[] matches;
if( includeHidden ) {
matches = FindPlayers( name );
} else {
matches = FindPlayers( player, name );
}
if( matches.Length == 0 ) {
player.NoPlayerMessage( name );
return null;
} else if( matches.Length > 1 ) {
player.ManyMatchesMessage( "player", matches );
return null;
} else {
return matches[0];
}
}
示例4: FindWorldOrPrintMatches
public static World FindWorldOrPrintMatches( Player player, string worldName ) {
if( player == null ) throw new ArgumentNullException( "player" );
if( worldName == null ) throw new ArgumentNullException( "worldName" );
List<World> matches = new List<World>( FindWorlds( worldName ) );
SearchingForWorldEventArgs e = new SearchingForWorldEventArgs( player, worldName, matches, false );
RaiseSearchingForWorldEvent( e );
matches = e.Matches;
if( matches.Count == 0 ) {
player.NoWorldMessage( worldName );
return null;
} else if( matches.Count > 1 ) {
player.ManyMatchesMessage( "world", matches.ToArray() );
return null;
} else {
return matches[0];
}
}
示例5: Info
internal static void Info( Player player, Command cmd ) {
string name = cmd.Next();
if( name == null ) {
name = player.Name;
} else if( !player.Can( Permission.ViewOthersInfo ) ) {
player.NoAccessMessage( Permission.ViewOthersInfo );
return;
}
IPAddress ip;
PlayerInfo[] infos;
if( Server.IsIP( name ) && IPAddress.TryParse( name, out ip ) ) {
// find players by IP
infos = PlayerDB.FindPlayers( ip, PlayerDB.NumberOfMatchesToPrint );
} else if( name.Contains( "*" ) || name.Contains( "." ) ) {
// find players by regex/wildcard
string regexString = "^" + RegexNonNameChars.Replace( name, "" ).Replace( "*", ".*" ) + "$";
Regex regex = new Regex( regexString, RegexOptions.IgnoreCase | RegexOptions.Compiled );
infos = PlayerDB.FindPlayers( regex, PlayerDB.NumberOfMatchesToPrint );
} else {
// find players by partial matching
PlayerInfo tempInfo;
if( !PlayerDB.FindPlayerInfo( name, out tempInfo ) ) {
infos = PlayerDB.FindPlayers( name, PlayerDB.NumberOfMatchesToPrint );
} else if( tempInfo == null ) {
player.NoPlayerMessage( name );
return;
} else {
infos = new[] { tempInfo };
}
}
if( infos.Length == 1 ) {
PrintPlayerInfo( player, infos[0] );
} else if( infos.Length > 1 ) {
player.ManyMatchesMessage( "player", infos );
if( infos.Length == PlayerDB.NumberOfMatchesToPrint ) {
player.Message( "NOTE: Only first {0} matches are shown.", PlayerDB.NumberOfMatchesToPrint );
}
} else {
player.NoPlayerMessage( name );
}
}