Proxies
[a] [new] proxy [instance] of %javatypes% (using|from) %objects%[the] function(s| [reference[s]]) %strings% [called with [[the] [arg[ument][s]]] %-objects%]import:
org.bukkit.Bukkit
ch.njol.skript.Skript
java.lang.Runnable
function do_something():
broadcast "It does something!"
command /proxy:
trigger:
# As you can see on https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html
# the Runnable interface has one method: run
set {_functions::run} to function reference "do_something"
set {_proxy} to new proxy instance of Runnable using {_functions::*}
{_proxy}.run() # will broadcast 'It does something!'
Bukkit.getScheduler().runTask(Skript.getInstance(), {_proxy}) # also broadcasts 'It does something!'import:
org.bukkit.Bukkit
ch.njol.skript.Skript
java.lang.Runnable
command /proxy:
trigger:
# As you can see on https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html
# the Runnable interface has one method: run
create section with {_proxy} stored in {_functions::run}:
broadcast "It does something!"
set {_proxy} to new proxy instance of Runnable using {_functions::*}
{_proxy}.run() # will broadcast 'It does something!'
Bukkit.getScheduler().runTask(Skript.getInstance(), {_proxy}) # also broadcasts 'It does something!'Last updated