本文整理汇总了C#中fCraft.Command类的典型用法代码示例。如果您正苦于以下问题:C# Command类的具体用法?C# Command怎么用?C# Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Command类属于fCraft命名空间,在下文中一共展示了Command类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TrollHandler
static void TrollHandler(Player player, Command cmd)
{
string Name = cmd.Next();
if (Name == null)
{
player.Message("Player not found. Please specify valid name.");
return;
}
if (!Player.IsValidName(Name))
return;
Player target = Server.FindPlayerOrPrintMatches(player, Name, true, true);
if (target == null)
return;
string options = cmd.Next();
if (options == null)
{
CdTroll.PrintUsage(player);
return;
}
string Message = cmd.NextAll();
if (Message.Length < 1 && options.ToLower() != "leave")
{
player.Message("&WError: Please enter a message for {0}.", target.ClassyName);
return;
}
switch (options.ToLower())
{
case "pm":
if (player.Can(Permission.UseColorCodes) && Message.Contains("%"))
{
Message = Color.ReplacePercentCodes(Message);
}
Server.Players.Message("&Pfrom {0}: {1}",
target.Name, Message);
break;
case "ac":
Chat.SendAdmin(target, Message);
break;
case "st":
case "staff":
Chat.SendStaff(target, Message);
break;
case "i":
case "impersonate":
case "msg":
case "message":
case "m":
Server.Message("{0}&S&F: {1}",
target.ClassyName, Message);
break;
case "leave":
case "disconnect":
case "gtfo":
Server.Players.Message("&SPlayer {0}&S left the server.",
target.ClassyName);
break;
default: player.Message("Invalid option. Please choose st, ac, pm, message or leave");
break;
}
}
开发者ID:727021,项目名称:800craft,代码行数:60,代码来源:TrollPlugin.cs
示例2: BRB
internal static void BRB(Player player, Command cmd)
{
StreamReader streamReader = new StreamReader("plugins/brbMessage.txt");
string message = streamReader.ReadToEnd();
streamReader.Close();
string msg = cmd.NextAll().Trim();
if (player.Info.IsMuted)
{
player.MessageMuted();
return;
}
if (msg.Length > 0)
{
Server.Message("{0}&S &EWill Brb &9({1})",
player.ClassyName, msg);
player.IsAway = true;
return;
}
else
{
Server.Players.Message("&S{0} &EWill Brb &9(" + message + ")", player.ClassyName);
player.IsAway = true;
}
}
开发者ID:FonGames,项目名称:BRB-Plugin--800Craft,代码行数:25,代码来源:Class1.cs
示例3: 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
示例4: DoZone
void DoZone( Player player, Command cmd ) {
if( !player.Can( Permissions.SetSpawn ) ) {
world.NoAccessMessage( player );
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 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 = world.classes.ParseClass( property );
if( minRank != null ) {
zone.buildRank = minRank.rank;
player.tag = zone;
player.marksExpected = 2;
player.marks.Clear();
player.markCount = 0;
player.selectionCallback = MakeZone;
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:34,代码来源:MapCommands.cs
示例5: SetParametrization
public static void SetParametrization(Player p, Command cmd)
{
string strFunc = cmd.Next();
if (string.IsNullOrWhiteSpace(strFunc))
{
p.Message("Error: empty parametrization expression");
return;
}
if (strFunc.Length < 3)
{
p.Message("Error: expression is too short (should be like x=f(t,u,v))");
return;
}
strFunc = strFunc.ToLower();
try
{
string coordVar = SimpleParser.PreparseAssignment(ref strFunc);
CheckCoordVar(coordVar);
Expression expression = SimpleParser.Parse(strFunc, new string[] { "t", "u", "v" });
p.Message("Expression parsed as " + coordVar + "=" + expression.Print());
GetPlayerParametrizationCoordsStorage(p)[VarNameToIdx(coordVar[0])] = expression;
}
catch (Exception e)
{
p.Message("Error: "+e.Message);
}
}
开发者ID:GMathioud,项目名称:MyCraft,代码行数:32,代码来源:PrepareParametrizedManifold.cs
示例6: PayHandler
static void PayHandler(Player player, Command cmd)
{
string targetName = cmd.Next();
string money = cmd.Next();
int amount;
if (money == null)
{
player.Message("&ePlease select the amount of bits you wish to send.");
return;
}
Player target = Server.FindPlayerOrPrintMatches(player, targetName, false, true);
if (target == null)
{
player.Message("&ePlease select a player to pay bits towards.");
return;
}
if (!int.TryParse(money, out amount))
{
player.Message("&ePlease select from a whole number.");
return;
}
PayHandler(player, new Command("/economy pay " + target + " " + money));
}
开发者ID:venofox,项目名称:AtomicCraft,代码行数:27,代码来源:Economy.cs
示例7: StaffChat
internal static void StaffChat( Player player, Command cmd ) {
if( player.Info.IsMuted ) {
player.MutedMessage();
return;
}
if( DateTime.UtcNow < player.Info.MutedUntil ) {
player.Message( "You are muted for another {0:0} seconds.",
player.Info.MutedUntil.Subtract( DateTime.UtcNow ).TotalSeconds );
return;
}
Player[] plist = Server.PlayerList;
if( plist.Length > 0 ) player.Info.LinesWritten++;
string message = cmd.NextAll();
if( message != null && message.Trim().Length > 0 ) {
message = message.Trim();
if( player.Can( Permission.UseColorCodes ) && message.Contains( "%" ) ) {
message = Color.ReplacePercentCodes( message );
}
for( int i = 0; i < plist.Length; i++ ) {
if( (plist[i].Can( Permission.ReadStaffChat ) || plist[i] == player) && !plist[i].IsIgnoring( player.Info ) ) {
plist[i].Message( "{0}(staff){1}{0}: {2}", Color.PM, player.GetClassyName(), message );
}
}
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:30,代码来源:ChatCommands.cs
示例8: FuncDrawOperation
protected FuncDrawOperation(Player player, Command cmd)
: base(player)
{
string strFunc = cmd.Next();
if (string.IsNullOrWhiteSpace(strFunc))
{
player.Message("&WEmpty function expression");
return;
}
if (strFunc.Length < 3)
{
player.Message("&WExpression is too short (should be like z=f(x,y))");
return;
}
strFunc = strFunc.ToLower();
_vaxis = GetAxis(SimpleParser.PreparseAssignment(ref strFunc));
_expression = SimpleParser.Parse(strFunc, GetVarArray(_vaxis));
Player.Message("Expression parsed as "+_expression.Print());
string scalingStr=cmd.Next();
_scaler = new Scaler(scalingStr);
}
开发者ID:Eeyle,项目名称:LegendCraftSource,代码行数:25,代码来源:FuncDrawOperation.cs
示例9: Paint
void Paint( Player player, Command cmd ) {
player.replaceMode = !player.replaceMode;
if( player.replaceMode ){
player.Message( "Replacement mode: ON" );
} else {
player.Message( "Replacement mode: OFF" );
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:8,代码来源:BlockCommands.cs
示例10: Call
public bool Call( Player player, Command cmd, bool raiseEvent ) {
if( player == null ) throw new ArgumentNullException( "player" );
if( cmd == null ) throw new ArgumentNullException( "cmd" );
if( raiseEvent && CommandManager.RaiseCommandCallingEvent( cmd, this, player ) ) return false;
Handler( player, cmd );
if( raiseEvent ) CommandManager.RaiseCommandCalledEvent( cmd, this, player );
return true;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:8,代码来源:CommandDescriptor.cs
示例11: CancelDraw
internal static void CancelDraw( Player player, Command command )
{
if( player.marksExpected > 0 ) {
player.marksExpected = 0;
} else {
player.Message( "There is currently nothing to cancel." );
}
}
开发者ID:asiekierka,项目名称:afCraft,代码行数:8,代码来源:DrawCommands.cs
示例12: Compass
void Compass( Player player, Command cmd ) {
int offset = (int)(player.pos.r / 255f * 64f) + 32;
string name = cmd.Next();
if( name != null ) {
Player target = world.FindPlayer( name );
if( target != null ) {
player.Message( "Coordinates of player \"" + target.name + "\":" );
offset = (int)(target.pos.r / 255f * 64f) + 32;
} else {
world.NoPlayerMessage( player, name );
return;
}
}
player.Message( Color.Silver, String.Format( "({0},{1},{2}) - {3}[{4}{5}{6}{3}{7}]",
player.pos.x / 32,
player.pos.y / 32,
player.pos.h / 32,
Color.White,
compass.Substring( offset - 12, 11 ),
Color.Red,
compass.Substring( offset - 1, 3 ),
compass.Substring( offset + 2, 11 ) ) );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:25,代码来源:InfoCommands.cs
示例13: user
public bool IsConfirmed; // whether this command has been confirmed by the user (with /ok)
public Command( Command other ) {
if( other == null ) throw new ArgumentNullException( "other" );
offset = other.offset;
Message = other.Message;
Name = other.Name;
IsConfirmed = other.IsConfirmed;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:9,代码来源:Command.cs
示例14: DumpStats
internal static void DumpStats( Player player, Command cmd ) {
string fileName = cmd.Next();
if( fileName == null ) {
cdDumpStats.PrintUsage( player );
return;
}
if( !Paths.Contains( Paths.WorkingPath, fileName ) ) {
player.UnsafePathMessage();
return;
}
if( Paths.IsProtectedFileName( Path.GetFileName( fileName ) ) ) {
player.Message( "You may not use this file." );
return;
}
if( Path.HasExtension( fileName ) &&
!Path.GetExtension( fileName ).Equals( ".txt", StringComparison.OrdinalIgnoreCase ) ) {
player.Message( "Stats filename must end with .txt" );
return;
}
if( File.Exists( fileName ) && !cmd.IsConfirmed ) {
player.AskForConfirmation( cmd, "File \"{0}\" already exists. Overwrite?", Path.GetFileName( fileName ) );
return;
}
if( !Paths.TestFile( "dumpstats file", fileName, false, true, false ) ) {
player.Message( "Cannot create specified file. See log for details." );
return;
}
PlayerInfo[] infos;
using( FileStream fs = File.Create( fileName ) ) {
using( StreamWriter writer = new StreamWriter( fs ) ) {
infos = PlayerDB.GetPlayerListCopy();
if( infos.Length == 0 ) {
writer.WriteLine( "{0} (0 players)", "(TOTAL)" );
writer.WriteLine();
} else {
DumpPlayerGroupStats( writer, infos, "(TOTAL)" );
}
foreach( Rank rank in RankManager.Ranks ) {
infos = PlayerDB.GetPlayerListCopy( rank );
if( infos.Length == 0 ) {
writer.WriteLine( "{0} (0 players)", rank.Name );
writer.WriteLine();
} else {
DumpPlayerGroupStats( writer, infos, rank.Name );
}
}
}
}
player.Message( "Stats saved to \"{0}\"", Path.GetFileName( fileName ) );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:58,代码来源:MaintenanceCommands.cs
示例15: Colors
internal static void Colors( Player player, Command cmd ) {
StringBuilder sb = new StringBuilder( "List of colors: " );
foreach( var color in Color.ColorNames ) {
sb.AppendFormat( "&{0}%{0} {1} ", color.Key, color.Value );
}
player.Message( sb.ToString() );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:9,代码来源:InfoCommands.cs
示例16: Grass
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 {
world.NoAccessMessage( player );
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:11,代码来源:BlockCommands.cs
示例17: Lava
void Lava( Player player, Command cmd ) {
if( player.mode == BlockPlacementMode.Lava ) {
player.mode = BlockPlacementMode.Normal;
player.Message( "Lava: OFF." );
} else if( player.Can( Permissions.PlaceWater ) ) {
player.mode = BlockPlacementMode.Lava;
player.Message( "Lava: ON. Red blocks are replaced with lava." );
} else {
world.NoAccessMessage( player );
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:11,代码来源:BlockCommands.cs
示例18: Solid
void Solid( Player player, Command cmd ) {
if( player.mode == BlockPlacementMode.Solid ){
player.mode = BlockPlacementMode.Normal;
player.Message( "Solid: OFF" );
} else if( player.Can( Permissions.PlaceAdmincrete ) ) {
player.mode = BlockPlacementMode.Solid;
player.Message( "Solid: ON" );
} else {
world.NoAccessMessage( player );
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:11,代码来源:BlockCommands.cs
示例19: Load
void Load( Player player, Command cmd ) {
lock( loadLock ) {
if( world.loadInProgress || world.loadSendingInProgress ) {
player.Message( "Loading already in progress, please wait." );
return;
}
world.loadInProgress = true;
}
if( !player.Can( Permissions.SaveAndLoad ) ) {
world.NoAccessMessage( player );
world.loadInProgress = false;
return;
}
string mapName = cmd.Next();
if( mapName == null ) {
player.Message( "Syntax: " + Color.Help + "/load mapName" );
world.loadInProgress = false;
return;
}
string mapFileName = mapName + ".fcm";
if( !File.Exists( mapFileName ) ) {
player.Message( "No backup file \"" + mapName + "\" found." );
world.loadInProgress = false;
return;
}
Map newMap = Map.Load( world, mapFileName );
if( newMap == null ) {
player.Message( "Could not load \"" + mapFileName + "\". Check logfile for details." );
world.loadInProgress = false;
return;
}
if( newMap.widthX != world.map.widthX ||
newMap.widthY != world.map.widthY ||
newMap.height != world.map.height ) {
player.Message( "Map sizes of \"" + mapName + "\" and the current map do not match." );
world.loadInProgress = false;
return;
}
world.log.Log( "{0} is loading the map \"{1}\".", LogType.UserActivity, player.name, mapName );
player.Message( "Loading map \"" + mapName + "\"..." );
world.BeginLockDown();
MapSenderParams param = new MapSenderParams() {
map = newMap,
player = player,
world = world
};
world.tasks.Add( MapSender.StreamLoad, param, true );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:54,代码来源:MapCommands.cs
示例20: Water
void Water( Player player, Command cmd ) {
if( player.mode == BlockPlacementMode.Water ) {
player.mode = BlockPlacementMode.Normal;
player.Message( "Water: OFF" );
} else if( player.Can( Permissions.PlaceWater ) ) {
player.mode = BlockPlacementMode.Water;
player.Message( "Water: ON. Blue blocks are replaced with water." );
} else {
world.NoAccessMessage( player );
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:11,代码来源:BlockCommands.cs
注:本文中的fCraft.Command类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论