本文整理汇总了C#中fCraft.Player.StopSpectating方法的典型用法代码示例。如果您正苦于以下问题:C# Player.StopSpectating方法的具体用法?C# Player.StopSpectating怎么用?C# Player.StopSpectating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.StopSpectating方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnspectateHandler
static void UnspectateHandler( Player player, CommandReader cmd ) {
if( !player.StopSpectating() ) {
player.Message( "You are not currently spectating anyone." );
}
}
示例2: TeleportHandler
static void TeleportHandler( Player player, CommandReader cmd ) {
string name = cmd.Next();
if( name == null ) {
CdTeleport.PrintUsage( player );
return;
}
if( cmd.Next() != null ) {
cmd.Rewind();
int x, y, z;
if( cmd.NextInt( out x ) && cmd.NextInt( out y ) && cmd.NextInt( out z ) ) {
if( x <= -1024 || x >= 1024 || y <= -1024 || y >= 1024 || z <= -1024 || z >= 1024 ) {
player.Message( "Coordinates are outside the valid range!" );
} else {
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
} );
}
} else {
CdTeleport.PrintUsage( player );
}
} else {
if( name == "-" ) {
if( player.LastUsedPlayerName != null ) {
name = player.LastUsedPlayerName;
} else {
player.Message( "Cannot repeat player name: you haven't used any names yet." );
return;
}
}
Player[] matches = Server.FindPlayers( player, name, false, true, true );
if( matches.Length == 1 ) {
Player target = matches[0];
World targetWorld = target.World;
if( targetWorld == null ) PlayerOpException.ThrowNoWorld( target );
if( targetWorld == player.World ) {
player.TeleportTo( target.Position );
} else {
switch( targetWorld.AccessSecurity.CheckDetailed( player.Info ) ) {
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if( targetWorld.IsFull ) {
player.Message( "Cannot teleport to {0}&S because world {1}&S is full.",
target.ClassyName,
targetWorld.ClassyName );
return;
}
player.StopSpectating();
player.JoinWorld( targetWorld, WorldChangeReason.Tp, target.Position );
break;
case SecurityCheckResult.BlackListed:
player.Message( "Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.ClassyName,
targetWorld.ClassyName );
break;
case SecurityCheckResult.RankTooLow:
player.Message( "Cannot teleport to {0}&S because world {1}&S requires {2}+&S to join.",
target.ClassyName,
targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName );
break;
}
}
} else if( matches.Length > 1 ) {
player.MessageManyMatches( "player", matches );
} else {
player.MessageNoPlayer( name );
}
}
}
示例3: TeleportHandler
//.........这里部分代码省略.........
Z = (short) (z*32 + 48),
R = (byte) rot,
L = (byte) lot
});
}
} else {
CdTeleport.PrintUsage(player);
}
} else {
if (name == "-") {
if (player.LastUsedPlayerName != null) {
name = player.LastUsedPlayerName;
} else {
player.Message("Cannot repeat player name: you haven't used any names yet.");
return;
}
}
Player[] matches = Server.FindPlayers(player, name, SearchOptions.Default);
if (matches.Length == 1) {
Player target = matches[0];
World targetWorld = target.World;
if (targetWorld == null) PlayerOpException.ThrowNoWorld(target);
if (target.Info.TPDeny && target.Info.Rank >= player.Info.Rank) {
player.Message("&CThis player does not want people teleporting to them");
player.Message("Cannot teleport to {0}&S.", target.ClassyName, targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName);
return;
}
if (targetWorld == player.World) {
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(target.Position);
} else {
if (targetWorld.Name.StartsWith("PW_") &&
!targetWorld.AccessSecurity.ExceptionList.Included.Contains(player.Info)) {
player.Message(
"You cannot join due to that player being in a personal world that you cannot access.");
return;
}
switch (targetWorld.AccessSecurity.CheckDetailed(player.Info)) {
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.ClassyName,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.ClassyName, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.ClassyName,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
case SecurityCheckResult.BlackListed:
player.Message("Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.ClassyName, targetWorld.ClassyName);
break;
case SecurityCheckResult.RankTooLow:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.ClassyName,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.ClassyName, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.ClassyName,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
}
player.Message("Cannot teleport to {0}&S because world {1}&S requires {2}+&S to join.",
target.ClassyName, targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
}
} else if (matches.Length > 1) {
player.MessageManyMatches("player", matches);
}
}
}
示例4: 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);
}
}
}
示例5: BotHandler
//.........这里部分代码省略.........
}
player.Message("Changed entity model to {0} with skin {1}.", model, skinString2 ?? bot.SkinName);
bot.changeBotModel(model, skinString2 ?? bot.SkinName);
} else
player.Message(
"Usage is /Ent model <bot> <model>. Valid models are chicken, creeper, human, pig, sheep, skeleton, spider, zombie, or any block ID/Name.");
break;
case "bring":
bot.teleportBot(player.Position);
break;
case "tp":
case "teleport":
World targetWorld = bot.World;
Bot target = bot;
if (targetWorld == player.World) {
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(target.Position);
} else {
if (targetWorld.Name.StartsWith("PW_") &&
!targetWorld.AccessSecurity.ExceptionList.Included.Contains(player.Info)) {
player.Message(
"You cannot join due to that Bot being in a personal world that you cannot access.");
break;
}
switch (targetWorld.AccessSecurity.CheckDetailed(player.Info)) {
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.Name, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
case SecurityCheckResult.BlackListed:
player.Message("Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.Name, targetWorld.ClassyName);
break;
case SecurityCheckResult.RankTooLow:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.Name, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
}
player.Message("Cannot teleport to {0}&S because world {1}&S requires {2}+&S to join.",
target.Name, targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
}
break;
case "skin":
string skinString3 = cmd.Next();
if (skinString3 != null) {
if (skinString3.StartsWith("--")) {
skinString3 = string.Format("http://minecraft.net/skin/{0}.png", skinString3.Replace("--", ""));
}
if (skinString3.StartsWith("-+")) {
skinString3 = string.Format("http://skins.minecraft.net/MinecraftSkins/{0}.png", skinString3.Replace("-+", ""));
}
if (skinString3.StartsWith("++")) {
skinString3 = string.Format("http://i.imgur.com/{0}.png", skinString3.Replace("++", ""));
}
}
player.Message("Changed entity skin to {0}.", skinString3 ?? bot.Name);
bot.changeBotSkin(skinString3);
break;
default:
CdEntity.PrintUsage(player);
break;
}
}
示例6: 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 );
}
}
}
示例7: UnPossess
static void UnPossess(Player player, Command cmd)
{
if (!player.StopSpectating())
{
player.Message("You are not currently spectating anyone.");
}
}
示例8: TPHandler2
static void TPHandler2(Player player, Command cmd)
{
string name = cmd.Next();
if (name == null)
{
return;
}
if (cmd.Next() != null)
{
cmd.Rewind();
int x, y, z;
if (cmd.NextInt(out x) && cmd.NextInt(out y) && cmd.NextInt(out z))
{
if (x <= -1024 || x >= 1024 || y <= -1024 || y >= 1024 || z <= -1024 || z >= 1024)
{
player.Message("Coordinates are outside the valid range!");
}
else
{
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
});
}
}
else
{
return;
}
}
else
{
Player[] matches = Server.FindPlayers(player, name, true);
if (matches.Length == 1)
{
Player target = matches[0];
World targetWorld = target.World;
if (targetWorld == null) PlayerOpException.ThrowNoWorld(target);
if (targetWorld == player.World)
{
player.TeleportTo(target.Position);
}
else
{
switch (targetWorld.AccessSecurity.CheckDetailed(player.Info))
{
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if (targetWorld.IsFull)
{
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.ClassyName,
targetWorld.ClassyName);
return;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
case SecurityCheckResult.BlackListed:
player.Message("Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.ClassyName,
targetWorld.ClassyName);
break;
case SecurityCheckResult.RankTooLow:
player.Message("Cannot teleport to {0}&S because world {1}&S requires {2}+&S to join.",
target.ClassyName,
targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName);
break;
// TODO: case PermissionType.RankTooHigh:
}
}
}
else if (matches.Length > 1)
{
player.MessageManyMatches("player", matches);
}
else
{
// Try to guess if player typed "/TP" instead of "/Join"
World[] worlds = WorldManager.FindWorlds(player, name);
if (worlds.Length == 1)
{
player.LastUsedWorldName = worlds[0].Name;
player.StopSpectating();
player.ParseMessage("/Join " + worlds[0].Name, false);
//.........这里部分代码省略.........
示例9: UnspectateHandler
static void UnspectateHandler( Player player, CommandReader cmd ) {
if( cmd.HasNext ) {
CdUnspectate.PrintUsage( player );
return;
}
if( !player.StopSpectating() ) {
player.Message( "You are not currently spectating anyone." );
}
}
示例10: 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 );
}
}
示例11: AbortAllHandler
static void AbortAllHandler( Player player, Command cmd )
{
player.IsPainting = false; // /paint
player.ResetAllBinds(); // /bind
player.ParseMessage( "/brush normal", false, false ); // /brush (totally not a sneaky way to do this)
player.BuildingPortal = false; // /portal
player.fireworkMode = false; // /fireworks
player.GunMode = false; // /gun
player.IsRepeatingSelection = false; // /static
player.SelectionCancel(); // /cancel
player.StopSpectating(); // /spectate
player.towerMode = false; // /tower
player.ParseMessage( "/nvm", false, false ); // /nvm
}