Skip to content

Commit 005fd46

Browse files
committed
DOCS LAST PART!!!!!!!
1 parent 8699a8d commit 005fd46

22 files changed

Lines changed: 143 additions & 91 deletions

src/main/java/org/skriptlang/skript/bukkit/spawners/SpawnerModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void init(SkriptAddon addon) {
6363
.user("mob ?spawner ?datas?")
6464
.name("Mob Spawner Data")
6565
.description("""
66-
Represents mob spawner data that can be contained in a monster spawner or a spawner minecart. \
66+
Represents the mob spawner data that can be contained in a monster spawner or a spawner minecart. \
6767
Additional information can be found on \
6868
<a href='https://minecraft.wiki/w/Monster_Spawner'>the Minecraft wiki page about mob spawners</a>.
6969
""")

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/conditions/CondIsActivated.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class CondIsActivated extends PropertyCondition<Object> {
2525

2626
public static void register(SyntaxRegistry registry) {
2727
registry.register(SyntaxRegistry.CONDITION, infoBuilder(CondIsActivated.class, PropertyType.BE,
28-
"[an] (activated|active) spawner", SpawnerUtils.SPAWNER_PROPERTY_TYPE)
28+
"[an] (activated|active) spawner", "blocks/entities")
2929
.supplier(CondIsActivated::new)
3030
.build()
3131
);

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/conditions/CondIsOminous.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import org.skriptlang.skript.registration.SyntaxRegistry;
1010

1111
@Name("Trial Spawner Is Ominous")
12-
@Description("Checks whether a trial spawner is ominous. This can also be used with trial spawner block datas.")
12+
@Description("""
13+
Checks whether a trial spawner is ominous. This can also be used with trial spawner block datas.
14+
""")
1315
@Example("""
1416
if the block at player is ominous:
1517
send "The trial spawner is ominous!" to player

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/effects/EffEjectReward.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
import org.skriptlang.skript.registration.SyntaxRegistry;
1919

2020
@Name("Eject Trial Spawner Rewards")
21-
@Description("Make a trial spawner eject its rewards.")
22-
@Example("spit out the trial rewards from event-block")
21+
@Description("""
22+
Make a trial spawner eject its rewards.
23+
""")
24+
@Example("""
25+
spit out the trial rewards from event-block
26+
""")
2327
@Since("INSERT VERSION")
2428
public class EffEjectReward extends Effect {
2529

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/effects/EffSpawnerItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public static void register(SyntaxRegistry registry) {
3737
.supplier(EffSpawnerItem::new)
3838
.priority(SyntaxInfo.COMBINED)
3939
.addPatterns(
40-
"make " + SpawnerUtils.SPAWNER_PROPERTY_TYPE + " spawn %itemstack%",
41-
"force " + SpawnerUtils.SPAWNER_PROPERTY_TYPE + " to spawn %itemstack%")
40+
"make %blocks/entities% spawn %itemstack%",
41+
"force %blocks/entities% to spawn %itemstack%")
4242
.build()
4343
);
4444
}

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/expressions/ExprSpawnLocation.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.skriptlang.skript.bukkit.spawners.elements.expressions;
22

33
import ch.njol.skript.doc.Description;
4-
import ch.njol.skript.doc.Examples;
4+
import ch.njol.skript.doc.Example;
55
import ch.njol.skript.doc.Name;
66
import ch.njol.skript.doc.Since;
77
import ch.njol.skript.lang.EventRestrictedSyntax;
@@ -18,11 +18,13 @@
1818
import org.skriptlang.skript.registration.SyntaxRegistry;
1919

2020
@Name("Spawn Location")
21-
@Description("The location of the spawned entity in the pre spawner spawn event.")
22-
@Examples({
23-
"on pre spawner spawn:",
24-
"\tset {_entity} to the location of the spawner"
25-
})
21+
@Description("""
22+
Returns the spawned entity's spawn location in the pre-spawner-spawn event.
23+
""")
24+
@Example("""
25+
on pre spawner spawn:
26+
broadcast the spawner entity's spawn location
27+
""")
2628
@Since("INSERT VERSION")
2729
public class ExprSpawnLocation extends SimpleExpression<Location> implements EventRestrictedSyntax {
2830

@@ -31,8 +33,8 @@ public static void register(SyntaxRegistry registry) {
3133
.supplier(ExprSpawnLocation::new)
3234
.priority(SyntaxInfo.SIMPLE)
3335
.addPatterns(
34-
"[the] spawn location of [the] [spawner] entity",
35-
"[the] [spawner] entity's spawn location")
36+
"[the] spawn location of [the] spawner entity",
37+
"[the] spawner entity's spawn location")
3638
.build()
3739
);
3840
}

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/expressions/ExprSpawnerLocation.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.skriptlang.skript.bukkit.spawners.elements.expressions;
22

33
import ch.njol.skript.doc.Description;
4-
import ch.njol.skript.doc.Examples;
4+
import ch.njol.skript.doc.Example;
55
import ch.njol.skript.doc.Name;
66
import ch.njol.skript.doc.Since;
77
import ch.njol.skript.lang.EventRestrictedSyntax;
@@ -18,11 +18,13 @@
1818
import org.skriptlang.skript.registration.SyntaxRegistry;
1919

2020
@Name("Spawner Location")
21-
@Description("The location of the spawner in the pre spawner spawn event.")
22-
@Examples({
23-
"on pre spawner spawn:",
24-
"\tset {_location} to the location of the spawner"
25-
})
21+
@Description("""
22+
Returns the spawner's location in the pre-spawner-spawn event.
23+
""")
24+
@Example("""
25+
on pre spawner spawn:
26+
broadcast the spawner's location
27+
""")
2628
@Since("INSERT VERSION")
2729
public class ExprSpawnerLocation extends SimpleExpression<Location> implements EventRestrictedSyntax {
2830

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/expressions/spawner/ExprSpawnDelay.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
@Name("Spawn Delay")
1818
@Description("""
1919
Returns the spawn delay of the spawner. The spawn delay is the time before the spawner attempts to \
20-
spawn its entries. If the spawner is inactive at the time of the attempt, the delay remains 0 and \
21-
the spawner will try to spawn every tick until successful. After a successful spawn, the delay is \
20+
spawn its entries. If the spawner is inactive at the time of the attempt, the delay remains as 0 seconds and \
21+
the spawner will try to spawn every tick until it's successful. After a successful spawn, the delay is \
2222
reset to a random value between the spawner’s minimum and maximum spawn delays.
2323
""")
2424
@Example("""
@@ -33,25 +33,27 @@ public class ExprSpawnDelay extends SimplePropertyExpression<Object, Timespan> {
3333

3434
public static void register(SyntaxRegistry registry) {
3535
registry.register(SyntaxRegistry.EXPRESSION, infoBuilder(ExprSpawnDelay.class, Timespan.class,
36-
"spawn delay[s]", SpawnerUtils.SPAWNER_PROPERTY_TYPE, false)
36+
"spawn delay[s]", "blocks/entities", false)
3737
.supplier(ExprSpawnDelay::new)
3838
.build()
3939
);
4040
}
4141

4242
@Override
4343
public @Nullable Timespan convert(Object object) {
44-
Timespan timespan = null;
45-
4644
if (SpawnerUtils.isMobSpawner(object)) {
47-
timespan = new Timespan(TimePeriod.TICK, SpawnerUtils.getMobSpawner(object).getDelay());
48-
} else if (SpawnerUtils.IS_RUNNING_1_21_4 && SpawnerUtils.isTrialSpawner(object)) {
45+
return new Timespan(TimePeriod.TICK, SpawnerUtils.getMobSpawner(object).getDelay());
46+
} else if (SpawnerUtils.isTrialSpawner(object)) {
47+
if (!SpawnerUtils.IS_RUNNING_1_21_4) {
48+
error("Getting the spawn delay of a trial spawner requires Minecraft 1.21.4 or newer.");
49+
return null;
50+
}
4951
TrialSpawner spawner = SpawnerUtils.getTrialSpawner(object);
5052
long ticks = Math.max(0, spawner.getNextSpawnAttempt() - spawner.getWorld().getGameTime());
51-
timespan = new Timespan(TimePeriod.TICK, ticks);
53+
return new Timespan(TimePeriod.TICK, ticks);
5254
}
5355

54-
return timespan;
56+
return null;
5557
}
5658

5759
@Override

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/expressions/spawner/ExprSpawnerEntity.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class ExprSpawnerEntity extends SimplePropertyExpression<Object, Object>
3737

3838
public static void register(SyntaxRegistry registry) {
3939
registry.register(SyntaxRegistry.EXPRESSION, infoBuilder(ExprSpawnerEntity.class, Object.class,
40-
"spawner [entity] (type|:snapshot)[s]", SpawnerUtils.SPAWNER_PROPERTY_TYPE, false)
40+
"spawner [entity] (type|:snapshot)[s]", "blocks/entities", false)
4141
.supplier(ExprSpawnerEntity::new)
4242
.build()
4343
);
@@ -71,7 +71,11 @@ public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean is
7171
@Override
7272
public Class<?> @Nullable [] acceptChange(ChangeMode mode) {
7373
return switch (mode) {
74-
case SET, DELETE, RESET -> CollectionUtils.array(EntityData.class);
74+
case SET, DELETE, RESET -> {
75+
if (snapshot)
76+
yield CollectionUtils.array(EntitySnapshot.class);
77+
yield CollectionUtils.array(EntityData.class);
78+
}
7579
default -> null;
7680
};
7781
}

src/main/java/org/skriptlang/skript/bukkit/spawners/elements/expressions/spawner/spawnerdata/ExprMinMaxDelay.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
The minimum delay cannot exceed the maximum delay, and vice versa.
2727
2828
Default values for mob spawners:
29-
Minimum spawn delay: 10 seconds (200 ticks)
30-
Maximum spawn delay: 40 seconds (800 ticks)
29+
- Minimum spawn delay: 10 seconds (200 ticks)
30+
- Maximum spawn delay: 40 seconds (800 ticks)
3131
3232
Though, trial spawners behave differently. Their minimum and maximum spawn delays are fixed to the same value. \
3333
By default, both are set to 2 seconds (40 ticks).

0 commit comments

Comments
 (0)