Skip to content

Commit f969563

Browse files
bluelhfsovdeeth
andauthored
Use @example annotations instead of @examples (SkriptLang#8224)
* refactor: use @example annotations instead of @examples * fix: address code suggestions * refactor(docs): continue work on Examples->Example migration * fix(docs): indent examples properly applies code suggestions from @sovdeeth Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * refactor(docs): finish migrating syntaxes from Examples annotations to Example this changes the rest of the vanilla Skript syntaxes. the old Examples annotation is left there because addons probably use it still * revert: swap skript-aliases back to old hash * chore(docs): apply code suggestions thanks, sovde ! Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * fix(docs): merge EffCopy examples into one * fix(docs): remove extra quote * fix(docs): improvements to examples applies changes from code review Co-authored-by: sovde <10354869+sovdeeth@users.noreply.github.com> * fix(docs): example indentation Co-authored-by: sovde <10354869+sovdeeth@users.noreply.github.com> * chore(docs): improve examples * fix(docs): combine StructOptions example --------- Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
1 parent beda9bb commit f969563

679 files changed

Lines changed: 3669 additions & 3692 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/ch/njol/skript/conditions/CondAI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
import ch.njol.skript.conditions.base.PropertyCondition;
66
import ch.njol.skript.doc.Description;
7-
import ch.njol.skript.doc.Examples;
7+
import ch.njol.skript.doc.Example;
88
import ch.njol.skript.doc.Name;
99
import ch.njol.skript.doc.Since;
1010

1111
@Name("Has AI")
1212
@Description("Checks whether an entity has AI.")
13-
@Examples("target entity has ai")
13+
@Example("target entity has ai")
1414
@Since("2.5")
1515
public class CondAI extends PropertyCondition<LivingEntity> {
1616

src/main/java/ch/njol/skript/conditions/CondAllayCanDuplicate.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
import ch.njol.skript.conditions.base.PropertyCondition;
44
import ch.njol.skript.doc.Description;
5-
import ch.njol.skript.doc.Examples;
5+
import ch.njol.skript.doc.Example;
66
import ch.njol.skript.doc.Name;
77
import ch.njol.skript.doc.Since;
88
import org.bukkit.entity.Allay;
99
import org.bukkit.entity.LivingEntity;
1010

1111
@Name("Allay Can Duplicate")
1212
@Description("Checks to see if an allay is able to duplicate naturally.")
13-
@Examples({
14-
"if last spawned allay can duplicate:",
15-
"\tdisallow last spawned to duplicate"
16-
})
13+
@Example("""
14+
if last spawned allay can duplicate:
15+
disallow last spawned to duplicate
16+
""")
1717
@Since("2.11")
1818
public class CondAllayCanDuplicate extends PropertyCondition<LivingEntity> {
1919

src/main/java/ch/njol/skript/conditions/CondAlphanumeric.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import ch.njol.skript.Skript;
1010
import ch.njol.skript.doc.Description;
11-
import ch.njol.skript.doc.Examples;
11+
import ch.njol.skript.doc.Example;
1212
import ch.njol.skript.doc.Name;
1313
import ch.njol.skript.doc.Since;
1414
import ch.njol.skript.lang.Condition;
@@ -18,8 +18,10 @@
1818

1919
@Name("Alphanumeric")
2020
@Description({"Checks if the given string is alphanumeric."})
21-
@Examples({"if the argument is not alphanumeric:",
22-
" send \"Invalid name!\""})
21+
@Example("""
22+
if the argument is not alphanumeric:
23+
send "Invalid name!"
24+
""")
2325
@Since("2.4")
2426
public class CondAlphanumeric extends Condition {
2527

src/main/java/ch/njol/skript/conditions/CondAnchorWorks.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import ch.njol.skript.Skript;
44
import ch.njol.skript.doc.Name;
55
import ch.njol.skript.doc.Description;
6-
import ch.njol.skript.doc.Examples;
6+
import ch.njol.skript.doc.Example;
77
import ch.njol.skript.doc.RequiredPlugins;
88
import ch.njol.skript.doc.Since;
99
import ch.njol.skript.lang.Condition;
@@ -16,7 +16,7 @@
1616

1717
@Name("Do Respawn Anchors Work")
1818
@Description("Checks whether or not respawn anchors work in a world.")
19-
@Examples("respawn anchors work in world \"world_nether\"")
19+
@Example("respawn anchors work in world \"world_nether\"")
2020
@RequiredPlugins("Minecraft 1.16+")
2121
@Since("2.7")
2222
public class CondAnchorWorks extends Condition {

src/main/java/ch/njol/skript/conditions/CondCanFly.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
import ch.njol.skript.conditions.base.PropertyCondition;
66
import ch.njol.skript.doc.Description;
7-
import ch.njol.skript.doc.Examples;
7+
import ch.njol.skript.doc.Example;
88
import ch.njol.skript.doc.Name;
99
import ch.njol.skript.doc.Since;
1010

1111
@Name("Can Fly")
1212
@Description("Whether a player is allowed to fly.")
13-
@Examples("player can fly")
13+
@Example("player can fly")
1414
@Since("2.3")
1515
public class CondCanFly extends PropertyCondition<Player> {
1616

src/main/java/ch/njol/skript/conditions/CondCanHold.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import ch.njol.skript.conditions.base.PropertyCondition;
1111
import ch.njol.skript.conditions.base.PropertyCondition.PropertyType;
1212
import ch.njol.skript.doc.Description;
13-
import ch.njol.skript.doc.Examples;
13+
import ch.njol.skript.doc.Example;
1414
import ch.njol.skript.doc.Name;
1515
import ch.njol.skript.doc.Since;
1616
import ch.njol.skript.lang.Condition;
@@ -25,8 +25,8 @@
2525
*/
2626
@Name("Can Hold")
2727
@Description("Tests whether a player or a chest can hold the given item.")
28-
@Examples({"block can hold 200 cobblestone",
29-
"player has enough space for 64 feathers"})
28+
@Example("block can hold 200 cobblestone")
29+
@Example("player has enough space for 64 feathers")
3030
@Since("1.0")
3131
public class CondCanHold extends Condition {
3232

src/main/java/ch/njol/skript/conditions/CondCanPickUpItems.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22

33
import ch.njol.skript.conditions.base.PropertyCondition;
44
import ch.njol.skript.doc.Description;
5-
import ch.njol.skript.doc.Examples;
5+
import ch.njol.skript.doc.Example;
66
import ch.njol.skript.doc.Name;
77
import ch.njol.skript.doc.Since;
88
import org.bukkit.entity.LivingEntity;
99

1010
@Name("Can Pick Up Items")
1111
@Description("Whether living entities are able to pick up items off the ground or not.")
12-
@Examples({
13-
"if player can pick items up:",
14-
"\tsend \"You can pick up items!\" to player",
15-
"",
16-
"on drop:",
17-
"\tif player can't pick up items:",
18-
"\t\tsend \"Be careful, you won't be able to pick that up!\" to player"
19-
})
12+
@Example("""
13+
if player can pick items up:
14+
send "You can pick up items!" to player
15+
""")
16+
@Example("""
17+
on drop:
18+
if player can't pick up items:
19+
send "Be careful, you won't be able to pick that up!" to player
20+
""")
2021
@Since("2.8.0")
2122
public class CondCanPickUpItems extends PropertyCondition<LivingEntity> {
2223

src/main/java/ch/njol/skript/conditions/CondCanSee.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515

1616
@Name("Can See")
1717
@Description("Checks whether the given players can see the provided entities.")
18-
@Examples({
19-
"if sender can't see the player-argument:",
20-
"\tmessage \"who dat?\"",
21-
"",
22-
"if the player can see the last spawned entity:",
23-
"\tmessage \"hello there!\""
24-
})
18+
@Example("""
19+
if sender can't see the player-argument:
20+
message "who dat?"
21+
""")
22+
@Example("""
23+
if the player can see the last spawned entity:
24+
message "hello there!"
25+
""")
2526
@Since("2.3, 2.10 (entities)")
2627
@RequiredPlugins("Minecraft 1.19+ (entities)")
2728
public class CondCanSee extends Condition {

src/main/java/ch/njol/skript/conditions/CondCancelled.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import ch.njol.skript.Skript;
44
import ch.njol.skript.doc.Description;
5-
import ch.njol.skript.doc.Examples;
5+
import ch.njol.skript.doc.Example;
66
import ch.njol.skript.doc.Name;
77
import ch.njol.skript.doc.Since;
88
import ch.njol.skript.lang.Condition;
@@ -15,10 +15,11 @@
1515

1616
@Name("Event Cancelled")
1717
@Description("Checks whether or not the event is cancelled.")
18-
@Examples({"on click:",
19-
"\tif event is cancelled:",
20-
"\t\tbroadcast \"no clicks allowed!\""
21-
})
18+
@Example("""
19+
on click:
20+
if event is cancelled:
21+
broadcast "no clicks allowed!"
22+
""")
2223
@Since("2.2-dev36")
2324
public class CondCancelled extends Condition {
2425

src/main/java/ch/njol/skript/conditions/CondChance.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import ch.njol.skript.Skript;
77
import ch.njol.skript.doc.Description;
8-
import ch.njol.skript.doc.Examples;
8+
import ch.njol.skript.doc.Example;
99
import ch.njol.skript.doc.Name;
1010
import ch.njol.skript.doc.Since;
1111
import ch.njol.skript.lang.Condition;
@@ -19,10 +19,12 @@
1919
@Name("Chance")
2020
@Description({"A condition that randomly succeeds or fails.",
2121
"Valid values are between 0% and 100%, or if the percent sign is omitted between 0 and 1."})
22-
@Examples({"chance of 50%:",
23-
"\tdrop a diamond",
24-
"chance of {chance}% # {chance} between 0 and 100",
25-
"chance of {chance} # {chance} between 0 and 1"})
22+
@Example("""
23+
chance of 50%:
24+
drop a diamond
25+
""")
26+
@Example("chance of {chance}% # {chance} between 0 and 100")
27+
@Example("chance of {chance} # {chance} between 0 and 1")
2628
@Since("1.0")
2729
public class CondChance extends Condition {
2830

0 commit comments

Comments
 (0)