diff --git a/src/me/despawningbone/discordbot/command/info/CityInfo.java b/src/me/despawningbone/discordbot/command/info/CityInfo.java
index 6a23d13..c0a7cd3 100644
--- a/src/me/despawningbone/discordbot/command/info/CityInfo.java
+++ b/src/me/despawningbone/discordbot/command/info/CityInfo.java
@@ -1,278 +1,283 @@
package me.despawningbone.discordbot.command.info;
import java.awt.Color;
import java.io.IOException;
import java.net.URL;
+import java.net.URLConnection;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.TimeZone;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
import me.despawningbone.discordbot.command.Command;
import me.despawningbone.discordbot.command.CommandResult;
import me.despawningbone.discordbot.command.CommandResult.CommandResultType;
import me.despawningbone.discordbot.utils.MiscUtils;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
public class CityInfo extends Command {
public CityInfo() {
this.alias = Arrays.asList("ci", "weather");
this.desc = "Search for info about a city!"; //"Search for info about the city the address is in!";
this.usage = "
";
for (String country : Locale.getISOCountries()) {
Locale locale = new Locale("en", country);
countryCodes.put(locale.getDisplayCountry(Locale.ENGLISH), locale.getCountry());
}
this.examples = Arrays.asList("hong kong", "tokyo"); //"HK", "akihabara");
}
HashMap countryCodes = new HashMap<>();
NumberFormat formatter = new DecimalFormat("#0.00");
//private final String flickrAPI = DiscordBot.tokens.getProperty("flickr");
@Override
public CommandResult execute(TextChannel channel, User author, Message msg, String[] args) {
if(args.length < 1) {
return new CommandResult(CommandResultType.INVALIDARGS, "Please input a city name."); //or a address.");
} else {
channel.sendTyping().queue();
String sword = String.join(" ", args);
try {
/*JSONTokener georesult = null;
InputStream geostream = null;
String search = URLEncoder.encode(sword, "UTF-8");
URL geocode = null;
try {
geocode = new URL("https://maps.googleapis.com/maps/api/geocode/json?address=" + search + "&key=" + AudioPlayer.GAPI + "&language=en");
geostream = geocode.openStream();
} catch (IOException e) {
e.printStackTrace();
}
georesult = new JSONTokener(geostream);
JSONObject geomain = new JSONObject(georesult);
JSONArray resultList = geomain.getJSONArray("results");
if(resultList.isNull(0)) {
channel.sendMessage("Unfortunately there is no results :cry:").queue();
return new CommandResult(CommandResultType.NORESULT);
}
JSONObject firstResult = resultList.getJSONObject(0);
JSONObject loc = firstResult.getJSONObject("geometry").getJSONObject("location");
//String formattedAddr = firstResult.getString("formatted_address");
JSONArray addrComponents = firstResult.getJSONArray("address_components");
String formattedAddr = "", addr = firstResult.getString("formatted_address");
String countryShort = null; String region = null; String locality = null; String country = null; String colarea = null;
boolean stop = false;
for(int i = 0; i < addrComponents.length(); i++) {
JSONObject component = addrComponents.getJSONObject(i);
String compname = component.getString("long_name");
if(!stop) {
if(i == addrComponents.length() - 1) {
formattedAddr += compname;
} else {
formattedAddr += compname + ", ";
}
}
List