Merge branch 'stanky-branch' into 'dev'

New Trax Manager and other fixes.

See merge request morningstar/Arcturus-Community!251
This commit is contained in:
Harmonic 2020-07-10 09:57:45 -04:00
commit 8c3745601e
7 changed files with 243 additions and 90 deletions

View File

@ -2,8 +2,10 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.interactions.InteractionJukeBox;
import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.rooms.TraxManager;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer;
@ -42,6 +44,12 @@ public class EmptyInventoryCommand extends Command {
TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>(); TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>();
items.putAll(habbo.getInventory().getItemsComponent().getItems()); items.putAll(habbo.getInventory().getItemsComponent().getItems());
habbo.getInventory().getItemsComponent().getItems().clear(); habbo.getInventory().getItemsComponent().getItems().clear();
for (HabboItem item : items.valueCollection()) {
if(item instanceof InteractionJukeBox)
TraxManager.removeAllSongs((InteractionJukeBox) item);
}
Emulator.getThreading().run(new QueryDeleteHabboItems(items)); Emulator.getThreading().run(new QueryDeleteHabboItems(items));
habbo.getClient().sendResponse(new InventoryRefreshComposer()); habbo.getClient().sendResponse(new InventoryRefreshComposer());

View File

@ -58,10 +58,13 @@ public class InteractionBackgroundToner extends HabboItem {
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects); super.onClick(client, room, objects);
if(client != null)
{
if (client.getHabbo().getRoomUnit().cmdSit && client.getHabbo().getRoomUnit().getEffectId() == 1337) { if (client.getHabbo().getRoomUnit().cmdSit && client.getHabbo().getRoomUnit().getEffectId() == 1337) {
Emulator.getThreading().run(new BackgroundAnimation(this, room)); new BackgroundAnimation(this, room).run();
return; return;
} }
}
if (this.getExtradata().split(":").length == 4) { if (this.getExtradata().split(":").length == 4) {
String[] data = this.getExtradata().split(":"); String[] data = this.getExtradata().split(":");

View File

@ -61,15 +61,13 @@ public class InteractionJukeBox extends HabboItem {
public void onPickUp(Room room) { public void onPickUp(Room room) {
super.onPickUp(room); super.onPickUp(room);
this.setExtradata("0"); this.setExtradata("0");
room.getTraxManager().removeTraxOnRoom(this);
if (room.getTraxManager().isPlaying() && room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class).isEmpty()) {
room.getTraxManager().clearPlayList();
}
} }
@Override @Override
public void onPlace(Room room) { public void onPlace(Room room) {
super.onPlace(room); super.onPlace(room);
room.getTraxManager().addTraxOnRoom(this);
if (room.getTraxManager().isPlaying()) { if (room.getTraxManager().isPlaying()) {
this.setExtradata("1"); this.setExtradata("1");
} }

View File

@ -9,12 +9,15 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionJukeBox;
import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc; import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer; import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer; import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer;
import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxMySongsComposer; import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxMySongsComposer;
import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxNowPlayingMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxNowPlayingMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxPlayListComposer; import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxPlayListComposer;
import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -27,8 +30,12 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class TraxManager implements Disposable { public class TraxManager implements Disposable {
public static int NORMAL_JUKEBOX_LIMIT = 10;
public static int LARGE_JUKEBOX_LIMIT = 20;
private static final Logger LOGGER = LoggerFactory.getLogger(TraxManager.class); private static final Logger LOGGER = LoggerFactory.getLogger(TraxManager.class);
private final Room room; private final Room room;
private InteractionJukeBox jukeBox;
private final List<InteractionMusicDisc> songs = new ArrayList<>(0); private final List<InteractionMusicDisc> songs = new ArrayList<>(0);
private int totalLength = 0; private int totalLength = 0;
private int startedTimestamp = 0; private int startedTimestamp = 0;
@ -36,27 +43,69 @@ public class TraxManager implements Disposable {
private int playingIndex = 0; private int playingIndex = 0;
private int cycleStartedTimestamp = 0; private int cycleStartedTimestamp = 0;
private Habbo starter = null; private Habbo starter = null;
private int songsLimit = 0;
private boolean disposed = false; private boolean disposed = false;
public TraxManager(Room room) { public TraxManager(Room room) {
this.room = room; this.room = room;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_trax_playlist WHERE room_id = ?")) { //Check if room has a Jukebox already on DB
this.jukeBox = this.loadRoomJukebox();
if (this.jukeBox == null) {
//Check again if there's a jukebox on room but has not been saved on DB before
for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class))
{
this.jukeBox = (InteractionJukeBox) item;
}
if(this.jukeBox != null)
{
this.loadPlaylist();
this.songsLimit = this.getSongsLimit(this.jukeBox);
}
} else {
this.loadPlaylist();
this.songsLimit = this.getSongsLimit(this.jukeBox);
}
}
public InteractionJukeBox loadRoomJukebox() {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_trax WHERE room_id = ?")) {
statement.setInt(1, this.room.getId()); statement.setInt(1, this.room.getId());
try (ResultSet set = statement.executeQuery()) {
if (set.next()) {
HabboItem jukebox = Emulator.getGameEnvironment().getItemManager().loadHabboItem(set.getInt("trax_item_id"));
if(jukebox != null) {
if (!(jukebox instanceof InteractionJukeBox)) {
return null;
} else {
return (InteractionJukeBox) jukebox;
}
}
}
}
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}
return null;
}
public void loadPlaylist() {
if(this.jukeBox == null) return;
this.songs.clear();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM trax_playlist WHERE trax_item_id = ?")) {
statement.setInt(1, this.jukeBox.getId());
try (ResultSet set = statement.executeQuery()) { try (ResultSet set = statement.executeQuery()) {
while (set.next()) { while (set.next()) {
HabboItem musicDisc = Emulator.getGameEnvironment().getItemManager().loadHabboItem(set.getInt("item_id")); HabboItem musicDisc = Emulator.getGameEnvironment().getItemManager().loadHabboItem(set.getInt("item_id"));
if(musicDisc != null) { if(musicDisc != null) {
if (!(musicDisc instanceof InteractionMusicDisc) || musicDisc.getRoomId() != -1) { if (!(musicDisc instanceof InteractionMusicDisc) || musicDisc.getRoomId() != -1) {
try (PreparedStatement stmt = connection.prepareStatement("DELETE FROM room_trax_playlist WHERE room_id = ? AND item_id = ? LIMIT 1")) { deleteSongFromPlaylist(this.jukeBox.getId(), musicDisc.getId());
stmt.setInt(1, this.room.getId());
stmt.setInt(2, musicDisc.getId());
stmt.execute();
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
return;
}
} else { } else {
SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(((InteractionMusicDisc) musicDisc).getSongId()); SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(((InteractionMusicDisc) musicDisc).getSongId());
@ -74,6 +123,54 @@ public class TraxManager implements Disposable {
} }
} }
public static void deleteSongFromPlaylist(int jukebox_id, int song_id)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM trax_playlist WHERE trax_item_id = ? AND item_id = ? LIMIT 1")) {
statement.setInt(1, jukebox_id);
statement.setInt(2, song_id);
statement.execute();
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}
}
public void addTraxOnRoom(InteractionJukeBox jukeBox) {
if(this.jukeBox != null) return;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement_1 = connection.prepareStatement("INSERT INTO room_trax (room_id, trax_item_id) VALUES (?, ?)"))
{
statement_1.setInt(1, this.room.getId());
statement_1.setInt(2, jukeBox.getId());
statement_1.execute();
}
catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
return;
}
this.jukeBox = jukeBox;
this.loadPlaylist();
this.songsLimit = this.getSongsLimit(this.jukeBox);
}
public void removeTraxOnRoom(InteractionJukeBox jukeBox) {
if(this.jukeBox.getId() != jukeBox.getId()) return;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement_1 = connection.prepareStatement("DELETE FROM room_trax WHERE room_id = ?"))
{
statement_1.setInt(1, this.room.getId());
statement_1.execute();
}
catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
return;
}
this.stop();
this.jukeBox = null;
this.songs.clear();
}
public void cycle() { public void cycle() {
if (this.isPlaying()) { if (this.isPlaying()) {
if (this.timePlaying() >= this.totalLength) { if (this.timePlaying() >= this.totalLength) {
@ -93,10 +190,8 @@ public class TraxManager implements Disposable {
public void play(int index, Habbo starter) { public void play(int index, Habbo starter) {
if (this.currentlyPlaying == null) { if (this.currentlyPlaying == null) {
for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class)) { this.jukeBox.setExtradata("1");
item.setExtradata("1"); this.room.updateItem(this.jukeBox);
this.room.updateItem(item);
}
} }
if (!this.songs.isEmpty()) { if (!this.songs.isEmpty()) {
@ -133,10 +228,8 @@ public class TraxManager implements Disposable {
this.starter = null; this.starter = null;
this.playingIndex = 0; this.playingIndex = 0;
for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class)) { this.jukeBox.setExtradata("0");
item.setExtradata("0"); this.room.updateItem(this.jukeBox);
this.room.updateItem(item);
}
this.room.sendComposer(new JukeBoxNowPlayingMessageComposer(null, -1, 0).compose()); this.room.sendComposer(new JukeBoxNowPlayingMessageComposer(null, -1, 0).compose());
} }
@ -149,14 +242,25 @@ public class TraxManager implements Disposable {
} }
public void addSong(InteractionMusicDisc musicDisc, Habbo habbo) { public void addSong(InteractionMusicDisc musicDisc, Habbo habbo) {
if(this.jukeBox == null) return;
if(this.songsLimit < this.songs.size() + 1)
{
THashMap<String, String> codes = new THashMap<>();
ServerMessage msg = new BubbleAlertComposer("${playlist.editor.alert.playlist.full.title}", "${playlist.editor.alert.playlist.full}").compose();
habbo.getClient().sendResponse(msg);
return;
}
SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId()); SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId());
if (track != null) { if (track != null)
{
this.totalLength += track.getLength(); this.totalLength += track.getLength();
this.songs.add(musicDisc); this.songs.add(musicDisc);
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO room_trax_playlist (room_id, item_id) VALUES (?, ?)")) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO trax_playlist (trax_item_id, item_id) VALUES (?, ?)")) {
statement.setInt(1, this.room.getId()); statement.setInt(1, this.jukeBox.getId());
statement.setInt(2, musicDisc.getId()); statement.setInt(2, musicDisc.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
@ -168,6 +272,7 @@ public class TraxManager implements Disposable {
musicDisc.setRoomId(-1); musicDisc.setRoomId(-1);
musicDisc.needsUpdate(true); musicDisc.needsUpdate(true);
Emulator.getThreading().run(musicDisc);
habbo.getInventory().getItemsComponent().removeHabboItem(musicDisc); habbo.getInventory().getItemsComponent().removeHabboItem(musicDisc);
habbo.getClient().sendResponse(new RemoveHabboItemComposer(musicDisc.getGiftAdjustedId())); habbo.getClient().sendResponse(new RemoveHabboItemComposer(musicDisc.getGiftAdjustedId()));
@ -177,19 +282,14 @@ public class TraxManager implements Disposable {
} }
public void removeSong(int itemId) { public void removeSong(int itemId) {
InteractionMusicDisc musicDisc = this.fromItemId(itemId); if(this.songs.isEmpty()) return;
InteractionMusicDisc musicDisc = this.getSong(itemId);
if (musicDisc != null) { if (musicDisc != null) {
this.songs.remove(musicDisc); this.songs.remove(musicDisc);
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_trax_playlist WHERE room_id = ? AND item_id = ? LIMIT 1")) { deleteSongFromPlaylist(this.jukeBox.getId(), itemId);
statement.setInt(1, this.room.getId());
statement.setInt(2, itemId);
statement.execute();
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
return;
}
this.totalLength -= Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId()).getLength(); this.totalLength -= Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId()).getLength();
if (this.currentlyPlaying == musicDisc) { if (this.currentlyPlaying == musicDisc) {
@ -200,6 +300,7 @@ public class TraxManager implements Disposable {
musicDisc.setRoomId(0); musicDisc.setRoomId(0);
musicDisc.needsUpdate(true); musicDisc.needsUpdate(true);
Emulator.getThreading().run(musicDisc);
Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getUserId()); Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getUserId());
@ -217,6 +318,87 @@ public class TraxManager implements Disposable {
this.sendUpdatedSongList(); this.sendUpdatedSongList();
} }
public static void removeAllSongs(InteractionJukeBox jukebox)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM trax_playlist WHERE trax_item_id = ?")) {
statement.setInt(1, jukebox.getId());
try (ResultSet set = statement.executeQuery()) {
while (set.next()) {
HabboItem musicDisc = Emulator.getGameEnvironment().getItemManager().loadHabboItem(set.getInt("item_id"));
deleteSongFromPlaylist(jukebox.getId(), set.getInt("item_id"));
if(musicDisc != null) {
if (musicDisc instanceof InteractionMusicDisc && musicDisc.getRoomId() == -1) {
musicDisc.setRoomId(0);
musicDisc.needsUpdate(true);
Emulator.getThreading().run(musicDisc);
Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getUserId());
if (owner != null) {
owner.getInventory().getItemsComponent().addItem(musicDisc);
GameClient client = owner.getClient();
if (client != null) {
client.sendResponse(new AddHabboItemComposer(musicDisc));
client.sendResponse(new InventoryRefreshComposer());
}
}
}
}
}
}
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}
}
public List<SoundTrack> soundTrackList() {
List<SoundTrack> trax = new ArrayList<>(this.songs.size());
for (InteractionMusicDisc musicDisc : this.songs) {
SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId());
if (track != null) {
trax.add(track);
}
}
return trax;
}
public List<InteractionMusicDisc> myList(Habbo habbo) {
return habbo.getInventory().getItemsComponent().getItems().valueCollection().stream()
.filter(i -> i instanceof InteractionMusicDisc && i.getRoomId() == 0)
.map(i -> (InteractionMusicDisc) i)
.collect(Collectors.toList());
}
public InteractionMusicDisc getSong(int itemId) {
for (InteractionMusicDisc musicDisc : this.songs) {
if (musicDisc != null && musicDisc.getId() == itemId) {
return musicDisc;
}
}
return null;
}
public int getSongsLimit(InteractionJukeBox jukeBox) {
if ("jukebox_big".equals(jukeBox.getBaseItem().getName())) {
return LARGE_JUKEBOX_LIMIT;
}
return NORMAL_JUKEBOX_LIMIT;
}
public void updateCurrentPlayingSong(Habbo habbo) {
if (this.isPlaying()) {
habbo.getClient().sendResponse(new JukeBoxNowPlayingMessageComposer(Emulator.getGameEnvironment().getItemManager().getSoundTrack(this.currentlyPlaying.getSongId()), this.playingIndex, 1000 * (Emulator.getIntUnixTimestamp() - this.startedTimestamp)));
} else {
habbo.getClient().sendResponse(new JukeBoxNowPlayingMessageComposer(null, -1, 0));
}
}
public void sendUpdatedSongList() { public void sendUpdatedSongList() {
this.room.getHabbos().forEach(h -> { this.room.getHabbos().forEach(h -> {
GameClient client = h.getClient(); GameClient client = h.getClient();
@ -243,53 +425,12 @@ public class TraxManager implements Disposable {
return this.currentlyPlaying != null; return this.currentlyPlaying != null;
} }
public List<SoundTrack> soundTrackList() { public int getSongsLimit() {
List<SoundTrack> trax = new ArrayList<>(this.songs.size()); return this.songsLimit;
for (InteractionMusicDisc musicDisc : this.songs) {
SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId());
if (track != null) {
trax.add(track);
}
} }
return trax; public InteractionJukeBox getJukeBox() {
} return this.jukeBox;
public List<InteractionMusicDisc> myList(Habbo habbo) {
return habbo.getInventory().getItemsComponent().getItems().valueCollection().stream()
.filter(i -> i instanceof InteractionMusicDisc && i.getRoomId() == 0)
.map(i -> (InteractionMusicDisc) i)
.collect(Collectors.toList());
}
public InteractionMusicDisc fromItemId(int itemId) {
for (InteractionMusicDisc musicDisc : this.songs) {
if (musicDisc != null && musicDisc.getId() == itemId) {
return musicDisc;
}
}
return null;
}
public void clearPlayList() {
this.songs.clear();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_trax_playlist WHERE room_id = ?")) {
statement.setInt(1, this.room.getId());
statement.execute();
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}
}
public void updateCurrentPlayingSong(Habbo habbo) {
if (this.isPlaying()) {
habbo.getClient().sendResponse(new JukeBoxNowPlayingMessageComposer(Emulator.getGameEnvironment().getItemManager().getSoundTrack(this.currentlyPlaying.getSongId()), this.playingIndex, 1000 * (Emulator.getIntUnixTimestamp() - this.startedTimestamp)));
} else {
habbo.getClient().sendResponse(new JukeBoxNowPlayingMessageComposer(null, -1, 0));
}
} }
@Override @Override

View File

@ -21,6 +21,11 @@ public class RequestGuildBuyEvent extends MessageHandler {
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
if (Emulator.getConfig().getBoolean("catalog.guild.hc_required", true) && this.client.getHabbo().getHabboStats().getClubExpireTimestamp() < Emulator.getIntUnixTimestamp()) {
this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.HC_REQUIRED));
return;
}
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) {
int guildPrice = Emulator.getConfig().getInt("catalog.guild.price"); int guildPrice = Emulator.getConfig().getInt("catalog.guild.price");
if (this.client.getHabbo().getHabboInfo().getCredits() >= guildPrice) { if (this.client.getHabbo().getHabboInfo().getCredits() >= guildPrice) {
@ -31,11 +36,6 @@ public class RequestGuildBuyEvent extends MessageHandler {
} }
} }
if (Emulator.getConfig().getBoolean("catalog.guild.hc_required", true) && this.client.getHabbo().getHabboStats().getClubExpireTimestamp() < Emulator.getIntUnixTimestamp()) {
this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.HC_REQUIRED));
return;
}
String name = this.packet.readString(); String name = this.packet.readString();
String description = this.packet.readString(); String description = this.packet.readString();

View File

@ -12,14 +12,14 @@ public class JukeBoxAddSoundTrackEvent extends MessageHandler {
if (!this.client.getHabbo().getHabboInfo().getCurrentRoom().hasRights(this.client.getHabbo())) return; if (!this.client.getHabbo().getHabboInfo().getCurrentRoom().hasRights(this.client.getHabbo())) return;
int itemId = this.packet.readInt(); int itemId = this.packet.readInt();
int unknown = this.packet.readInt(); int slotId = this.packet.readInt();
Habbo habbo = this.client.getHabbo(); Habbo habbo = this.client.getHabbo();
if (habbo != null) { if (habbo != null) {
HabboItem item = habbo.getInventory().getItemsComponent().getHabboItem(itemId); HabboItem item = habbo.getInventory().getItemsComponent().getHabboItem(itemId);
if (item != null && item instanceof InteractionMusicDisc && item.getRoomId() == 0) { if (item instanceof InteractionMusicDisc && item.getRoomId() == 0) {
this.client.getHabbo().getHabboInfo().getCurrentRoom().getTraxManager().addSong((InteractionMusicDisc) item, habbo); this.client.getHabbo().getHabboInfo().getCurrentRoom().getTraxManager().addSong((InteractionMusicDisc) item, habbo);
} }
} }

View File

@ -113,6 +113,8 @@ public class PluginManager {
NavigatorManager.MAXIMUM_RESULTS_PER_PAGE = Emulator.getConfig().getInt("hotel.navigator.search.maxresults"); NavigatorManager.MAXIMUM_RESULTS_PER_PAGE = Emulator.getConfig().getInt("hotel.navigator.search.maxresults");
NavigatorManager.CATEGORY_SORT_USING_ORDER_NUM = Emulator.getConfig().getBoolean("hotel.navigator.sort.ordernum"); NavigatorManager.CATEGORY_SORT_USING_ORDER_NUM = Emulator.getConfig().getBoolean("hotel.navigator.sort.ordernum");
RoomChatMessage.MAXIMUM_LENGTH = Emulator.getConfig().getInt("hotel.chat.max.length"); RoomChatMessage.MAXIMUM_LENGTH = Emulator.getConfig().getInt("hotel.chat.max.length");
TraxManager.LARGE_JUKEBOX_LIMIT = Emulator.getConfig().getInt("hotel.jukebox.limit.large");
TraxManager.NORMAL_JUKEBOX_LIMIT = Emulator.getConfig().getInt("hotel.jukebox.limit.normal");
String[] bannedBubbles = Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";"); String[] bannedBubbles = Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";");
RoomChatMessage.BANNED_BUBBLES = new int[bannedBubbles.length]; RoomChatMessage.BANNED_BUBBLES = new int[bannedBubbles.length];
@ -120,6 +122,7 @@ public class PluginManager {
try { try {
RoomChatMessage.BANNED_BUBBLES[i] = Integer.valueOf(bannedBubbles[i]); RoomChatMessage.BANNED_BUBBLES[i] = Integer.valueOf(bannedBubbles[i]);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("Caught exception", e);
} }
} }