Merge branch 'master' of github.com:walterhiggins/ScriptCraft

This commit is contained in:
walterhiggins 2014-12-31 11:16:32 +00:00
commit 0625fab97f
3 changed files with 25 additions and 85 deletions

View file

@ -44,7 +44,6 @@ Walter Higgins
* [module name resolution](#module-name-resolution)
* [events Module](#events-module)
* [events.on() static method](#eventson-static-method)
* [bukkit](#bukkit)
* [console global variable](#console-global-variable)
* [Example](#example)
* [Using string substitutions](#using-string-substitutions)
@ -970,65 +969,6 @@ myBlockBreakListener.unregister();
[buk2]: http://wiki.bukkit.org/Event_API_Reference
[buk]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/event/Event.html
### bukkit
The bukkit global variable provides short names for commonly used Bukkit
Java classes and Enums. It also provides some helper functions for getting
players, player names and worlds.
#### bukkit.stat and bukkit.stats
This is a short name for the [org.bukkit.Statistic](http://jd.bukkit.org/rb/apidocs/org/bukkit/Statistic.html) Enum.
##### Usage
var jumpStat = bukkit.stat.JUMP; // var jumpStat = org.bukkit.Statistic.JUMP
#### bukkit.material
This is a short name for the [org.bukkit.Material](http://jd.bukkit.org/rb/apidocs/org/bukkit/Material.html) Enum.
##### Usage
var apple = bukkit.material.APPLE;
#### bukkit.art
This is a short name for the [org.bukkit.Art](http://jd.bukkit.org/rb/apidocs/org/bukkit/Art.html) Enum.
##### Usage
var sunsetArt = bukkit.art.SUNSET;
#### bukkit.mode
This is a short name for the [org.bukkit.GameMode](http://jd.bukkit.org/rb/apidocs/org/bukkit/GameMode.html) Enum.
##### Usage
var creative = bukkit.mode.CREATIVE;
#### bukkit.sound
This is a short name for the [org.bukkit.Sound](http://jd.bukkit.org/rb/apidocs/org/bukkit/Sound.html) Enum.
##### Usage
var oink = bukkit.sound.PIG_IDLE;
#### bukkit.players() function
This function returns a javascript array of all online players on the server.
#### bukkit.playerNames() function
This function returns a javascript array of player names (as javascript strings)
#### bukkit.worlds() function
This function returns a javascript array of all worlds on the server.
## console global variable
ScriptCraft provides a `console` global variable with the followng methods...
@ -4149,7 +4089,7 @@ Drones can be created in any of the following ways...
d = new Drone(self)
...will create a new Drone. If the cross-hairs are pointing at a block at the time then, that block's location becomes the drone's starting point. If the cross-hairs are _not_ pointing at a block, then the drone's starting location will be 2 blocks directly in front of the player. TIP: Building always happens right and front of the drone's position...
...will create a new Drone taking the current player as the parameter. If the player's cross-hairs are pointing at a block at the time then, that block's location becomes the drone's starting point. If the cross-hairs are _not_ pointing at a block, then the drone's starting location will be 2 blocks directly in front of the player. TIP: Building always happens right and front of the drone's position...
Plan View:
@ -4172,7 +4112,7 @@ Drones can be created in any of the following ways...
This will create a new Drone at the location you specified using x, y, z In minecraft, the X axis runs west to east and the Z axis runs north to south. The direction parameter says what direction you want the drone to face: 0 = east, 1 = south, 2 = west, 3 = north. If the direction parameter is omitted, the player's direction is used instead. Both the `direction` and `world` parameters are optional.
4. Create a new Drone based on a Bukkit Location object...
4. Create a new Drone based on a Location object...
d = new Drone(location);
@ -4186,13 +4126,13 @@ Drones can be created in any of the following ways...
#### Parameters
* location (optional) : *NB* If a `Location` object is provided as a parameter, then it should be the only parameter.
* x (optional) : The x coordinate of the Drone
* y (optional) : The y coordinate of the Drone
* z (optional) : The z coordinate of the Drone
* direction (optional) : The direction in which the Drone is
facing. Possible values are 0 (east), 1 (south), 2 (west) or 3 (north)
* world (optional) : The world in which the drone is created.
* Player : If a player reference is given as the sole parameter then the block the player was looking at will be used as the starting point for the drone. If the player was not looking at a block then the player's location will be used as the starting point. If a `Player` object is provided as a paramter then it should be the only parameter.
* location : *NB* If a `Location` object is provided as a parameter, then it should be the only parameter.
* x : The x coordinate of the Drone (x,y,z,direction and world are not needed if either a player or location parameter is provided)
* y : The y coordinate of the Drone
* z : The z coordinate of the Drone
* direction : The direction in which the Drone is facing. Possible values are 0 (east), 1 (south), 2 (west) or 3 (north)
* world : The world in which the drone is created.
### Drone.box() method

View file

@ -1,10 +1,6 @@
'use strict';
/*global module, exports, require, Packages, __plugin, server*/
var Facing = Packages.net.minecraft.util.EnumFacing,
DoorHalf = Packages.net.minecraft.block.BlockDoor.EnumDoorHalf,
HingePosition = Packages.net.minecraft.block.BlockDoor.EnumHingePosition,
DyeColor = Packages.net.minecraft.item.EnumDyeColor,
blocks = require('blocks'),
var blocks = require('blocks'),
bountiful = false;
if (__plugin.canary){
@ -13,6 +9,11 @@ if (__plugin.canary){
var lookup = {};
function initLookup(){
var Facing = Packages.net.minecraft.util.EnumFacing,
DoorHalf = Packages.net.minecraft.block.BlockDoor.EnumDoorHalf,
HingePosition = Packages.net.minecraft.block.BlockDoor.EnumHingePosition,
DyeColor = Packages.net.minecraft.item.EnumDyeColor;
lookup = {
facing: {
0: Facing.EAST,

View file

@ -49,7 +49,7 @@ Drones can be created in any of the following ways...
d = new Drone(self)
...will create a new Drone. If the cross-hairs are pointing at a block at the time then, that block's location becomes the drone's starting point. If the cross-hairs are _not_ pointing at a block, then the drone's starting location will be 2 blocks directly in front of the player. TIP: Building always happens right and front of the drone's position...
...will create a new Drone taking the current player as the parameter. If the player's cross-hairs are pointing at a block at the time then, that block's location becomes the drone's starting point. If the cross-hairs are _not_ pointing at a block, then the drone's starting location will be 2 blocks directly in front of the player. TIP: Building always happens right and front of the drone's position...
Plan View:
@ -72,7 +72,7 @@ Drones can be created in any of the following ways...
This will create a new Drone at the location you specified using x, y, z In minecraft, the X axis runs west to east and the Z axis runs north to south. The direction parameter says what direction you want the drone to face: 0 = east, 1 = south, 2 = west, 3 = north. If the direction parameter is omitted, the player's direction is used instead. Both the `direction` and `world` parameters are optional.
4. Create a new Drone based on a Bukkit Location object...
4. Create a new Drone based on a Location object...
d = new Drone(location);
@ -86,13 +86,13 @@ Drones can be created in any of the following ways...
#### Parameters
* location (optional) : *NB* If a `Location` object is provided as a parameter, then it should be the only parameter.
* x (optional) : The x coordinate of the Drone
* y (optional) : The y coordinate of the Drone
* z (optional) : The z coordinate of the Drone
* direction (optional) : The direction in which the Drone is
facing. Possible values are 0 (east), 1 (south), 2 (west) or 3 (north)
* world (optional) : The world in which the drone is created.
* Player : If a player reference is given as the sole parameter then the block the player was looking at will be used as the starting point for the drone. If the player was not looking at a block then the player's location will be used as the starting point. If a `Player` object is provided as a paramter then it should be the only parameter.
* location : *NB* If a `Location` object is provided as a parameter, then it should be the only parameter.
* x : The x coordinate of the Drone (x,y,z,direction and world are not needed if either a player or location parameter is provided)
* y : The y coordinate of the Drone
* z : The z coordinate of the Drone
* direction : The direction in which the Drone is facing. Possible values are 0 (east), 1 (south), 2 (west) or 3 (north)
* world : The world in which the drone is created.
### Drone.box() method
@ -411,7 +411,7 @@ Drone.getDirFromRotation = getDirFromRotation;
Drone.queue = [];
Drone.opsPerSec = 10;
Drone.processQueue = function(){
Drone.processQueue = function processQueue(){
var process,
i = 0,
queues = getAllQueues();
@ -423,7 +423,6 @@ Drone.processQueue = function(){
process();
} catch( e ) {
console.log('Drone build error: ' + e + ' while processing ' + process);
e.printStackTrace(java.lang.System.out);
}
}
}