Skip to content

Commit

Permalink
[CENC] Use API's intensity
Browse files Browse the repository at this point in the history
  • Loading branch information
TenkyuChimata committed Mar 31, 2024
1 parent 0ca71d7 commit c8a92fd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 39 deletions.
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.4.0</version>
<version>2.4.1-b1</version>
<packaging>jar</packaging>

<name>MCEEW</name>
Expand Down
39 changes: 1 addition & 38 deletions src/main/java/jp/wolfx/mceew/MCEEW.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,40 +161,6 @@ private static void playSound(String alert_sound_type, double alert_sound_volume
}
}

public static int calcMaxInt(double magnitude, double depth, String epicenter) {
double a, b, c, d;
if (epicenter == null) {
a = 3.944;
b = 1.071;
c = 1.2355678010148;
d = 7;
return (int) Math.floor(a + b * magnitude + 0 * magnitude * magnitude - c * Math.log(d * (depth + 25) / 40) + 0.2);
}
if (epicenter.contains("四川") || epicenter.contains("西藏") || epicenter.contains("青海")) {
a = 3.6113;
b = 1.4347;
c = 1.6710348780191;
d = 13;
} else if (epicenter.contains("新疆")) {
a = 3.3682;
b = 1.2746;
c = 1.4383398946154;
d = 9;
} else {
a = 3.944;
b = 1.071;
c = 1.2355678010148;
d = 7;
}
if (epicenter.contains("内江市") || epicenter.contains("宜宾市")) {
a = 3.6588;
b = 1.3626;
c = 1.5376630426267;
d = 13;
}
return (int) Math.floor(a + b * magnitude + 0 * magnitude * magnitude - c * Math.log(d * (depth + 25) / 40) + 0.2);
}

private void cancelScheduler() {
if (!folia) {
Bukkit.getScheduler().cancelTasks(this);
Expand Down Expand Up @@ -404,16 +370,13 @@ private static void cencEqlistExecute(Boolean cencEqlistBoolean) {
String latitude = cencEqlistData.get("No1").getAsJsonObject().get("latitude").getAsString();
String longitude = cencEqlistData.get("No1").getAsJsonObject().get("longitude").getAsString();
String origin_time = getDate("yyyy-MM-dd HH:mm:ss", time_format, "Asia/Shanghai", time_str);
String intensity = String.valueOf(calcMaxInt(Double.parseDouble(mag), Double.parseDouble(depth), region));
String intensity = cencEqlistData.get("No1").getAsJsonObject().get("intensity").getAsString();
depth += "km";
if (Objects.equals(type, "reviewed")) {
type = "正式测定";
} else {
type = "自动测定";
}
if (region.startsWith("中国")) {
region = region.replace("中国", "");
}
if (cencEqlist_md5 != null && cencEqlistBoolean) {
Bukkit.broadcastMessage(
cencEqlist_broadcast_message.
Expand Down

0 comments on commit c8a92fd

Please sign in to comment.