Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ec09af5

Browse files
committed
Version 1.2
1 parent 791787a commit ec09af5

File tree

4 files changed

+43
-63
lines changed

4 files changed

+43
-63
lines changed

src/main/java/me/asleepp/SkriptItemsAdder/elements/effects/EffPlayBreakEffect.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package me.asleepp.SkriptItemsAdder.elements.effects;
22

33
import ch.njol.skript.Skript;
4+
import ch.njol.skript.doc.Description;
5+
import ch.njol.skript.doc.Examples;
6+
import ch.njol.skript.doc.Name;
7+
import ch.njol.skript.doc.Since;
48
import ch.njol.skript.lang.Effect;
59
import ch.njol.skript.lang.Expression;
610
import ch.njol.skript.lang.SkriptParser;
@@ -11,12 +15,17 @@
1115

1216
import javax.annotation.Nullable;
1317

18+
19+
@Name("Play Break Effect")
20+
@Description({"Play the breaking effect on a custom block."})
21+
@Examples({"play the break effect on custom block \"chiseled_diamond_block\" "})
22+
@Since("1.2")
1423
public class EffPlayBreakEffect extends Effect {
1524

1625
private Expression<String> customBlockId;
1726

1827
static {
19-
Skript.registerEffect(EffPlayBreakEffect.class, new String[] {"(play|make) [the] break effect on (custom|ia|itemsadder) block %string%"});
28+
Skript.registerEffect(EffPlayBreakEffect.class, new String[] {"(play|make) [the] break[ing] effect on (custom|ia|itemsadder) block %string%"});
2029
}
2130

2231
@Override

src/main/java/me/asleepp/SkriptItemsAdder/elements/effects/EffPlayBreakParticles.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/main/java/me/asleepp/SkriptItemsAdder/elements/effects/EffPlayBreakSound.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
11
package me.asleepp.SkriptItemsAdder.elements.effects;
22

33
import ch.njol.skript.Skript;
4+
import ch.njol.skript.doc.Description;
5+
import ch.njol.skript.doc.Examples;
6+
import ch.njol.skript.doc.Name;
7+
import ch.njol.skript.doc.Since;
48
import ch.njol.skript.lang.Effect;
59
import ch.njol.skript.lang.Expression;
610
import ch.njol.skript.lang.SkriptParser;
711
import ch.njol.util.Kleenean;
812
import dev.lone.itemsadder.api.CustomBlock;
913
import org.bukkit.block.Block;
14+
import org.bukkit.entity.Player;
1015
import org.bukkit.event.Event;
1116

1217
import javax.annotation.Nullable;
1318

14-
import org.bukkit.entity.Entity;
1519

20+
@Name("Play Break Sound")
21+
@Description({"Play the breaking sound from a custom block to a player(s)"})
22+
@Examples({"play the break sound from custom block \"ruby_block\" to all players"})
23+
@Since("1.2")
1624
public class EffPlayBreakSound extends Effect {
1725

1826
private Expression<String> customBlockId;
19-
private Expression<Entity> entities;
27+
private Expression<Player> players;
2028

2129
static {
22-
Skript.registerEffect(EffPlayBreakSound.class, new String[] {"play [the] break sound from (custom|ia|itemsadder) block %string% to %entities%"});
30+
Skript.registerEffect(EffPlayBreakSound.class, new String[] {"play [the] break[ing] sound from (custom|ia|itemsadder) block %string% to %players%"});
2331
}
2432

2533
@Override
2634
protected void execute(Event e) {
2735
String customBlockId = this.customBlockId.getSingle(e);
28-
Entity[] entities = this.entities.getArray(e);
36+
Player[] players = this.players.getArray(e);
2937

3038
if (customBlockId != null) {
3139
CustomBlock customBlock = CustomBlock.getInstance(customBlockId);
3240
if (customBlock != null) {
3341
Block bukkitBlock = customBlock.getBlock();
3442
if (bukkitBlock != null) {
35-
for (Entity entity : entities) {
36-
if (entity.getLocation().distance(bukkitBlock.getLocation()) <= 16) { // probably not 16 blocks but whatever
43+
for (Player player : players) {
44+
if (player.getLocation().distance(bukkitBlock.getLocation()) <= 5) { // probably not 5 blocks but whatever
3745
CustomBlock.playBreakSound(bukkitBlock);
3846
}
3947
}
@@ -44,13 +52,13 @@ protected void execute(Event e) {
4452

4553
@Override
4654
public String toString(@Nullable Event e, boolean debug) {
47-
return "play the break sound from custom block " + customBlockId.toString(e, debug) + " to " + entities.toString(e, debug);
55+
return "play the break sound from custom block " + customBlockId.toString(e, debug) + " to " + players.toString(e, debug);
4856
}
4957

5058
@Override
5159
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
5260
this.customBlockId = (Expression<String>) exprs[0];
53-
this.entities = (Expression<Entity>) exprs[1];
61+
this.players = (Expression<Player>) exprs[1];
5462
return true;
5563
}
5664
}

src/main/java/me/asleepp/SkriptItemsAdder/elements/effects/EffPlayPlaceSound.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,49 @@
11
package me.asleepp.SkriptItemsAdder.elements.effects;
22

33
import ch.njol.skript.Skript;
4+
import ch.njol.skript.doc.Description;
5+
import ch.njol.skript.doc.Examples;
6+
import ch.njol.skript.doc.Name;
7+
import ch.njol.skript.doc.Since;
48
import ch.njol.skript.lang.Effect;
59
import ch.njol.skript.lang.Expression;
610
import ch.njol.skript.lang.SkriptParser;
711
import ch.njol.util.Kleenean;
812
import dev.lone.itemsadder.api.CustomBlock;
913
import org.bukkit.block.Block;
14+
import org.bukkit.entity.Player;
1015
import org.bukkit.event.Event;
1116

1217
import javax.annotation.Nullable;
1318

1419
import org.bukkit.entity.Entity;
1520

21+
22+
@Name("Play Place Sound")
23+
@Description({"Play the placing sound from a custom block to a player(s)"})
24+
@Examples({"play the place sound from custom block \"ruby_block\" to all players"})
25+
@Since("1.2")
1626
public class EffPlayPlaceSound extends Effect {
1727

1828
private Expression<String> customBlockId;
19-
private Expression<Entity> entities;
29+
private Expression<Player> players;
2030

2131
static {
22-
Skript.registerEffect(EffPlayPlaceSound.class, new String[] {"play [the] place sound from (custom|ia|itemsadder) block %string% to %entities%"});
32+
Skript.registerEffect(EffPlayPlaceSound.class, new String[] {"play [the] plac[e|ing] sound from (custom|ia|itemsadder) block %string% to %players%"});
2333
}
2434

2535
@Override
2636
protected void execute(Event e) {
2737
String customBlockId = this.customBlockId.getSingle(e);
28-
Entity[] entities = this.entities.getArray(e);
38+
Player[] players = this.players.getArray(e);
2939

3040
if (customBlockId != null) {
3141
CustomBlock customBlock = CustomBlock.getInstance(customBlockId);
3242
if (customBlock != null) {
3343
Block bukkitBlock = customBlock.getBlock();
3444
if (bukkitBlock != null) {
35-
for (Entity entity : entities) {
36-
if (entity.getLocation().distance(bukkitBlock.getLocation()) <= 16) {
45+
for (Player player : players) {
46+
if (player.getLocation().distance(bukkitBlock.getLocation()) <= 5) {
3747
CustomBlock.playPlaceSound(bukkitBlock);
3848
}
3949
}
@@ -44,13 +54,13 @@ protected void execute(Event e) {
4454

4555
@Override
4656
public String toString(@Nullable Event e, boolean debug) {
47-
return "play the place sound from custom block " + customBlockId.toString(e, debug) + " to " + entities.toString(e, debug);
57+
return "play the place sound from custom block " + customBlockId.toString(e, debug) + " to " + players.toString(e, debug);
4858
}
4959

5060
@Override
5161
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
5262
this.customBlockId = (Expression<String>) exprs[0];
53-
this.entities = (Expression<Entity>) exprs[1];
63+
this.players = (Expression<Player>) exprs[1];
5464
return true;
5565
}
5666
}

0 commit comments

Comments
 (0)