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
canRate
(org.bukkit.entity.Player p) This method checks whether a givenPlayer
is able to leave a rating for thisScript
.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
isAuthor
(org.bukkit.OfflinePlayer p) This method determines whether the givenOfflinePlayer
is the author of thisScript
.void
rate
(org.bukkit.entity.Player p, boolean positive) static void
upload
(org.bukkit.entity.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
public boolean isAuthor(@Nonnull org.bukkit.OfflinePlayer p) 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
public boolean canRate(@Nonnull org.bukkit.entity.Player p) This method checks whether a givenPlayer
is able to leave a rating for thisScript
. APlayer
is unable to rate his ownScript
or aScript
he already rated before.- Parameters:
p
- ThePlayer
to check for- Returns:
- Whether the given
Player
is able to rate thisScript
-
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
public void rate(@Nonnull org.bukkit.entity.Player p, boolean positive) -
getUploadedScripts
-
upload
@ParametersAreNonnullByDefault public static void upload(org.bukkit.entity.Player p, AndroidType androidType, int id, String name, String code)
-