From 3e501b58bc4f5f734982cbcef3fe1133c96bebc3 Mon Sep 17 00:00:00 2001 From: APickledWalrus Date: Fri, 24 May 2024 14:08:53 -0400 Subject: [PATCH] Fixes and documentation corrections --- .../skript/elements/ExprPlaceholder.java | 2 +- .../skript/elements/ExprPlaceholderResult.java | 2 +- .../skript/elements/ExprPlaceholderValue.java | 3 +-- .../skript/elements/ExprRelationalPlayers.java | 3 ++- .../skript/elements/StructPlaceholder.java | 7 ++++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholder.java b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholder.java index 7c4ffce..937e30f 100644 --- a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholder.java +++ b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholder.java @@ -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]; diff --git a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholderResult.java b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholderResult.java index 4042fdc..ab9565e 100644 --- a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholderResult.java +++ b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholderResult.java @@ -42,7 +42,7 @@ public class ExprPlaceholderResult extends SimpleExpression { @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; diff --git a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholderValue.java b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholderValue.java index 8fd8a78..c4e1ea1 100644 --- a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholderValue.java +++ b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprPlaceholderValue.java @@ -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 :", "\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)") diff --git a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprRelationalPlayers.java b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprRelationalPlayers.java index 9767e6a..acb39e8 100644 --- a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprRelationalPlayers.java +++ b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/ExprRelationalPlayers.java @@ -40,10 +40,11 @@ public class ExprRelationalPlayers extends SimpleExpression { @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; } diff --git a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/StructPlaceholder.java b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/StructPlaceholder.java index c440bde..63d85d1 100644 --- a/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/StructPlaceholder.java +++ b/src/main/java/io/github/apickledwalrus/skriptplaceholders/skript/elements/StructPlaceholder.java @@ -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:",