11package com .xxmicloxx .NoteBlockAPI ;
22
3- import java .io .IOException ;
4- import java .lang .reflect .Method ;
5- import java .lang .reflect .Type ;
6- import java .util .ArrayList ;
7- import java .util .Collections ;
8- import java .util .HashMap ;
9- import java .util .Map ;
10- import java .util .UUID ;
11- import java .util .concurrent .ConcurrentHashMap ;
12-
3+ import com .xxmicloxx .NoteBlockAPI .songplayer .SongPlayer ;
4+ import com .xxmicloxx .NoteBlockAPI .utils .MathUtils ;
5+ import com .xxmicloxx .NoteBlockAPI .utils .Updater ;
136import org .bstats .bukkit .Metrics ;
147import org .bukkit .Bukkit ;
158import org .bukkit .entity .Player ;
1811import org .bukkit .plugin .RegisteredListener ;
1912import org .bukkit .plugin .java .JavaPlugin ;
2013
21- import com .xxmicloxx .NoteBlockAPI .songplayer .SongPlayer ;
22- import com .xxmicloxx .NoteBlockAPI .utils .MathUtils ;
23- import com .xxmicloxx .NoteBlockAPI .utils .Updater ;
14+ import java .io .IOException ;
15+ import java .lang .reflect .Method ;
16+ import java .lang .reflect .Type ;
17+ import java .util .ArrayList ;
18+ import java .util .HashMap ;
19+ import java .util .Map ;
20+ import java .util .UUID ;
21+ import java .util .concurrent .ConcurrentHashMap ;
2422
2523/**
2624 * Main class; contains methods for playing and adjusting songs for players
@@ -42,7 +40,16 @@ public class NoteBlockAPI extends JavaPlugin {
4240 * @return is receiving a song
4341 */
4442 public static boolean isReceivingSong (Player player ) {
45- ArrayList <SongPlayer > songs = plugin .playingSongs .get (player .getUniqueId ());
43+ return isReceivingSong (player .getUniqueId ());
44+ }
45+
46+ /**
47+ * Returns true if a Player with specified UUID is currently receiving a song
48+ * @param uuid
49+ * @return is receiving a song
50+ */
51+ public static boolean isReceivingSong (UUID uuid ) {
52+ ArrayList <SongPlayer > songs = plugin .playingSongs .get (uuid );
4653 return (songs != null && !songs .isEmpty ());
4754 }
4855
@@ -51,12 +58,20 @@ public static boolean isReceivingSong(Player player) {
5158 * @param player
5259 */
5360 public static void stopPlaying (Player player ) {
54- ArrayList <SongPlayer > songs = plugin .playingSongs .get (player .getUniqueId ());
61+ stopPlaying (player .getUniqueId ());
62+ }
63+
64+ /**
65+ * Stops the song for a Player
66+ * @param uuid
67+ */
68+ public static void stopPlaying (UUID uuid ) {
69+ ArrayList <SongPlayer > songs = plugin .playingSongs .get (uuid );
5570 if (songs == null ) {
5671 return ;
5772 }
5873 for (SongPlayer songPlayer : songs ) {
59- songPlayer .removePlayer (player );
74+ songPlayer .removePlayer (uuid );
6075 }
6176 }
6277
@@ -66,7 +81,16 @@ public static void stopPlaying(Player player) {
6681 * @param volume
6782 */
6883 public static void setPlayerVolume (Player player , byte volume ) {
69- plugin .playerVolume .put (player .getUniqueId (), volume );
84+ setPlayerVolume (player .getUniqueId (), volume );
85+ }
86+
87+ /**
88+ * Sets the volume for a given Player
89+ * @param uuid
90+ * @param volume
91+ */
92+ public static void setPlayerVolume (UUID uuid , byte volume ) {
93+ plugin .playerVolume .put (uuid , volume );
7094 }
7195
7296 /**
@@ -75,7 +99,15 @@ public static void setPlayerVolume(Player player, byte volume) {
7599 * @return volume (byte)
76100 */
77101 public static byte getPlayerVolume (Player player ) {
78- UUID uuid = player .getUniqueId ();
102+ return getPlayerVolume (player .getUniqueId ());
103+ }
104+
105+ /**
106+ * Gets the volume for a given Player
107+ * @param uuid
108+ * @return volume (byte)
109+ */
110+ public static byte getPlayerVolume (UUID uuid ) {
79111 Byte byteObj = plugin .playerVolume .get (uuid );
80112 if (byteObj == null ) {
81113 byteObj = 100 ;
0 commit comments