Skip to content

Commit

Permalink
Fixes and documentation corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
APickledWalrus committed May 24, 2024
1 parent cc4c882 commit 3e501b5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private enum PlaceholderPart {
@Override
public boolean init(Expression<?> @NotNull [] exprs, int matchedPattern, @NotNull Kleenean isDelayed, @NotNull ParseResult parseResult) {
if (!getParser().isCurrentEvent(PlaceholderEvent.class)) {
Skript.error("The placeholder can only be used in a placeholder request event");
Skript.error("'the placeholder' can only be used in custom placeholders");
return false;
}
this.part = PlaceholderPart.values()[parseResult.mark];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ExprPlaceholderResult extends SimpleExpression<String> {
@Override
public boolean init(Expression<?> @NotNull [] exprs, int matchedPattern, @NotNull Kleenean isDelayed, @NotNull ParseResult parseResult) {
if (!getParser().isCurrentEvent(PlaceholderEvent.class)) {
Skript.error("The placeholder result can only be used in a placeholder request event");
Skript.error("'the placeholder result' can only be used in custom placeholders");
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
"\t\tset {_ping} to the placeholder \"player_ping\" from arg-1 # PlaceholderAPI",
"\t\tset {_ping} to the placeholder \"{ping}\" from arg-1 # MVdWPlaceholderAPI",
"\t\tsend \"Ping of %arg-1%: %{_ping}%\" to the player",
"",
"command /friend status <player> <player>:",
"\ttrigger:",
"\tset {_status} to the relational placeholder \"friendship_status\" from arg-1 and arg-2",
"\tset {_status} to the relational placeholder \"rel_friendship_status\" from arg-1 and arg-2",
"\tsend \"Status: %{_status}%\" to the player"
})
@Since("1.0.0, 1.2.0 (MVdWPlaceholderAPI support), 1.7.0 (relational placeholder support)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public class ExprRelationalPlayers extends SimpleExpression<Player> {

@Override
public boolean init(Expression<?> @NotNull [] expressions, int matchedPattern, @NotNull Kleenean kleenean, @NotNull ParseResult parseResult) {
first = matchedPattern == 0;
if (!getParser().isCurrentEvent(RelationalPlaceholderEvent.class)) {
Skript.error("'the " + (first ? "first" : "second") + " player' can only be used in custom relational placeholders.");
return false;
}
first = matchedPattern == 0;
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@
import java.util.Arrays;
import java.util.List;

@Name("Placeholder Request")
@Name("Custom Placeholder")
@Description({
"Triggers whenever the value of a placeholder is requested by a supported placeholder plugin.",
"A structure for creating custom placeholders.",
"The code will be executed every time the placeholder plugin requests a value for the placeholder."
})
@Examples({
"on placeholderapi placeholder request for the prefix \"skriptplaceholders\":",
"\tif the identifier is \"author\": # Placeholder is \"%skriptplaceholders_author%\"",
"\t\tset the result to \"APickledWalrus\"",
"on placeholderapi placeholder request for the relational prefix \"skriptplaceholders\":",
"\tif the identifier is \"rel_longer_name\": # Placeholder is \"%skriptplaceholders_author%\"",
"\tif the identifier is \"longer_name\": # Placeholder is \"%rel_skriptplaceholders_longer_name%\"",
"\t\tif the length of the name of the first player > the length of the name of the second player:",
"\t\t\tset the result to the name of the first player",
"\t\telse:",
Expand Down

0 comments on commit 3e501b5

Please sign in to comment.