mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
Add MusicPlayer achievement
This commit is contained in:
parent
6caadebe33
commit
f7196df08b
@ -63,7 +63,7 @@ public class InteractionJukeBox extends HabboItem
|
||||
room.getTraxManager().stop();
|
||||
} else
|
||||
{
|
||||
room.getTraxManager().play(0);
|
||||
room.getTraxManager().play(0, client.getHabbo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.rooms;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.core.Disposable;
|
||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.habbohotel.items.SoundTrack;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionJukeBox;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc;
|
||||
@ -26,6 +27,8 @@ public class TraxManager implements Disposable
|
||||
private int startedTimestamp = 0;
|
||||
private InteractionMusicDisc currentlyPlaying = null;
|
||||
private int playingIndex = 0;
|
||||
private int cycleStartedTimestamp = 0;
|
||||
private Habbo starter = null;
|
||||
|
||||
private boolean disposed = false;
|
||||
|
||||
@ -78,6 +81,11 @@ public class TraxManager implements Disposable
|
||||
}
|
||||
|
||||
public void play(int index)
|
||||
{
|
||||
this.play(index, null);
|
||||
}
|
||||
|
||||
public void play(int index, Habbo starter)
|
||||
{
|
||||
if (this.currentlyPlaying == null)
|
||||
{
|
||||
@ -99,6 +107,11 @@ public class TraxManager implements Disposable
|
||||
this.room.setJukeBoxActive(true);
|
||||
this.startedTimestamp = Emulator.getIntUnixTimestamp();
|
||||
this.playingIndex = index;
|
||||
|
||||
if (starter != null) {
|
||||
this.starter = starter;
|
||||
this.cycleStartedTimestamp = Emulator.getIntUnixTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
this.room.sendComposer(new JukeBoxNowPlayingMessageComposer(Emulator.getGameEnvironment().getItemManager().getSoundTrack(this.currentlyPlaying.getSongId()), this.playingIndex, 0).compose());
|
||||
@ -111,9 +124,15 @@ public class TraxManager implements Disposable
|
||||
|
||||
public void stop()
|
||||
{
|
||||
if (this.starter != null && this.cycleStartedTimestamp > 0) {
|
||||
AchievementManager.progressAchievement(this.starter, Emulator.getGameEnvironment().getAchievementManager().getAchievement("MusicPlayer"), (Emulator.getIntUnixTimestamp() - cycleStartedTimestamp) / 60);
|
||||
}
|
||||
|
||||
this.room.setJukeBoxActive(false);
|
||||
this.currentlyPlaying = null;
|
||||
this.startedTimestamp = 0;
|
||||
this.cycleStartedTimestamp = 0;
|
||||
this.starter = null;
|
||||
this.playingIndex = 0;
|
||||
|
||||
for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class))
|
||||
|
Loading…
Reference in New Issue
Block a user