Skip to content

Commit

Permalink
Update configuration and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
TenkyuChimata committed Jul 11, 2023
1 parent b2b5543 commit e61952f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 56 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>jp.wolfx</groupId>
<artifactId>MCEEW</artifactId>
<version>2.2.1-b2</version>
<version>2.2.1-b3</version>
<packaging>jar</packaging>

<name>MCEEW</name>
Expand Down
30 changes: 15 additions & 15 deletions src/main/java/jp/wolfx/mceew/MCEEW.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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.");
}
}
Expand All @@ -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.
Expand All @@ -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.");
}
}
}
Expand All @@ -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);
Expand All @@ -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.");
}
}
Expand All @@ -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);
Expand All @@ -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.");
}
}
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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")));
Expand Down
55 changes: 19 additions & 36 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
########################

Expand All @@ -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
Expand All @@ -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:
Expand All @@ -98,36 +89,28 @@ 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"
# Set the alert sound volume
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
Expand Down

0 comments on commit e61952f

Please sign in to comment.