diff --git a/pom.xml b/pom.xml index ab28343..af247ce 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ jp.wolfx MCEEW - 2.2.1 + 2.2.2-b1 jar MCEEW diff --git a/src/main/java/jp/wolfx/mceew/MCEEW.java b/src/main/java/jp/wolfx/mceew/MCEEW.java index b5f9836..9fe67c8 100644 --- a/src/main/java/jp/wolfx/mceew/MCEEW.java +++ b/src/main/java/jp/wolfx/mceew/MCEEW.java @@ -69,7 +69,7 @@ public final class MCEEW extends JavaPlugin { private static final ArrayList final_info = new ArrayList<>(); private static final ArrayList sc_info = new ArrayList<>(); private static final ArrayList cwb_info = new ArrayList<>(); - private final String version = this.getDescription().getVersion().replace("-b", ""); + private final String version = this.getDescription().getVersion(); private static final boolean folia = isFolia(); @Override @@ -146,7 +146,7 @@ private void updater() { if (responseData != null) { JsonObject json = JsonParser.parseString(responseData).getAsJsonObject(); String api_version = json.get("version").getAsString(); - if (Integer.parseInt(api_version.replaceAll("\\.", "")) > Integer.parseInt(version.replaceAll("\\.", ""))) { + if (Integer.parseInt(api_version.replaceAll("\\.", "")) > Integer.parseInt(version.replaceAll("-b.*", "").replaceAll("\\.", ""))) { Bukkit.getLogger().warning("[MCEEW] New plugin version v" + api_version + " detected, Please download a new version from https://acg.kr/mceew"); } else { Bukkit.getLogger().info("[MCEEW] You are running the latest version."); @@ -216,7 +216,7 @@ private static void jmaEewExecute() { type = "仮定震源"; } if (jmaEewData.get("isFinal").getAsBoolean()) { - if (!type.equals("")) { + if (!type.isEmpty()) { type = type + " (最終報)"; } else { type = "最終報"; @@ -245,6 +245,8 @@ private static void jmaEqlistExecute(Boolean finalBoolean) { String region = jmaEqlistData.get("No1").getAsJsonObject().get("location").getAsString(); String mag = jmaEqlistData.get("No1").getAsJsonObject().get("magnitude").getAsString(); String depth = jmaEqlistData.get("No1").getAsJsonObject().get("depth").getAsString(); + String latitude = jmaEqlistData.get("No1").getAsJsonObject().get("latitude").getAsString(); + String longitude = jmaEqlistData.get("No1").getAsJsonObject().get("longitude").getAsString(); String shindo = jmaEqlistData.get("No1").getAsJsonObject().get("shindo").getAsString(); String info = jmaEqlistData.get("No1").getAsJsonObject().get("info").getAsString(); String origin_time = getDate("yyyy/MM/dd HH:mm", time_format_final, "Asia/Tokyo", time_str); @@ -259,6 +261,8 @@ private static void jmaEqlistExecute(Boolean finalBoolean) { replaceAll("%region%", region). replaceAll("%mag%", mag). replaceAll("%depth%", depth). + replaceAll("%lat%", latitude). + replaceAll("%lon%", longitude). replaceAll("%shindo%", getShindoColor(shindo)). replaceAll("%info%", info) ); @@ -270,6 +274,8 @@ private static void jmaEqlistExecute(Boolean finalBoolean) { final_info.add(region); final_info.add(mag); final_info.add(depth); + final_info.add(latitude); + final_info.add(longitude); final_info.add(shindo); final_info.add(info); } else { @@ -392,8 +398,10 @@ private static void getEewInfo(int flag, CommandSender sender) { replaceAll("%region%", final_info.get(1)). replaceAll("%mag%", final_info.get(2)). replaceAll("%depth%", final_info.get(3)). - replaceAll("%shindo%", getShindoColor(final_info.get(4))). - replaceAll("%info%", final_info.get(5)) + replaceAll("%lat%", final_info.get(4)). + replaceAll("%lon%", final_info.get(5)). + replaceAll("%shindo%", getShindoColor(final_info.get(6))). + replaceAll("%info%", final_info.get(7)) ); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 849b61b..dfcb6dd 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,6 +1,6 @@ # # MCEEW configuration -# Last updated on 2.2.1 +# Last updated on 2.2.2 # # API Source: https://api.wolfx.jp # Plugin Page: https://acg.kr/mceew @@ -65,7 +65,7 @@ Message: subtitle: "&e%region%で震度%shindo%&eの地震" # Set the Japan final report message format Final: - broadcast: "&e地震情報\n &e%origin_time% &f発生\n &f震央: &e%region%\n &fマグニチュード: &e%mag%\n &f深さ: &e%depth%\n &f最大震度: &e%shindo%\n &f津波情報: &e%info%" + broadcast: "&e地震情報\n &e%origin_time% &f発生\n &f震央: &e%region% (北緯: &e%lat%度 東経: &e%lon%度)\n &fマグニチュード: &e%mag%\n &f深さ: &e%depth%\n &f最大震度: &e%shindo%\n &f津波情報: &e%info%" # Set the Sichuan EEW message format Sichuan: broadcast: "&c四川地震预警 | 第%num%报\n &e%origin_time% &f发生\n &f震中: &e%region% (北纬: &e%lat%度 东经: &e%lon%度)\n &f震级: &e%mag%\n &f深度: &e%depth%\n &f最大烈度: &e%shindo%\n &f更新时间: &e%report_time%"