Skip to content

Commit

Permalink
fix formatting and nulls in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jagrosh committed Mar 1, 2024
1 parent 781a94e commit fa5e33e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/jagrosh/jmusicbot/audio/QueuedTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public QueuedTrack(AudioTrack track, User owner)
public QueuedTrack(AudioTrack track, RequestMetadata rm)
{
this.track = track;
this.track.setUserData(rm);
this.track.setUserData(rm == null ? RequestMetadata.EMPTY : rm);
}

@Override
public long getIdentifier()
{
return track.getUserData(RequestMetadata.class).getOwner();
return track.getUserData() == null ? 0L : track.getUserData(RequestMetadata.class).getOwner();
}

public AudioTrack getTrack()
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/jagrosh/jmusicbot/queue/FairQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
* @author John Grosh (jagrosh)
* @param <T>
*/
public class FairQueue<T extends Queueable> {
public class FairQueue<T extends Queueable>
{
private final List<T> list = new ArrayList<>();
private final Set<Long> set = new HashSet<>();

public int add(T item)
{
int lastIndex;
for(lastIndex=list.size()-1; lastIndex>-1; lastIndex--)
if(list.get(lastIndex).getIdentifier()==item.getIdentifier())
if(list.get(lastIndex).getIdentifier() == item.getIdentifier())
break;
lastIndex++;
set.clear();
Expand Down

0 comments on commit fa5e33e

Please sign in to comment.