-
Notifications
You must be signed in to change notification settings - Fork 0
Helpful Methods
Available in the class matryoshika.scripter.HelperMethods are a handful of useful static methods to help you with scripting.
getTimer() returns an integer representing the ticks a server has been online. Useful for functions that needs to check against a timer. While it is highly improbable, the timer will revert back to 0 if it goes over Integer.MAX_VALUE.
executeCommand(ICommandSender, String) will execute a command as if the ICommandSender executed it. ICommandSender can be any object that extends Entity, or MinecraftServer.
If ICommandSender is null, it will automatically be executed as MinecraftServer (console), if you cannot get access to the MinecraftServer object otherwise.
String represents the raw command. Any command feature is also available here, like @p etc.
getItem(String) will return an Item singleton from the Item-Registry, where String represents it's RegistryName; For example minecraft:iron_ingot
getBlock(String) will return a Block singleton from the Block-Registry, where String represents it's RegistryName; For example minecraft:iron_block