35
35
import org .jetbrains .annotations .NotNull ;
36
36
import org .jetbrains .annotations .Nullable ;
37
37
import taboolib .common .Isolated ;
38
+ import taboolib .platform .BukkitPlugin ;
38
39
39
40
import java .util .*;
40
41
import java .util .concurrent .CompletableFuture ;
@@ -1791,7 +1792,6 @@ public static void stopMusic(@NotNull Player player) {
1791
1792
* Plays an instrument's notes in an ascending form.
1792
1793
* This method is not really relevant to this utility class, but a nice feature.
1793
1794
*
1794
- * @param plugin the plugin handling schedulers.
1795
1795
* @param player the player to play the note from.
1796
1796
* @param playTo the entity to play the note to.
1797
1797
* @param instrument the instrument.
@@ -1801,7 +1801,7 @@ public static void stopMusic(@NotNull Player player) {
1801
1801
* @since 2.0.0
1802
1802
*/
1803
1803
@ NotNull
1804
- public static BukkitTask playAscendingNote (@ NotNull Plugin plugin , @ NotNull Player player , @ NotNull Entity playTo , @ NotNull Instrument instrument ,
1804
+ public static BukkitTask playAscendingNote (@ NotNull Player player , @ NotNull Entity playTo , @ NotNull Instrument instrument ,
1805
1805
int ascendLevel , int delay ) {
1806
1806
Objects .requireNonNull (player , "Cannot play note from null player" );
1807
1807
Objects .requireNonNull (playTo , "Cannot play note to null entity" );
@@ -1818,7 +1818,7 @@ public void run() {
1818
1818
player .playNote (playTo .getLocation (), instrument , Note .natural (1 , Note .Tone .values ()[ascendLevel - repeating ]));
1819
1819
if (repeating -- == 0 ) cancel ();
1820
1820
}
1821
- }.runTaskTimerAsynchronously (plugin , 0 , delay );
1821
+ }.runTaskTimerAsynchronously (BukkitPlugin . getInstance () , 0 , delay );
1822
1822
}
1823
1823
1824
1824
/**
@@ -1863,7 +1863,6 @@ public boolean isSupported() {
1863
1863
/**
1864
1864
* Plays a sound repeatedly with the given delay at a moving target's location.
1865
1865
*
1866
- * @param plugin the plugin handling schedulers. (You can replace this with a static instance)
1867
1866
* @param entity the entity to play the sound to. We exactly need an entity to keep the track of location changes.
1868
1867
* @param volume the volume of the sound.
1869
1868
* @param pitch the pitch of the sound.
@@ -1874,14 +1873,13 @@ public boolean isSupported() {
1874
1873
* @since 2.0.0
1875
1874
*/
1876
1875
@ NotNull
1877
- public BukkitTask playRepeatedly (@ NotNull Plugin plugin , @ NotNull Entity entity , float volume , float pitch , int repeat , int delay ) {
1878
- return playRepeatedly (plugin , Collections .singleton (entity ), volume , pitch , repeat , delay );
1876
+ public BukkitTask playRepeatedly (@ NotNull Entity entity , float volume , float pitch , int repeat , int delay ) {
1877
+ return playRepeatedly (Collections .singleton (entity ), volume , pitch , repeat , delay );
1879
1878
}
1880
1879
1881
1880
/**
1882
1881
* Plays a sound repeatedly with the given delay at moving targets' locations.
1883
1882
*
1884
- * @param plugin the plugin handling schedulers. (You can replace this with a static instance)
1885
1883
* @param entities the entities to play the sound to. We exactly need the entities to keep the track of location changes.
1886
1884
* @param volume the volume of the sound.
1887
1885
* @param pitch the pitch of the sound.
@@ -1892,8 +1890,7 @@ public BukkitTask playRepeatedly(@NotNull Plugin plugin, @NotNull Entity entity,
1892
1890
* @since 2.0.0
1893
1891
*/
1894
1892
@ NotNull
1895
- public BukkitTask playRepeatedly (@ NotNull Plugin plugin , @ NotNull Iterable <? extends Entity > entities , float volume , float pitch , int repeat , int delay ) {
1896
- Objects .requireNonNull (plugin , "Cannot play repeating sound from null plugin" );
1893
+ public BukkitTask playRepeatedly (@ NotNull Iterable <? extends Entity > entities , float volume , float pitch , int repeat , int delay ) {
1897
1894
Objects .requireNonNull (entities , "Cannot play repeating sound at null locations" );
1898
1895
1899
1896
if (repeat <= 0 ) throw new IllegalArgumentException ("Cannot repeat playing sound " + repeat + " times" );
@@ -1910,7 +1907,7 @@ public void run() {
1910
1907
1911
1908
if (repeating -- == 0 ) cancel ();
1912
1909
}
1913
- }.runTaskTimer (plugin , 0 , delay );
1910
+ }.runTaskTimer (BukkitPlugin . getInstance () , 0 , delay );
1914
1911
}
1915
1912
1916
1913
/**
0 commit comments