Package net.citizensnpcs.trait
Class ScriptTrait
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.ScriptTrait
Stores a list of scripts, which are pieces of arbitrary code that can be run every tick.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addScripts
(List<String> scripts) Add and load all given script file namesvoid
Loads a trait.void
loadScript
(String file) Compile and load a script given by the file name.void
removeScripts
(List<String> scripts) Removes the given script file names.void
run()
Called every tick if overridden.boolean
validateFile
(String file) Whether the file exists and can be compiled by the systemScriptCompiler
.
-
Field Details
-
files
-
-
Constructor Details
-
ScriptTrait
public ScriptTrait()
-
-
Method Details
-
addScripts
Add and load all given script file names- See Also:
-
getScripts
-
load
Description copied from class:Trait
Loads a trait. -
loadScript
Compile and load a script given by the file name.- Parameters:
file
- the script file name relative to the script folder- See Also:
-
removeScripts
Removes the given script file names. -
run
public void run()Description copied from class:Trait
Called every tick if overridden. -
validateFile
Whether the file exists and can be compiled by the systemScriptCompiler
.
-