|
54 | 54 | import java.io.InputStream; |
55 | 55 | import java.nio.file.Files; |
56 | 56 | import java.nio.file.Path; |
57 | | -import java.util.ArrayList; |
58 | | -import java.util.Arrays; |
59 | | -import java.util.Collections; |
60 | | -import java.util.Comparator; |
61 | | -import java.util.HashMap; |
62 | | -import java.util.HashSet; |
63 | | -import java.util.List; |
64 | | -import java.util.Map; |
65 | | -import java.util.Set; |
66 | | -import java.util.TreeSet; |
| 57 | +import java.util.*; |
67 | 58 | import java.util.concurrent.BlockingQueue; |
68 | 59 | import java.util.concurrent.Callable; |
69 | 60 | import java.util.concurrent.CompletableFuture; |
@@ -983,22 +974,28 @@ public static ArrayList<TriggerItem> loadItems(SectionNode node) { |
983 | 974 | TypeHints.enterScope(); // Begin conditional type hints |
984 | 975 |
|
985 | 976 | TriggerItem section; |
| 977 | + RetainingLogHandler handler = SkriptLogger.startRetainingLog(); |
986 | 978 | find_section: |
987 | | - try (ParseLogHandler handler = SkriptLogger.startParseLogHandler()) { |
| 979 | + try { |
988 | 980 | section = Section.parse(expr, "Can't understand this section: " + expr, (SectionNode) subNode, items); |
989 | 981 | if (section != null) |
990 | 982 | break find_section; |
991 | | - ParseLogHandler copy = handler.backup(); |
| 983 | + |
| 984 | + // back up the failure log |
| 985 | + RetainingLogHandler backup = handler.backup(); |
992 | 986 | handler.clear(); |
993 | 987 |
|
994 | 988 | section = Statement.parse(expr, "Can't understand this effect: " + expr, (SectionNode) subNode, items); |
995 | 989 |
|
996 | 990 | if (section != null) |
997 | 991 | break find_section; |
998 | 992 |
|
999 | | - handler.restore(copy); |
1000 | | - handler.printLog(); |
| 993 | + // restore the failure log |
| 994 | + handler.restore(backup); |
1001 | 995 | continue; |
| 996 | + } finally { |
| 997 | + handler.printLog(); |
| 998 | + handler.close(); |
1002 | 999 | } |
1003 | 1000 |
|
1004 | 1001 | if (Skript.debug() || subNode.debug()) |
|
0 commit comments