cleanup code

This commit is contained in:
brenoepic 2022-04-29 00:05:28 -03:00
parent 572961c2fa
commit 376a28dcbd
2 changed files with 16 additions and 25 deletions

View File

@ -120,7 +120,7 @@ public class YoutubeManager {
try { try {
youtubeDataLoaderPool.awaitTermination(60, TimeUnit.SECONDS); youtubeDataLoaderPool.awaitTermination(60, TimeUnit.SECONDS);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); LOGGER.error("Caught Exception", e);
} }
LOGGER.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
@ -129,8 +129,7 @@ public class YoutubeManager {
public YoutubePlaylist getPlaylistDataById(String playlistId) throws IOException { public YoutubePlaylist getPlaylistDataById(String playlistId) throws IOException {
if (this.playlistCache.containsKey(playlistId)) return this.playlistCache.get(playlistId); if (this.playlistCache.containsKey(playlistId)) return this.playlistCache.get(playlistId);
if(apiKey.isEmpty()) return null; if (apiKey.isEmpty()) return null;
YoutubePlaylist playlist; YoutubePlaylist playlist;
URL playlistInfo = new URL("https://youtube.googleapis.com/youtube/v3/playlists?part=snippet&id=" + playlistId + "&maxResults=1&key=" + apiKey); URL playlistInfo = new URL("https://youtube.googleapis.com/youtube/v3/playlists?part=snippet&id=" + playlistId + "&maxResults=1&key=" + apiKey);
HttpsURLConnection playlistCon = (HttpsURLConnection) playlistInfo.openConnection(); HttpsURLConnection playlistCon = (HttpsURLConnection) playlistInfo.openConnection();

View File

@ -24,37 +24,29 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
public class InteractionBuildArea extends InteractionCustomValues { public class InteractionBuildArea extends InteractionCustomValues {
public static THashMap<String, String> defaultValues = new THashMap<String, String>() { protected static final THashMap<String, String> defaultValues = new THashMap<String, String>();
{
this.put("tilesLeft", "0");
}
{ private final THashSet<RoomTile> tiles;
this.put("tilesRight", "0");
}
{
this.put("tilesFront", "0");
}
{
this.put("tilesBack", "0");
}
{
this.put("builders", "");
}
};
private THashSet<RoomTile> tiles;
public InteractionBuildArea(ResultSet set, Item baseItem) throws SQLException { public InteractionBuildArea(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem, defaultValues); super(set, baseItem, defaultValues);
defaultValues.put("tilesLeft", "0");
defaultValues.put("tilesRight", "0");
defaultValues.put("tilesFront", "0");
defaultValues.put("tilesBack", "0");
defaultValues.put("builders", "");
tiles = new THashSet<>(); tiles = new THashSet<>();
} }
public InteractionBuildArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionBuildArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues);
defaultValues.put("tilesLeft", "0");
defaultValues.put("tilesRight", "0");
defaultValues.put("tilesFront", "0");
defaultValues.put("tilesBack", "0");
defaultValues.put("builders", "");
tiles = new THashSet<>(); tiles = new THashSet<>();
} }