Skip to content

Commit

Permalink
Avoid reassigning parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
TenkyuChimata committed Jul 12, 2023
1 parent e95f42b commit 64bab7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 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.2.1-b6</version>
<version>2.2.1-b7</version>
<packaging>jar</packaging>

<name>MCEEW</name>
Expand Down
27 changes: 12 additions & 15 deletions src/main/java/jp/wolfx/mceew/MCEEW.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private static void jmaEewExecute() {
if (debug_bool) {
Bukkit.getLogger().info("[MCEEW] Japan EEW detected.");
}
eewAction(flag, report_time, origin_time, num, lat, lon, region, mag, depth, shindo, type);
eewAction(flag, report_time, origin_time, num, lat, lon, region, mag, depth, getShindoColor(shindo), type);
}
OriginalText = jmaEewData.get("OriginalText").getAsString();
} else {
Expand Down Expand Up @@ -299,7 +299,7 @@ private static void scEewExecute() {
if (debug_bool) {
Bukkit.getLogger().info("[MCEEW] Sichuan EEW detected.");
}
scEewAction(report_time, origin_time, num, lat, lon, region, mag, depth + "km", intensity);
scEewAction(report_time, origin_time, num, lat, lon, region, mag, depth + "km", getIntensityColor(intensity));
}
EventID = scEewData.get("EventID").getAsString();
sc_info.clear();
Expand Down Expand Up @@ -454,7 +454,6 @@ private static void eewTest(int flag) {
}

private static void eewAction(String flag, String report_time, String origin_time, String num, String lat, String lon, String region, String mag, String depth, String shindo, String type) {
shindo = getShindoColor(shindo);
if (broadcast_bool) {
if (Objects.equals(flag, "警報")) {
Bukkit.broadcastMessage(
Expand Down Expand Up @@ -559,7 +558,6 @@ private static void eewAction(String flag, String report_time, String origin_tim
}

private static void scEewAction(String report_time, String origin_time, String num, String lat, String lon, String region, String mag, String depth, String intensity) {
intensity = getIntensityColor(intensity);
if (broadcast_bool) {
Bukkit.broadcastMessage(
sichuan_broadcast_message.
Expand Down Expand Up @@ -653,27 +651,26 @@ private static void cwbEewAction(String report_time, String origin_time, String
private static String getShindoColor(String shindo) {
String[] shindo_color = new String[]{"§f", "§7", "§b", "§9", "§a", "§e", "§6", "§c", "§4", "§d"};
if (Objects.equals(shindo, "1")) {
shindo = shindo_color[1] + shindo;
return shindo_color[1] + shindo;
} else if (Objects.equals(shindo, "2")) {
shindo = shindo_color[2] + shindo;
return shindo_color[2] + shindo;
} else if (Objects.equals(shindo, "3")) {
shindo = shindo_color[3] + shindo;
return shindo_color[3] + shindo;
} else if (Objects.equals(shindo, "4")) {
shindo = shindo_color[4] + shindo;
return shindo_color[4] + shindo;
} else if (Objects.equals(shindo, "5弱")) {
shindo = shindo_color[5] + shindo;
return shindo_color[5] + shindo;
} else if (Objects.equals(shindo, "5強")) {
shindo = shindo_color[6] + shindo;
return shindo_color[6] + shindo;
} else if (Objects.equals(shindo, "6弱")) {
shindo = shindo_color[7] + shindo;
return shindo_color[7] + shindo;
} else if (Objects.equals(shindo, "6強")) {
shindo = shindo_color[8] + shindo;
return shindo_color[8] + shindo;
} else if (Objects.equals(shindo, "7")) {
shindo = shindo_color[9] + shindo;
return shindo_color[9] + shindo;
} else {
shindo = shindo_color[0] + shindo;
return shindo_color[0] + shindo;
}
return shindo;
}

private static String getIntensityColor(String intensity) {
Expand Down

0 comments on commit 64bab7c

Please sign in to comment.