Skip to content

Commit

Permalink
SoundReceiver - fix error on Spigot when adventure API is implemented (
Browse files Browse the repository at this point in the history
…#7271)

SoundReceiver - fix error on Spigot when adventure API is implemented in another plugin

Co-authored-by: Efnilite <[email protected]>
Co-authored-by: sovdee <[email protected]>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent ccd7b28 commit a44df2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
public interface SoundReceiver {

boolean ADVENTURE_API = Skript.classExists("net.kyori.adventure.sound.Sound$Builder");
boolean ADVENTURE_API = Skript.classExists("net.kyori.adventure.sound.Sound$Builder") && Skript.methodExists(SoundCategory.class, "soundSource");
boolean SPIGOT_SOUND_SEED = Skript.methodExists(Player.class, "playSound", Entity.class, Sound.class, SoundCategory.class, float.class, float.class, long.class);
boolean ENTITY_EMITTER_SOUND = Skript.methodExists(Player.class, "playSound", Entity.class, Sound.class, SoundCategory.class, float.class, float.class);
boolean ENTITY_EMITTER_STRING = Skript.methodExists(Player.class, "playSound", Entity.class, String.class, SoundCategory.class, float.class, float.class);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ch/njol/skript/effects/EffPlaySound.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ public class EffPlaySound extends Effect {
// World - Location/Entity - Sound/String
// 1.20 - spigot adds sound seeds

private static final boolean ADVENTURE_API = Skript.classExists("net.kyori.adventure.sound.Sound$Builder");
private static final boolean SPIGOT_SOUND_SEED = Skript.methodExists(Player.class, "playSound", Entity.class, Sound.class, SoundCategory.class, float.class, float.class, long.class);
private static final boolean HAS_SEED = ADVENTURE_API || SPIGOT_SOUND_SEED;
private static final boolean HAS_SEED = SoundReceiver.ADVENTURE_API || SPIGOT_SOUND_SEED;
private static final boolean ENTITY_EMITTER_SOUND = Skript.methodExists(Player.class, "playSound", Entity.class, Sound.class, SoundCategory.class, float.class, float.class);
private static final boolean ENTITY_EMITTER_STRING = Skript.methodExists(Player.class, "playSound", Entity.class, String.class, SoundCategory.class, float.class, float.class);
private static final boolean ENTITY_EMITTER = ENTITY_EMITTER_SOUND || ENTITY_EMITTER_STRING;
Expand Down

0 comments on commit a44df2b

Please sign in to comment.