From 922a57b7df9e34da90b7e81c53951e4e3755a943 Mon Sep 17 00:00:00 2001 From: Walter Higgins Date: Wed, 31 Dec 2014 09:12:57 +0000 Subject: [PATCH 1/2] fix problems on Mac OS --- src/main/js/modules/blockhelper.js | 11 ++++++----- src/main/js/plugins/drone/drone.js | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/js/modules/blockhelper.js b/src/main/js/modules/blockhelper.js index 4902bc5..d20decd 100644 --- a/src/main/js/modules/blockhelper.js +++ b/src/main/js/modules/blockhelper.js @@ -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, diff --git a/src/main/js/plugins/drone/drone.js b/src/main/js/plugins/drone/drone.js index 0e5b7fd..636f76b 100644 --- a/src/main/js/plugins/drone/drone.js +++ b/src/main/js/plugins/drone/drone.js @@ -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); } } } From 132d4d5c9f82c8674fd2b3d86464889417ad9e4c Mon Sep 17 00:00:00 2001 From: Walter Higgins Date: Wed, 31 Dec 2014 09:40:30 +0000 Subject: [PATCH 2/2] fix issue #185 --- docs/API-Reference.md | 78 ++++-------------------------- src/main/js/plugins/drone/drone.js | 18 +++---- 2 files changed, 18 insertions(+), 78 deletions(-) diff --git a/docs/API-Reference.md b/docs/API-Reference.md index c878ffc..6099932 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -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) @@ -971,65 +970,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... @@ -4150,7 +4090,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: @@ -4173,7 +4113,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); @@ -4187,13 +4127,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 diff --git a/src/main/js/plugins/drone/drone.js b/src/main/js/plugins/drone/drone.js index 636f76b..4f1cc86 100644 --- a/src/main/js/plugins/drone/drone.js +++ b/src/main/js/plugins/drone/drone.js @@ -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