1
0

Add catch for IOException

Dieser Commit ist enthalten in:
Chaoscaot 2023-04-06 17:22:20 +02:00
Ursprung edb108b7b3
Commit f624d2893d

Datei anzeigen

@ -149,7 +149,7 @@ public class SchematicSearch {
task = BungeeCore.get().getProxy().getScheduler().runAsync(BungeeCore.get(), () -> { task = BungeeCore.get().getProxy().getScheduler().runAsync(BungeeCore.get(), () -> {
try { try {
NodeData data = NodeData.get(node); NodeData data = NodeData.get(node);
if(!data.getNodeFormat()) { if (!data.getNodeFormat()) {
Message.send("SCHEMATIC_SEARCH_NOT_SUPPORTED", player); Message.send("SCHEMATIC_SEARCH_NOT_SUPPORTED", player);
end(); end();
return; return;
@ -163,17 +163,15 @@ public class SchematicSearch {
while (!process.waitFor(100, TimeUnit.MILLISECONDS)) { while (!process.waitFor(100, TimeUnit.MILLISECONDS)) {
String s = readInputStream(stderr); String s = readInputStream(stderr);
if(s.length() > 0) { if (s.length() > 0) {
if(s.contains("s[")) { if (s.contains("s[")) {
s = s.substring(s.lastIndexOf("s[") + 1); s = s.substring(s.lastIndexOf("s[") + 1);
} }
BungeeCore.send(player, ChatMessageType.ACTION_BAR, "§7" + s.replace("", "§e█§7")); BungeeCore.send(player, ChatMessageType.ACTION_BAR, "§7" + s.replace("", "§e█§7"));
} }
} }
String s = readInputStream(stderr); String s = readInputStream(stderr);
if(s.contains("s[")) { if (s.contains("s[")) {
s = s.substring(s.lastIndexOf("s[") + 1); s = s.substring(s.lastIndexOf("s[") + 1);
} }
BungeeCore.send(player, ChatMessageType.ACTION_BAR, "§7" + s.replace("", "§e█§7")); BungeeCore.send(player, ChatMessageType.ACTION_BAR, "§7" + s.replace("", "§e█§7"));
@ -228,6 +226,8 @@ public class SchematicSearch {
Message.send("SCHEMATIC_SEARCH_TOO_MANY_RESULTS", player); Message.send("SCHEMATIC_SEARCH_TOO_MANY_RESULTS", player);
} }
end();
} catch (IOException | InterruptedException e) {
end(); end();
} catch (Exception e) { } catch (Exception e) {
end(); end();
@ -240,9 +240,11 @@ public class SchematicSearch {
if(process != null && process.isAlive()) { if(process != null && process.isAlive()) {
process.destroy(); process.destroy();
} }
if(pattern != null) { if(pattern != null) {
pattern.delete(); pattern.delete();
} }
if(task != null) { if(task != null) {
task.cancel(); task.cancel();
} }