diff --git a/.travis.yml b/.travis.yml index 7957a820a..a6a271e16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: java +dist: xenial jdk: - - oraclejdk8 - - openjdk7 + - oraclejdk9 + diff --git a/README.md b/README.md index 6346a7732..b961ecdea 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ ScriptCraft plugin: invoked the `/js` command. Again, this is a good jumping off point for diving into the SpigotMC API. -[dl]: http://scriptcraftjs.org/download/latest +[dl]: https://github.com/walterhiggins/ScriptCraft/releases/latest [api]: https://hub.spigotmc.org/javadocs/spigot/ [ic]: http://canarymod.net/releases [spigotdl]: https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar @@ -213,8 +213,6 @@ and plugins directories are optional and not part of ScriptCraft core. # Further Reading -ScriptCraft has [its own website][website] with further information. - * To get started using ScriptCraft to Learn JavaScript, read [The Young Person's Guide to Programming in Minecraft][yp]. * The ScriptCraft [API documentation][api]. * To delve deeper into creating your own minecraft mod for use by others, read [Creating a complete Minecraft Mod in JavaScript][mm]. @@ -256,7 +254,6 @@ You can find all files used to build this container in github project: [docker-s [yp]: docs/YoungPersonsGuideToProgrammingMinecraft.md [mm]: docs/Anatomy-of-a-Plugin.md [api]: docs/API-Reference.md -[website]: http://scriptcraftjs.org/ [cd]: http://coderdojo.com/ [scr]: http://scratch.mit.edu/ [cda]: http://cdathenry.wordpress.com/category/modderdojo/ diff --git a/docs/API-Reference.md b/docs/API-Reference.md index 5679f154c..921429bca 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -5260,7 +5260,7 @@ main thread of execution. #### Parameters - * request: The request details either a plain URL e.g. "http://scriptcraft.js/sample.json" or an object with the following properties... + * request: The request details either a plain URL e.g. "https://scriptcraft.js/sample.json" or an object with the following properties... - url: The URL of the request. - method: Should be one of the standard HTTP methods, GET, POST, PUT, DELETE (defaults to GET). @@ -5277,7 +5277,7 @@ The following example illustrates how to use http.request to make a request to a ```javascript var jsResponse; var http = require('http'); -http.request('http://scriptcraftjs.org/sample.json',function(responseCode, responseBody){ +http.request('https://scriptcraftjs.org/sample.json',function(responseCode, responseBody){ jsResponse = JSON.parse( responseBody ); }); ``` @@ -5306,7 +5306,7 @@ This module can only be used if the separate `sc-mqtt.jar` file is present in the CraftBukkit classpath. To use this module, you should ... - 1. Download sc-mqtt.jar from + 1. Download sc-mqtt.jar from 2. Save the file to the same directory where craftbukkit.jar resides. 3. Create a new batch file (windows-only) called craftbukkit-sc-mqtt.bat and edit it to include the following diff --git a/docs/YoungPersonsGuideToProgrammingMinecraft.md b/docs/YoungPersonsGuideToProgrammingMinecraft.md index da4cf2281..cc327120a 100644 --- a/docs/YoungPersonsGuideToProgrammingMinecraft.md +++ b/docs/YoungPersonsGuideToProgrammingMinecraft.md @@ -1295,7 +1295,7 @@ different objects and methods available for use by ScriptCraft. [dlbuk2]: http://dl.bukkit.org/downloads/craftbukkit/ [dlcm]: http://canarymod.net/releases [bii]: http://wiki.bukkit.org/Setting_up_a_server -[sc-plugin]: http://scriptcraftjs.org/download/ +[sc-plugin]: https://scriptcraftjs.org/download/ [ce]: http://www.codecademy.com/ [mcdv]: http://www.minecraftwiki.net/wiki/Data_values [np]: http://notepad-plus-plus.org/ diff --git a/release-notes.md b/release-notes.md index 13f7fde1b..4bb3d1938 100644 --- a/release-notes.md +++ b/release-notes.md @@ -275,7 +275,7 @@ Various bug fixes, enhanced classroom module and improved error logging on start Added support for communication with Arduino and other devices which use the [MQTT protocol][mqtt] via a new `sc-mqtt` module. This module requires a separate sc-mqtt.jar file downloadable from - which must be included + which must be included in the CraftBukkit classpath. If using MQTT in ScriptCraft, then Craftbukkit should be launched like this... diff --git a/src/docs/templates/ypgpm.md b/src/docs/templates/ypgpm.md index 3ecfc6f45..86bc043ca 100644 --- a/src/docs/templates/ypgpm.md +++ b/src/docs/templates/ypgpm.md @@ -1250,7 +1250,7 @@ different objects and methods available for use by ScriptCraft. [dlbuk2]: http://dl.bukkit.org/downloads/craftbukkit/ [dlcm]: http://canarymod.net/releases [bii]: http://wiki.bukkit.org/Setting_up_a_server -[sc-plugin]: http://scriptcraftjs.org/download/ +[sc-plugin]: https://scriptcraftjs.org/download/ [ce]: http://www.codecademy.com/ [mcdv]: http://www.minecraftwiki.net/wiki/Data_values [np]: http://notepad-plus-plus.org/ diff --git a/src/main/java/bukkit/org/scriptcraftjs/bukkit/ScriptCraftPlugin.java b/src/main/java/bukkit/org/scriptcraftjs/bukkit/ScriptCraftPlugin.java index c9c5fa4f1..d65736910 100644 --- a/src/main/java/bukkit/org/scriptcraftjs/bukkit/ScriptCraftPlugin.java +++ b/src/main/java/bukkit/org/scriptcraftjs/bukkit/ScriptCraftPlugin.java @@ -27,7 +27,7 @@ public class ScriptCraftPlugin extends JavaPlugin ClassLoader previousClassLoader = currentThread.getContextClassLoader(); currentThread.setContextClassLoader(getClassLoader()); try { - ScriptEngineManager factory = new ScriptEngineManager(); + ScriptEngineManager factory = new ScriptEngineManager(null); this.engine = factory.getEngineByName("JavaScript"); if (this.engine == null) { this.getLogger().severe(NO_JAVASCRIPT_MESSAGE); diff --git a/src/main/js/lib/scriptcraft.js b/src/main/js/lib/scriptcraft.js index 4e34a1d9a..98bc8b08d 100644 --- a/src/main/js/lib/scriptcraft.js +++ b/src/main/js/lib/scriptcraft.js @@ -575,7 +575,7 @@ function __onEnable(__engine, __plugin, __script) { Canary.manager().enablePlugin(pluginName); } else { __plugin.pluginLoader.disablePlugin(__plugin); - org.bukkit.event.HandlerList.unregisterAll(__plugin); + org.bukkit.event.HandlerList['unregisterAll(org.bukkit.plugin.Plugin)'](__plugin); server.scheduler.cancelTasks(__plugin); __plugin.pluginLoader.enablePlugin(__plugin); } diff --git a/src/main/js/lib/task-bukkit.js b/src/main/js/lib/task-bukkit.js index cfa880e9b..444e1422a 100644 --- a/src/main/js/lib/task-bukkit.js +++ b/src/main/js/lib/task-bukkit.js @@ -2,10 +2,6 @@ /*global __plugin, module, server*/ function bukkitSetTimeout(callback, delayInMillis) { var delay = Math.ceil(delayInMillis / 50); - var Run = Java.type('java.lang.Runnable'); - var MyRun = Java.extend(Run, { - run: callback - }); var task = server.scheduler[ 'runTaskLater(org.bukkit.plugin.Plugin, java.lang.Runnable ,long)' ](__plugin, callback, delay); diff --git a/src/main/js/modules/drone/index.js b/src/main/js/modules/drone/index.js index bf03745ab..369f7a696 100644 --- a/src/main/js/modules/drone/index.js +++ b/src/main/js/modules/drone/index.js @@ -345,11 +345,21 @@ function makeTypeIdAndDataSetter() { block.setTypeIdAndData(typeId, data, applyPhysics); }; } else { - console.log('Drone using CraftEvil.setTypeIdAndData method'); - var CraftEvil = Java.type(server.class.package.name + '.util.CraftEvil'); - return function(block, typeId, data, applyPhysics) { - CraftEvil.setTypeIdAndData(block, typeId, data, applyPhysics); - }; + try { + var CraftEvil = Java.type(server.class.package.name + '.util.CraftEvil'); + console.log('Drone using CraftEvil.setTypeIdAndData method'); + return function(block, typeId, data, applyPhysics) { + CraftEvil.setTypeIdAndData(block, typeId, data, applyPhysics); + }; + } catch (e) { + console.log( + 'Drone support is experimental on 1.15.2 and above, and may be broken...' + ); + return function(block, typeId, data, applyPhysics) { + block.setBlockData(data, applyPhysics); + block.setType(typeId); + }; + } } } diff --git a/src/main/js/modules/http/request.js b/src/main/js/modules/http/request.js index 913d1dc8c..687b7b3d2 100644 --- a/src/main/js/modules/http/request.js +++ b/src/main/js/modules/http/request.js @@ -14,7 +14,7 @@ main thread of execution. #### Parameters - * request: The request details either a plain URL e.g. "http://scriptcraft.js/sample.json" or an object with the following properties... + * request: The request details either a plain URL e.g. "https://scriptcraft.js/sample.json" or an object with the following properties... - url: The URL of the request. - method: Should be one of the standard HTTP methods, GET, POST, PUT, DELETE (defaults to GET). @@ -31,7 +31,7 @@ The following example illustrates how to use http.request to make a request to a ```javascript var jsResponse; var http = require('http'); -http.request('http://scriptcraftjs.org/sample.json',function(responseCode, responseBody){ +http.request('https://scriptcraftjs.org/sample.json',function(responseCode, responseBody){ jsResponse = JSON.parse( responseBody ); }); ``` @@ -80,9 +80,7 @@ function invokeNow(fn) { } function invokeLater(fn) { if (__plugin.bukkit) { - server.scheduler[ - 'runTaskAsynchronously​(org.bukkit.plugin.Plugin, java.lang.Runnable)' - ](__plugin, fn); + server.scheduler['runTaskAsynchronously(org.bukkit.plugin.Plugin, java.lang.Runnable)'](__plugin, fn); return; } if (__plugin.canary) { diff --git a/src/main/js/modules/sc-mqtt.js b/src/main/js/modules/sc-mqtt.js index 878461aaf..f7fca842c 100644 --- a/src/main/js/modules/sc-mqtt.js +++ b/src/main/js/modules/sc-mqtt.js @@ -11,7 +11,7 @@ This module can only be used if the separate `sc-mqtt.jar` file is present in the CraftBukkit classpath. To use this module, you should ... - 1. Download sc-mqtt.jar from + 1. Download sc-mqtt.jar from 2. Save the file to the same directory where craftbukkit.jar resides. 3. Create a new batch file (windows-only) called craftbukkit-sc-mqtt.bat and edit it to include the following