Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoSuchMethodError with play sound effect on 1.18 #7016

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/ch/njol/skript/effects/EffPlaySound.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"<a href=\"https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html\">Spigot sound names</a> " +
"are supported. Playing resource pack sounds are supported too. The sound category is 'master' by default. ",
"",
"When running 1.18+, playing a sound from an entity directly will result in the sound coming from said entity, even while moving.",
"When running 1.19+, playing a sound from an entity directly will result in the sound coming from said entity, even while moving.",
"If the sound is custom, a location emitter will follow the entity. Do note that pitch and volume ",
"are reflected based on the entity, and Minecraft may not use the values from this syntax.",
"",
Expand All @@ -64,17 +64,17 @@
"Please note that sound names can get changed in any Minecraft or Spigot version, or even removed from Minecraft itself.",
})
@Examples({
"play sound \"block.note_block.pling\" # It is block.note.pling in 1.12.2",
"play sound \"block.note_block.pling\"",
"play sound \"entity.experience_orb.pickup\" with volume 0.5 to the player",
"play sound \"custom.music.1\" in jukebox category at {speakerBlock}",
"play sound \"BLOCK_AMETHYST_BLOCK_RESONATE\" with seed 1 on target entity for the player #1.20.1+"
})
@RequiredPlugins("Minecraft 1.18.1+ (entity emitters), Paper 1.19.4+ or Adventure API 4.12.0+ (sound seed)")
@RequiredPlugins("Minecraft 1.19.4+ (entity emitters), Paper 1.19.4+ or Adventure API 4.12.0+ (sound seed)")
@Since("2.2-dev28, 2.4 (sound categories), 2.9.0 (sound seed & entity emitter)")
public class EffPlaySound extends Effect {

private static final boolean ADVENTURE_API = Skript.classExists("net.kyori.adventure.sound.Sound$Builder");
private static final boolean PLAYER_ENTITY_EMITTER = Skript.methodExists(Player.class, "playSound", Entity.class, Sound.class, SoundCategory.class, float.class, float.class);
private static final boolean PLAYER_ENTITY_EMITTER = Skript.methodExists(Player.class, "playSound", Entity.class, String.class, SoundCategory.class, float.class, float.class);
private static final boolean WORLD_ENTITY_EMITTER = Skript.methodExists(World.class, "playSound", Entity.class, String.class, SoundCategory.class, float.class, float.class);
public static final Pattern KEY_PATTERN = Pattern.compile("([a-z0-9._-]+:)?([a-z0-9/._-]+)");

Expand Down