Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/main/java/ch/njol/skript/classes/data/DefaultFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -699,6 +700,24 @@ public OfflinePlayer[] executeSimple(Object[][] params) {
.since("2.8.0, 2.9.0 (prevent lookups)");
} // end offline player function

Functions.register(DefaultFunction.builder(skript, "entity", Entity.class)
.description(
"Returns an entity from a given UUID.",
"If the entity is unloaded or an offline player, the function will return nothing."
)
.examples(
"set {_entity} to entity({uuid})",
"kill entity({uuid})",
"set {_type} to type of entity({uuid})"
Comment on lines +709 to +711
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when i said better examples i mean giving actual examples of uuids, using a literal string, or things like that, rather than just handwaving {uuid} each time.

)
.since("INSERT VERSION")
.parameter("uuid", UUID.class)
.build(args -> {
UUID uuid = args.get("uuid");
return Bukkit.getEntity(uuid);
})
);

Functions.registerFunction(new SimpleJavaFunction<Boolean>("isNaN", numberParam, DefaultClasses.BOOLEAN, true) {
@Override
public Boolean[] executeSimple(Object[][] params) {
Expand Down