From e61952f83232cb473c7a6d6139c81d3e395b2bf8 Mon Sep 17 00:00:00 2001 From: TenkyuChimata Date: Wed, 12 Jul 2023 01:02:02 +0800 Subject: [PATCH] Update configuration and readme --- README.md | 9 ++-- pom.xml | 2 +- src/main/java/jp/wolfx/mceew/MCEEW.java | 30 +++++++------- src/main/resources/config.yml | 55 +++++++++---------------- 4 files changed, 40 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 2590c5c..f8e6775 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,11 @@ A real-time Earthquake Early Warning(EEW) plugin for Minecraft Server. ## Screenshots -![1.png](https://s2.loli.net/2023/01/02/CcTDAKlosye4d3Y.png) -![2.png](https://s2.loli.net/2023/01/02/Zfmi9wWnbzBNF7H.png) -![3.png](https://s2.loli.net/2023/01/02/OBlvaopQjId6zJT.png) -![4.png](https://s2.loli.net/2023/01/02/EwCyZz35VmKUIkQ.png) +![1.png](https://s2.loli.net/2023/07/12/QSyfaT8DxYBdcs3.png) +![2.png](https://s2.loli.net/2023/07/12/SB3jP2TslVDnR4F.png) +![3.png](https://s2.loli.net/2023/07/12/d58aXyUEieQDN7Z.png) +![4.png](https://s2.loli.net/2023/07/12/y16andOfi4FhkuU.png) +![5.png](https://s2.loli.net/2023/07/12/XMtCy2UfjOqIdY1.png) ## Bstats diff --git a/pom.xml b/pom.xml index d15e364..279d992 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ jp.wolfx MCEEW - 2.2.1-b2 + 2.2.1-b3 jar MCEEW diff --git a/src/main/java/jp/wolfx/mceew/MCEEW.java b/src/main/java/jp/wolfx/mceew/MCEEW.java index 6513e42..6180d97 100644 --- a/src/main/java/jp/wolfx/mceew/MCEEW.java +++ b/src/main/java/jp/wolfx/mceew/MCEEW.java @@ -30,7 +30,7 @@ public final class MCEEW extends JavaPlugin { private static boolean broadcast_bool; private static boolean title_bool; private static boolean alert_bool; - private static boolean notification_bool; + private static boolean debug_bool; private static String time_format; private static String time_format_final; private static String alert_broadcast_message; @@ -123,7 +123,7 @@ private void mceewScheduler(boolean eewBoolean, boolean jpEewBoolean, boolean fi } } if (updaterBoolean) { - Bukkit.getAsyncScheduler().runNow(plugin, task12 -> updater()); + Bukkit.getAsyncScheduler().runNow(plugin, task5 -> updater()); } } } @@ -166,7 +166,7 @@ private static String getAPI(int timeout, int source) { data = raw_data.toString(); } } catch (IOException e) { - if (notification_bool) { + if (debug_bool) { Bukkit.getLogger().warning("[MCEEW] API connection failed, retrying..."); Bukkit.getLogger().warning(String.valueOf(e)); } @@ -232,14 +232,14 @@ private void eewChecker() { type = "取消"; } if (OriginalText != null) { - if (notification_bool) { + if (debug_bool) { Bukkit.getLogger().info("[MCEEW] Japan EEW detected."); } eewAction(flag, report_time, origin_time, num, lat, lon, region, mag, depth, shindo, type); } OriginalText = json.get("OriginalText").getAsString(); } else { - if (notification_bool) { + if (debug_bool) { Bukkit.getLogger().info("[MCEEW] No Japan EEW issued."); } } @@ -259,8 +259,8 @@ private void finalChecker() { String info = json.get("info").getAsString(); String origin_time = getDate("yyyy/MM/dd HH:mm", time_format_final, "Asia/Tokyo", time_str); if (final_md5 != null) { - if (notification_bool) { - Bukkit.getLogger().info("[MCEEW] Final report updated."); + if (debug_bool) { + Bukkit.getLogger().info("[MCEEW] Japan final report updated."); } Bukkit.broadcastMessage( final_broadcast_message. @@ -281,8 +281,8 @@ private void finalChecker() { final_info.add(shindo); final_info.add(info); } else { - if (notification_bool) { - Bukkit.getLogger().info("[MCEEW] No final report update."); + if (debug_bool) { + Bukkit.getLogger().info("[MCEEW] No Japan final report update."); } } } @@ -306,7 +306,7 @@ private void scEewChecker() { String intensity = String.valueOf(Math.round(Float.parseFloat(json.get("MaxIntensity").getAsString()))); String origin_time = getDate("yyyy-MM-dd HH:mm:ss", time_format, "Asia/Shanghai", json.get("OriginTime").getAsString()); if (EventID != null) { - if (notification_bool) { + if (debug_bool) { Bukkit.getLogger().info("[MCEEW] Sichuan EEW detected."); } scEewAction(report_time, origin_time, num, lat, lon, region, mag, depth + "km", intensity); @@ -323,7 +323,7 @@ private void scEewChecker() { sc_info.add(depth); sc_info.add(intensity); } else { - if (notification_bool) { + if (debug_bool) { Bukkit.getLogger().info("[MCEEW] No Sichuan EEW issued."); } } @@ -344,7 +344,7 @@ private void cwbEewChecker() { String depth = json.get("Depth").getAsString() + "km"; String origin_time = getDate("yyyy-MM-dd HH:mm:ss", time_format, "Asia/Shanghai", json.get("OriginTime").getAsString()); if (cwbTS != null) { - if (notification_bool) { + if (debug_bool) { Bukkit.getLogger().info("[MCEEW] Taiwan EEW detected."); } cwbEewAction(report_time, origin_time, num, lat, lon, region, mag, depth); @@ -360,7 +360,7 @@ private void cwbEewChecker() { cwb_info.add(mag); cwb_info.add(depth); } else { - if (notification_bool) { + if (debug_bool) { Bukkit.getLogger().info("[MCEEW] No Taiwan EEW issued."); } } @@ -696,7 +696,7 @@ private static String getIntensityColor(String intensity) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { if (args.length == 0) { - sender.sendMessage("§a[MCEEW] Version: v" + version); + sender.sendMessage("§a[MCEEW] Plugin Version: v" + version); sender.sendMessage("§a[MCEEW] §3/eew§a - List commands."); sender.sendMessage("§a[MCEEW] §3/eew test§a - Run EEW send test."); sender.sendMessage("§a[MCEEW] §3/eew info§a - Get earthquake information."); @@ -759,7 +759,7 @@ private void loadEew(boolean first) { broadcast_bool = this.getConfig().getBoolean("Action.broadcast"); title_bool = this.getConfig().getBoolean("Action.title"); alert_bool = this.getConfig().getBoolean("Action.alert"); - notification_bool = this.getConfig().getBoolean("Action.notification"); + debug_bool = this.getConfig().getBoolean("Action.debug"); alert_broadcast_message = ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(this.getConfig().getString("Message.Alert.broadcast"))); alert_title_message = ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(this.getConfig().getString("Message.Alert.title"))); alert_subtitle_message = ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(this.getConfig().getString("Message.Alert.subtitle"))); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e6f3914..9418a5a 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -12,15 +12,15 @@ # %flag% 予報 or 警報 # %report_time% EEW report time # %origin_time% Time of Earthquake -# %num% Number of reports +# %num% Number of EEW reports # %lat% Latitude of the epicenter # %lon% Longitude of the epicenter # %region% Name of the epicenter # %mag% Magnitude of earthquake # %depth% Depth of earthquake -# %shindo% Shindo of earthquake -# %type% 最終報 or 訓練 or 訓練 (最終報) or 取消 -# %info% Tsunami information (only valid for final report) +# %shindo% Intensity of earthquake +# %type% 仮定震源 or 最終報 or 訓練 or 仮定震源 (最終報) or 訓練 (最終報) or 取消 +# %info% Tsunami information # \n Change to next line ######################## @@ -30,7 +30,7 @@ EEW: true # Enable Japan JMA EEW enable_jp: true -# Enable Sichuan China EEW +# Enable Sichuan EEW enable_sc: true # Enable Taiwan CWB EEW @@ -47,46 +47,37 @@ Action: title: true # Enable sound alert alert: true - # Enable final report broadcast + # Enable Japan final report broadcast final: true # Broadcast debug message to console - notification: false + debug: false Message: - # Set the alert report messages + # Set the Japan EEW alert report message format Alert: - # Set the message to be broadcast to chat + # Set the chat message format broadcast: "&c緊急地震速報 (%flag%) | 第%num%報 %type%\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%" - # Set the message to be broadcast to title + # Set the title message format title: "&c緊急地震速報 (%flag%)" - # Set the message to be broadcast to subtitle + # Set the subtitle message format subtitle: "&e%region%で震度%shindo%&eの地震" - # Set the forecast report messages + # Set the Japan EEW forecast report message format Forecast: - # Set the message to be broadcast to chat broadcast: "&e緊急地震速報 (%flag%) | 第%num%報 %type%\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%" - # Set the message to be broadcast to title title: "&e緊急地震速報 (%flag%)" - # Set the message to be broadcast to subtitle subtitle: "&e%region%で震度%shindo%&eの地震" - # Set the final report messages + # Set the Japan final report message format Final: - # Set the message to be broadcast to chat 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%" - # Set the Sichuan China EEW messages + # Set the Sichuan EEW message format Sichuan: - # Set the message to be broadcast to chat 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%" - # Set the message to be broadcast to title title: "&c四川地震预警" - # Set the message to be broadcast to subtitle subtitle: "&e%region%发生烈度%shindo%&e的地震" + # Set the Taiwan EEW message format Taiwan: - # Set the message to be broadcast to chat 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%report_time%" - # Set the message to be broadcast to title title: "&c台灣地震預警" - # Set the message to be broadcast to subtitle subtitle: "&e%region%发生芮氏規模%mag%地震" Color: @@ -98,7 +89,7 @@ Color: Intensity: [ "&f", "&7", "&b", "&3", "&9", "&a", "&2", "&e", "&6", "&c", "&4", "&d", "&5" ] Sound: - # Set the alert report alert sound + # Set the Japan EEW alert report alert Alert: # Set the alert sound type type: "BLOCK_NOTE_BLOCK_PLING" @@ -106,28 +97,20 @@ Sound: volume: 1000.0 # Set the alert sound pitch pitch: 1.0 - # Set the forecast report alert sound + # Set the Japan EEW forecast report alert Forecast: - # Set the alert sound type type: "BLOCK_NOTE_BLOCK_PLING" - # Set the alert sound volume volume: 1000.0 - # Set the alert sound pitch pitch: 1.0 - # Set the Sichuan China EEW alert sound + # Set the Sichuan EEW alert Sichuan: - # Set the alert sound type type: "BLOCK_NOTE_BLOCK_PLING" - # Set the alert sound volume volume: 1000.0 - # Set the alert sound pitch pitch: 1.0 + # Set the Taiwan EEW alert Taiwan: - # Set the alert sound type type: "BLOCK_NOTE_BLOCK_PLING" - # Set the alert sound volume volume: 1000.0 - # Set the alert sound pitch pitch: 1.0 # Do not change this