Exemplo n.º 1
0
        internal static void Paste( Player player, Command cmd ) {
            if( player.CopyInformation == null ) {
                player.MessageNow( "Nothing to paste! Copy something first." );
                return;
            }

            List<Block> includedTypes = new List<Block>();
            string includedBlockName = cmd.Next();
            if( includedBlockName != null ) {
                do {
                    Block includedType = Map.GetBlockByName( includedBlockName );
                    if( includedType != Block.Undefined ) {
                        includedTypes.Add( includedType );
                    } else {
                        player.MessageNow( "PasteNot: Unrecognized block type: {0}", includedBlockName );
                        return;
                    }
                } while( (includedBlockName = cmd.Next()) != null );
            }

            PasteArgs args;
            if( includedTypes.Count > 0 ) {
                args = new PasteArgs {
                    DoInclude = true,
                    BlockTypes = includedTypes.ToArray()
                };
                player.MessageNow( "Ready to paste ONLY {0}", includedTypes.JoinToString() );
            } else {
                args = new PasteArgs {
                    BlockTypes = new Block[0]
                };
            }

            player.SetCallback( 1, PasteCallback, args, cdPaste.Permissions );

            player.MessageNow( "Paste: Place a block or type /mark to use your location. " );
        }
Exemplo n.º 2
0
        internal static void PasteNot( Player player, Command cmd ) {
            if( player.CopyInformation == null ) {
                player.MessageNow( "Nothing to paste! Copy something first." );
                return;
            }

            PasteArgs args;

            List<Block> excludedTypes = new List<Block>();
            string excludedBlockName = cmd.Next();
            if( excludedBlockName != null ) {
                do {
                    Block excludedType = Map.GetBlockByName( excludedBlockName );
                    if( excludedType != Block.Undefined ) {
                        excludedTypes.Add( excludedType );
                    } else {
                        player.MessageNow( "PasteNot: Unrecognized block type: {0}", excludedBlockName );
                        return;
                    }
                } while( (excludedBlockName = cmd.Next()) != null );
            }

            if( excludedTypes.Count > 0 ) {
                args = new PasteArgs {
                    DoExclude = true,
                    BlockTypes = excludedTypes.ToArray()
                };
                player.MessageNow( "Ready to paste all EXCEPT {0}",
                                   excludedTypes.JoinToString() );
            } else {
                player.MessageNow( "PasteNot: Please specify block(s) to exclude." );
                return;
            }

            player.SetCallback( 1, PasteCallback, args, cdPasteNot.Permissions );

            player.MessageNow( "PasteNot: Place a block or type /mark to use your location. " );
        }