Class Script
java.lang.Object
io.github.thebusybiscuit.slimefun4.implementation.items.androids.Script
A
Script represents runnable code for a ProgrammableAndroid.- Author:
- TheBusyBiscuit
-
Method Summary
Modifier and TypeMethodDescriptionbooleanvoiddownload()This method increases the amount of downloads by one.This returns the author of thisScript.intThis returns how often thisScripthas been downloaded.intThis method returns the amount of downvotes thisScripthas received.getName()This returns the name of thisScript.floatThis returns the "rating" of thisScript.This method returns the actual code of thisScript.getUploadedScripts(AndroidType androidType) intThis method returns the amount of upvotes thisScripthas received.booleanThis method determines whether the givenOfflinePlayeris the author of thisScript.voidstatic voidupload(Player p, AndroidType androidType, int id, String name, String code)
-
Method Details
-
getName
This returns the name of thisScript.- Returns:
- The name
-
getAuthor
This returns the author of thisScript. The author is the person who initially created and uploaded thisScript.- Returns:
- The author of this
Script
-
getSourceCode
This method returns the actual code of thisScript. It is basically aStringdescribing the order ofInstructionsthat shall be executed.- Returns:
- The code for this
Script
-
isAuthor
This method determines whether the givenOfflinePlayeris the author of thisScript.- Parameters:
p- TheOfflinePlayerto check for- Returns:
- Whether the given
OfflinePlayeris the author of thisScript.
-
canRate
-
getUpvotes
public int getUpvotes()This method returns the amount of upvotes thisScripthas received.- Returns:
- The amount of upvotes
-
getDownvotes
public int getDownvotes()This method returns the amount of downvotes thisScripthas received.- Returns:
- The amount of downvotes
-
getDownloads
public int getDownloads()This returns how often thisScripthas been downloaded.- Returns:
- The amount of downloads for this
Script.
-
getRating
public float getRating()This returns the "rating" of thisScript. This value is calculated from the up- and downvotes thisScriptreceived.- Returns:
- The rating for this
Script
-
download
public void download()This method increases the amount of downloads by one. -
rate
-
getUploadedScripts
-
upload
@ParametersAreNonnullByDefault public static void upload(Player p, AndroidType androidType, int id, String name, String code)
-