mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Backported some minor fixes from ms4, credits to brenoepic.
This commit is contained in:
parent
4340261506
commit
f051d1d155
@ -27,7 +27,7 @@ public class AddYoutubePlaylistCommand extends Command {
|
||||
int itemId;
|
||||
|
||||
try {
|
||||
itemId = Integer.valueOf(params[1]);
|
||||
itemId = Integer.parseInt(params[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_add_youtube_playlist.no_base_item"));
|
||||
return true;
|
||||
@ -45,7 +45,7 @@ public class AddYoutubePlaylistCommand extends Command {
|
||||
return true;
|
||||
}
|
||||
|
||||
Emulator.getGameEnvironment().getItemManager().getYoutubeManager().addPlaylistToItem(Integer.valueOf(params[1]), playlist);
|
||||
Emulator.getGameEnvironment().getItemManager().getYoutubeManager().addPlaylistToItem(Integer.parseInt(params[1]), playlist);
|
||||
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO `youtube_playlists` (`item_id`, `playlist_id`) VALUES (?, ?)")) {
|
||||
statement.setInt(1, itemId);
|
||||
|
@ -95,20 +95,15 @@ public class YoutubeManager {
|
||||
final String playlistId = set.getString("playlist_id");
|
||||
|
||||
youtubeDataLoaderPool.submit(() -> {
|
||||
ArrayList<YoutubePlaylist> playlists = this.playlists.getOrDefault(itemId, new ArrayList<>());
|
||||
|
||||
YoutubePlaylist playlist;
|
||||
|
||||
try {
|
||||
playlist = this.getPlaylistDataById(playlistId);
|
||||
if (playlist != null) {
|
||||
playlists.add(playlist);
|
||||
this.addPlaylistToItem(itemId, playlist);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, e);
|
||||
}
|
||||
|
||||
this.playlists.put(itemId, playlists);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user