Class AbstractScriptNode
java.lang.Object
com.soulfiremc.server.script.AbstractScriptNode
- All Implemented Interfaces:
ScriptNode
- Direct Known Subclasses:
AbsNode, AddNode, AndNode, AttackNode, Base64DecodeNode, Base64EncodeNode, BooleanConstantNode, BranchNode, BreakBlockNode, BSplineNode, CacheNode, CanSeePositionNode, CeilNode, ClampNode, ClickSlotNode, CloseInventoryNode, CompareNode, CompressionNode, ConcatNode, CosNode, CreateVector3Node, DebounceNode, DecryptNode, DiscordWebhookNode, DistanceNode, DivideNode, DropItemNode, DropSlotNode, EncryptNode, EndsWithNode, FilterBotsNode, FindBlockNode, FindEntityNode, FindItemNode, FirstNode, FloorNode, ForEachBotNode, ForEachNode, FormatNode, FormulaNode, GateNode, GetArmorNode, GetAtNode, GetBiomeNode, GetBlockNode, GetBotByNameNode, GetBotInfoNode, GetBotsNode, GetBotStateNode, GetDimensionNode, GetEffectsNode, GetEntityStateNode, GetExperienceNode, GetGamemodeNode, GetHealthNode, GetHungerNode, GetInventoryNode, GetLightLevelNode, GetPersistentBotVariableNode, GetPersistentInstanceVariableNode, GetPositionNode, GetRotationNode, GetSelectedSlotNode, GetSessionBotVariableNode, GetSessionInstanceVariableNode, GetTargetBlockNode, GetTimeNode, GetVelocityNode, GetWeatherNode, HashNode, IndexOfNode, IsContainerOpenNode, IsEmptyNode, IsNullNode, JoinToStringNode, JsonArrayNode, JsonGetNode, JsonObjectNode, JsonParseNode, JsonSetNode, JsonStringifyNode, JumpNode, LastNode, LerpNode, ListContainsNode, ListLengthNode, LLMChatNode, LookAtNode, LoopNode, MaxNode, MinNode, ModuloNode, MoveBackwardNode, MoveForwardNode, MultiplyNode, NotNode, NumberConstantNode, OnBotInitNode, OnChatNode, OnContainerOpenNode, OnDamageNode, OnDeathNode, OnDisconnectNode, OnIntervalNode, OnJoinNode, OnPostEntityTickNode, OnPreEntityTickNode, OnScriptEndNode, OnScriptInitNode, OpenInventoryNode, OrNode, PathfindAwayFromNode, PathfindToNode, PlaceBlockNode, PowNode, PrintNode, RandomNode, RangeNode, RateLimitNode, RegexMatchNode, RegexReplaceNode, RepeatUntilNode, ReplaceNode, RespawnNode, ResultNode, RoundNode, SelectSlotNode, SendChatNode, SequenceNode, SetPersistentBotVariableNode, SetPersistentInstanceVariableNode, SetRotationNode, SetSessionBotVariableNode, SetSessionInstanceVariableNode, SinNode, SneakNode, SplitNode, SplitVector3Node, SprintNode, SqrtNode, StartsWithNode, StateNode, StrafeLeftNode, StrafeRightNode, StringConstantNode, StringContainsNode, StringLengthNode, SubstringNode, SubtractNode, SwingHandNode, SwitchNode, TanNode, TimestampNode, ToLowerCaseNode, ToNumberNode, ToStringNode, ToUpperCaseNode, TrimNode, UseItemNode, Vector3ConstantNode, WaitNode, WebFetchNode, XorNode
Abstract base class for script nodes providing common utility methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionHelper method to create a completed Mono with empty results.completedMono(Map<String, NodeValue> results) Helper method to create a completed Mono with results.delayedEmptyMono(Duration delay) Helper method to create a delayed Mono with empty results.delayedMono(Duration delay, Map<String, NodeValue> results) Helper method to create a delayed Mono with results.Helper method to create an empty result.protected booleangetBooleanInput(Map<String, NodeValue> inputs, String name, boolean defaultValue) Helper method to get a boolean input value.protected @Nullable BotConnectiongetBotInput(Map<String, NodeValue> inputs) Helper method to get a bot from inputs.protected doublegetDoubleInput(Map<String, NodeValue> inputs, String name, double defaultValue) Helper method to get a double input value.protected floatgetFloatInput(Map<String, NodeValue> inputs, String name, float defaultValue) Helper method to get a float input value.protected <T> THelper method to get an input value with type casting.protected intgetIntInput(Map<String, NodeValue> inputs, String name, int defaultValue) Helper method to get an int input value.protected @Nullable com.google.gson.JsonElementgetJsonInput(Map<String, NodeValue> inputs, String name) Helper method to get a raw JsonElement from inputs.getListInput(Map<String, NodeValue> inputs, String name) Helper method to get a list input value as NodeValues.protected longgetLongInput(Map<String, NodeValue> inputs, String name, long defaultValue) Helper method to get a long input value.protected StringHelper method to get a string input value.getStringListInput(Map<String, NodeValue> inputs, String name) Helper method to get a list of strings.protected BotConnectionrequireBot(Map<String, NodeValue> inputs) Helper method to require a bot from inputs.Helper method to create a result map with a single value.Helper method to create a result map with multiple values.protected voidrunOnTickThread(NodeRuntime runtime, BotConnection bot, Runnable action) Helper method to run an action on the tick thread.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ScriptNode
executeReactive
-
Constructor Details
-
AbstractScriptNode
public AbstractScriptNode()
-
-
Method Details
-
getInput
-
getDoubleInput
-
getIntInput
-
getLongInput
-
getFloatInput
-
getBooleanInput
-
getStringInput
-
getListInput
-
getStringListInput
-
getBotInput
Helper method to get a bot from inputs. Returns null if the "bot" input is not set.- Parameters:
inputs- the node inputs- Returns:
- the bot connection, or null if not provided
-
requireBot
Helper method to require a bot from inputs. The bot is typically provided automatically via the execution context from an upstream trigger node or ForEachBot node.- Parameters:
inputs- the node inputs (includes execution context values)- Returns:
- the bot connection
- Throws:
IllegalStateException- if no bot is available
-
getJsonInput
-
runOnTickThread
Helper method to run an action on the tick thread. When executing synchronously on the tick thread (from entity tick triggers), runs the action directly. Otherwise, defers via ControllingTask.singleTick().- Parameters:
runtime- the node runtime (provides sync/async context)bot- the bot connectionaction- the action to execute on the tick thread
-
result
-
results
-
emptyResult
-
completedMono
-
completedEmptyMono
-
delayedMono
-
delayedEmptyMono
-