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 TypeMethodDescriptionboolean
void
download()
This method increases the amount of downloads by one.This returns the author of thisScript
.int
This returns how often thisScript
has been downloaded.int
This method returns the amount of downvotes thisScript
has received.getName()
This returns the name of thisScript
.float
This returns the "rating" of thisScript
.This method returns the actual code of thisScript
.getUploadedScripts
(AndroidType androidType) int
This method returns the amount of upvotes thisScript
has received.boolean
This method determines whether the givenOfflinePlayer
is the author of thisScript
.void
static void
upload
(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 aString
describing the order ofInstructions
that shall be executed.- Returns:
- The code for this
Script
-
isAuthor
This method determines whether the givenOfflinePlayer
is the author of thisScript
.- Parameters:
p
- TheOfflinePlayer
to check for- Returns:
- Whether the given
OfflinePlayer
is the author of thisScript
.
-
canRate
-
getUpvotes
public int getUpvotes()This method returns the amount of upvotes thisScript
has received.- Returns:
- The amount of upvotes
-
getDownvotes
public int getDownvotes()This method returns the amount of downvotes thisScript
has received.- Returns:
- The amount of downvotes
-
getDownloads
public int getDownloads()This returns how often thisScript
has 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 thisScript
received.- 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)
-