- Compatible API Versions
- 1.0.0 and higher
- Contributors
- Creadores Program
RubyEngineNK
Run Ruby on Nukkit!
Requirements:
JSEngineNK Plugin: https://cloudburstmc.org/resources/jsenginenk.939/
JSENK2: https://cloudburstmc.org/resources/jsenk2.1017/
Know Basic JavaScript.
Installation:
Easily installed with a JSEngineNK script:
Engine Creation:
Just add this code to your script and you can use Ruby!
Eval:
Default variables:
$getLogger return logger by JSEngineNK
$getServer return server
$manager return manager by JSEngineNK
$plugin return main Class by JSEngineNK
Specify Variables (put):
setNnClassLoader :
This function does the same thing as JSEngineNK's Nnclassloader API but passed to Ruby example:
It also has most of the features of PHPEngineNK (minus code conversion AND print)
evalFile:
Run Ruby code from a file:
Java methods from Ruby:
You can implement Listener events in Ruby (using Java headers and everything necessary to implement in Ruby with the engine)
More Info: https://github.com/jruby/jruby/wiki
If you want to make plugins for Nukkit, don't hesitate to contact us! Discord: https://discord.com/invite/mrmHcwxXff
Creadores Program © 2024
Run Ruby on Nukkit!
Requirements:
JSEngineNK Plugin: https://cloudburstmc.org/resources/jsenginenk.939/
JSENK2: https://cloudburstmc.org/resources/jsenk2.1017/
Know Basic JavaScript.
Installation:
Easily installed with a JSEngineNK script:
JavaScript:
const RubyS = require("RubyEngineNK/org/CreadoresProgram/RubyEngineNK.js");
Just add this code to your script and you can use Ruby!
JavaScript:
var TestRuby = new RubyS.RubyEngineNK().build();
JavaScript:
TestRuby.eval("$getLogger.info('hello world!')");
$getLogger return logger by JSEngineNK
$getServer return server
$manager return manager by JSEngineNK
$plugin return main Class by JSEngineNK
Specify Variables (put):
JavaScript:
TestRuby.put("localVariable", objectJava);//cannot be used in functions or classes only outside
TestRuby.put("$globalVariable", objectJava);//Can be used everywhere
TestRuby.put("CONSTVARIABLE", objectJava);//constant variable constant variable
//also applies to setNnClassLoader!
This function does the same thing as JSEngineNK's Nnclassloader API but passed to Ruby example:
JavaScript:
TestRuby.setNnClassLoader({ urls: ["https://test.com/test.jar"] }, {
$global: "class.example"//...
});
evalFile:
Run Ruby code from a file:
JavaScript:
TestRuby.evalFile(manager.getFile("TestRuby", "Test.rb"));
Ruby:
# Import as Java import
require 'java' #import java
java_import "cn.nukkit.Server" # Can be used as in Java without specifying, just use Server or the class name
# more info: https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
More Info: https://github.com/jruby/jruby/wiki
If you want to make plugins for Nukkit, don't hesitate to contact us! Discord: https://discord.com/invite/mrmHcwxXff
Creadores Program © 2024