further syntax-highlighting and ignore netbeans folder.
This commit is contained in:
parent
f1925efd87
commit
39b459ab7f
6 changed files with 116 additions and 94 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -13,3 +13,5 @@ target
|
||||||
build.local.properties
|
build.local.properties
|
||||||
/src/main/javascript/lib/.#tabcomplete.js
|
/src/main/javascript/lib/.#tabcomplete.js
|
||||||
/src/main/javascript/plugins/.#example-1.js
|
/src/main/javascript/plugins/.#example-1.js
|
||||||
|
/nbproject/private/private.xml
|
||||||
|
/nbproject/project.xml
|
||||||
|
|
|
@ -693,12 +693,15 @@ function each time the event is fired.
|
||||||
|
|
||||||
The following code will print a message on screen every time a block is broken in the game
|
The following code will print a message on screen every time a block is broken in the game
|
||||||
|
|
||||||
|
```javascript
|
||||||
events.on( 'block.BlockBreakEvent', function( listener, evt ) {
|
events.on( 'block.BlockBreakEvent', function( listener, evt ) {
|
||||||
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
||||||
} );
|
} );
|
||||||
|
```
|
||||||
|
|
||||||
To handle an event only once and unregister from further events...
|
To handle an event only once and unregister from further events...
|
||||||
|
|
||||||
|
```javascript
|
||||||
events.on( 'block.BlockBreakEvent', function( listener, evt ) {
|
events.on( 'block.BlockBreakEvent', function( listener, evt ) {
|
||||||
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
||||||
evt.handlers.unregister( listener );
|
evt.handlers.unregister( listener );
|
||||||
|
@ -706,16 +709,20 @@ To handle an event only once and unregister from further events...
|
||||||
|
|
||||||
To unregister a listener *outside* of the listener function...
|
To unregister a listener *outside* of the listener function...
|
||||||
|
|
||||||
|
```javascript
|
||||||
var myBlockBreakListener = events.on( 'block.BlockBreakEvent', function( l, e ) { ... } );
|
var myBlockBreakListener = events.on( 'block.BlockBreakEvent', function( l, e ) { ... } );
|
||||||
...
|
...
|
||||||
var handlers = org.bukkit.event.block.BlockBreakEvent.getHandlerList();
|
var handlers = org.bukkit.event.block.BlockBreakEvent.getHandlerList();
|
||||||
handlers.unregister(myBlockBreakListener);
|
handlers.unregister(myBlockBreakListener);
|
||||||
|
```
|
||||||
|
|
||||||
To listen for events using a full class name as the `eventName` parameter...
|
To listen for events using a full class name as the `eventName` parameter...
|
||||||
|
|
||||||
|
```javascript
|
||||||
events.on( org.bukkit.event.block.BlockBreakEvent, function( listener, evt ) {
|
events.on( org.bukkit.event.block.BlockBreakEvent, function( listener, evt ) {
|
||||||
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
||||||
} );
|
} );
|
||||||
|
```
|
||||||
|
|
||||||
[buk2]: http://wiki.bukkit.org/Event_API_Reference
|
[buk2]: http://wiki.bukkit.org/Event_API_Reference
|
||||||
[buk]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/event/Event.html
|
[buk]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/event/Event.html
|
||||||
|
@ -950,6 +957,7 @@ an interactive sign.
|
||||||
|
|
||||||
##### plugins/signs/time-of-day.js
|
##### plugins/signs/time-of-day.js
|
||||||
|
|
||||||
|
```javascript
|
||||||
var utils = require('utils'),
|
var utils = require('utils'),
|
||||||
signs = require('signs');
|
signs = require('signs');
|
||||||
|
|
||||||
|
@ -966,13 +974,13 @@ an interactive sign.
|
||||||
onTimeChoice);
|
onTimeChoice);
|
||||||
|
|
||||||
exports.time_sign = function( player ){
|
exports.time_sign = function( player ){
|
||||||
|
|
||||||
var sign = signs.getTargetedBy(player);
|
var sign = signs.getTargetedBy(player);
|
||||||
if ( !sign ) {
|
if ( !sign ) {
|
||||||
throw new Error('You must look at a sign');
|
throw new Error('You must look at a sign');
|
||||||
}
|
}
|
||||||
convertToTimeMenu(sign);
|
convertToTimeMenu(sign);
|
||||||
};
|
};
|
||||||
|
```
|
||||||
|
|
||||||
To use the above function at the in-game prompt, look at an existing
|
To use the above function at the in-game prompt, look at an existing
|
||||||
sign and type...
|
sign and type...
|
||||||
|
@ -990,6 +998,7 @@ the entity has targeted. It is a utility function for use by plugin authors.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
|
```javascript
|
||||||
var signs = require('signs'),
|
var signs = require('signs'),
|
||||||
utils = require('utils');
|
utils = require('utils');
|
||||||
var player = utils.player('tom1234');
|
var player = utils.player('tom1234');
|
||||||
|
@ -997,6 +1006,7 @@ the entity has targeted. It is a utility function for use by plugin authors.
|
||||||
if ( !sign ) {
|
if ( !sign ) {
|
||||||
player.sendMessage('Not looking at a sign');
|
player.sendMessage('Not looking at a sign');
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
[buksign]: http://jd.bukkit.org/dev/apidocs/org/bukkit/block/Sign.html
|
[buksign]: http://jd.bukkit.org/dev/apidocs/org/bukkit/block/Sign.html
|
||||||
|
|
||||||
|
|
|
@ -892,12 +892,12 @@ type the following...
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var myskyscraper = function(floors) {
|
var myskyscraper = function(floors) {
|
||||||
|
var i ;
|
||||||
if ( typeof floors == 'undefined' ) {
|
if ( typeof floors == 'undefined' ) {
|
||||||
floors = 10;
|
floors = 10;
|
||||||
}
|
}
|
||||||
this.chkpt('myskyscraper'); // saves the drone position so it can return there later
|
this.chkpt('myskyscraper'); // saves the drone position so it can return there later
|
||||||
for (var i = 0; i < floors; i++)
|
for ( i = 0; i < floors; i++ ) {
|
||||||
{
|
|
||||||
this.box(blocks.iron,20,1,20)
|
this.box(blocks.iron,20,1,20)
|
||||||
.up()
|
.up()
|
||||||
.box0(blocks.glass_pane,20,3,20)
|
.box0(blocks.glass_pane,20,3,20)
|
||||||
|
|
4
src/docs/templates/ypgpm.md
vendored
4
src/docs/templates/ypgpm.md
vendored
|
@ -857,12 +857,12 @@ type the following...
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var myskyscraper = function(floors) {
|
var myskyscraper = function(floors) {
|
||||||
|
var i ;
|
||||||
if ( typeof floors == 'undefined' ) {
|
if ( typeof floors == 'undefined' ) {
|
||||||
floors = 10;
|
floors = 10;
|
||||||
}
|
}
|
||||||
this.chkpt('myskyscraper'); // saves the drone position so it can return there later
|
this.chkpt('myskyscraper'); // saves the drone position so it can return there later
|
||||||
for (var i = 0; i < floors; i++)
|
for ( i = 0; i < floors; i++ ) {
|
||||||
{
|
|
||||||
this.box(blocks.iron,20,1,20)
|
this.box(blocks.iron,20,1,20)
|
||||||
.up()
|
.up()
|
||||||
.box0(blocks.glass_pane,20,3,20)
|
.box0(blocks.glass_pane,20,3,20)
|
||||||
|
|
|
@ -46,12 +46,15 @@ function each time the event is fired.
|
||||||
|
|
||||||
The following code will print a message on screen every time a block is broken in the game
|
The following code will print a message on screen every time a block is broken in the game
|
||||||
|
|
||||||
|
```javascript
|
||||||
events.on( 'block.BlockBreakEvent', function( listener, evt ) {
|
events.on( 'block.BlockBreakEvent', function( listener, evt ) {
|
||||||
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
||||||
} );
|
} );
|
||||||
|
```
|
||||||
|
|
||||||
To handle an event only once and unregister from further events...
|
To handle an event only once and unregister from further events...
|
||||||
|
|
||||||
|
```javascript
|
||||||
events.on( 'block.BlockBreakEvent', function( listener, evt ) {
|
events.on( 'block.BlockBreakEvent', function( listener, evt ) {
|
||||||
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
||||||
evt.handlers.unregister( listener );
|
evt.handlers.unregister( listener );
|
||||||
|
@ -59,16 +62,20 @@ To handle an event only once and unregister from further events...
|
||||||
|
|
||||||
To unregister a listener *outside* of the listener function...
|
To unregister a listener *outside* of the listener function...
|
||||||
|
|
||||||
|
```javascript
|
||||||
var myBlockBreakListener = events.on( 'block.BlockBreakEvent', function( l, e ) { ... } );
|
var myBlockBreakListener = events.on( 'block.BlockBreakEvent', function( l, e ) { ... } );
|
||||||
...
|
...
|
||||||
var handlers = org.bukkit.event.block.BlockBreakEvent.getHandlerList();
|
var handlers = org.bukkit.event.block.BlockBreakEvent.getHandlerList();
|
||||||
handlers.unregister(myBlockBreakListener);
|
handlers.unregister(myBlockBreakListener);
|
||||||
|
```
|
||||||
|
|
||||||
To listen for events using a full class name as the `eventName` parameter...
|
To listen for events using a full class name as the `eventName` parameter...
|
||||||
|
|
||||||
|
```javascript
|
||||||
events.on( org.bukkit.event.block.BlockBreakEvent, function( listener, evt ) {
|
events.on( org.bukkit.event.block.BlockBreakEvent, function( listener, evt ) {
|
||||||
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
evt.player.sendMessage( evt.player.name + ' broke a block!');
|
||||||
} );
|
} );
|
||||||
|
```
|
||||||
|
|
||||||
[buk2]: http://wiki.bukkit.org/Event_API_Reference
|
[buk2]: http://wiki.bukkit.org/Event_API_Reference
|
||||||
[buk]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/event/Event.html
|
[buk]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/event/Event.html
|
||||||
|
|
|
@ -38,6 +38,7 @@ an interactive sign.
|
||||||
|
|
||||||
##### plugins/signs/time-of-day.js
|
##### plugins/signs/time-of-day.js
|
||||||
|
|
||||||
|
```javascript
|
||||||
var utils = require('utils'),
|
var utils = require('utils'),
|
||||||
signs = require('signs');
|
signs = require('signs');
|
||||||
|
|
||||||
|
@ -54,13 +55,13 @@ an interactive sign.
|
||||||
onTimeChoice);
|
onTimeChoice);
|
||||||
|
|
||||||
exports.time_sign = function( player ){
|
exports.time_sign = function( player ){
|
||||||
|
|
||||||
var sign = signs.getTargetedBy(player);
|
var sign = signs.getTargetedBy(player);
|
||||||
if ( !sign ) {
|
if ( !sign ) {
|
||||||
throw new Error('You must look at a sign');
|
throw new Error('You must look at a sign');
|
||||||
}
|
}
|
||||||
convertToTimeMenu(sign);
|
convertToTimeMenu(sign);
|
||||||
};
|
};
|
||||||
|
```
|
||||||
|
|
||||||
To use the above function at the in-game prompt, look at an existing
|
To use the above function at the in-game prompt, look at an existing
|
||||||
sign and type...
|
sign and type...
|
||||||
|
@ -78,6 +79,7 @@ the entity has targeted. It is a utility function for use by plugin authors.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
|
```javascript
|
||||||
var signs = require('signs'),
|
var signs = require('signs'),
|
||||||
utils = require('utils');
|
utils = require('utils');
|
||||||
var player = utils.player('tom1234');
|
var player = utils.player('tom1234');
|
||||||
|
@ -85,6 +87,7 @@ the entity has targeted. It is a utility function for use by plugin authors.
|
||||||
if ( !sign ) {
|
if ( !sign ) {
|
||||||
player.sendMessage('Not looking at a sign');
|
player.sendMessage('Not looking at a sign');
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
[buksign]: http://jd.bukkit.org/dev/apidocs/org/bukkit/block/Sign.html
|
[buksign]: http://jd.bukkit.org/dev/apidocs/org/bukkit/block/Sign.html
|
||||||
|
|
||||||
|
|
Reference in a new issue