Added Generic node type. A generic node is a node which recieves a value of a type which is the same as the one needed. (for example if the required value for an action is a String, then the type of the generic node will then be String).
Added the List node.
Added the Get Item From List By Index parameter.
Added the Custom Display Node interface.
Added the GetAllNodes andGetNodesByType functions in NodesHandler
Fixed adding nodes from another plugin wouldnt be able to be saved.
Fixed EventInstance not being saved and retrieved correctly.
Fixed Change Sign For Player action.
Fixed sign inputted String adding empty lines as spaces.
Changed previous unimplemented list nodes to be working now. any node that used a list before this update wont be usuable now.
How to add a custom generic node:
Code (Java):
packageme.example.plugin;
importNodes.IGenericNode; importNodes.IParameter;
// note that a generic node can be any returning node, for this example we use parameter publicclass ExampleGeneric
implements IGenericNode, IParameter
{
// usually you would want to save the generic type privateClass returnType
;
// constructor for cloning mostly. Can be helpful for custom GUIs public ExampleGeneric
(Class genericType
){ this.
returnType= genericType
; }
@Override
publicboolean onGenericChosen
(Class aClass
){ // This is when the type of the generic is chosen, // some preparation can be made here. this.
returnType= aClass
; returntrue; }
@Override
public IGenericNode cloneGeneric
(){ returnnew ExampleGeneric
(this.
returnType); }
@Override
publicClass getGenericType
(){ // for this example the generic type and return type are the same // this is not always the case! // (for example lists which their return type is array but the generic is the component type) returnthis.
returnType; }
@Override
publicvoid setGenericType
(Class aClass
){ // for this example the generic type and return type are the same // this is not always the case! // (for example lists which their return type is array but the generic is the component type) this.
returnType= aClass
; }
@Override
publicString getDisplayTitle
(){ // the display title of the node in the Display GUI. // Sometimes generic nodes have weird displays, so this is to override it. return"Example Generic For Type "+returnType.
getSimpleName(); }
@Override
publicObject getParameter
(Object...
objects){ // note that the objects are the same type as the saved returnType return"Example generic: "+objects
[0].
toString(); }
@Override
publicClass getReturnType
(){ // for this example the generic type and return type are the same // this is not always the case! // (for example lists which their return type is array but the generic is the component type) returnthis.
returnType; }
@Override
publicString getDescription
(){ return"An example for generic"; }
@Override
publicClass[] getReceivedTypes
(){ // this is where we use the saved returnType, // we set the wanted value in the onGenericChosen function // and here we use it to declare which types should be received returnnewClass[]{returnType
}; }
@Override
publicString[] getReceivedTypesDescriptions
(){ returnnewString[]{"The example generic"}; } }