|
15 | 15 | import org.bukkit.event.block.BlockCanBuildEvent; |
16 | 16 | import org.jetbrains.annotations.NotNull; |
17 | 17 | import org.jetbrains.annotations.Nullable; |
| 18 | +import org.skriptlang.skript.bukkit.registration.BukkitSyntaxInfos; |
18 | 19 | import org.skriptlang.skript.lang.entry.EntryData; |
19 | 20 | import org.skriptlang.skript.lang.entry.EntryValidator; |
20 | 21 | import org.skriptlang.skript.lang.structure.StructureInfo; |
@@ -97,24 +98,24 @@ private static <T> Iterator<SyntaxElementInfo<? extends T>> sortedAnnotatedItera |
97 | 98 | /** |
98 | 99 | * Sorts events alphabetically. |
99 | 100 | */ |
100 | | - private static class EventComparator implements Comparator<SkriptEventInfo<?>> { |
| 101 | + private static class EventComparator implements Comparator<BukkitSyntaxInfos.Event<?>> { |
101 | 102 |
|
102 | 103 | public EventComparator() {} |
103 | 104 |
|
104 | 105 | @Override |
105 | | - public int compare(@Nullable SkriptEventInfo<?> o1, @Nullable SkriptEventInfo<?> o2) { |
| 106 | + public int compare(@Nullable BukkitSyntaxInfos.Event<?> o1, @Nullable BukkitSyntaxInfos.Event<?> o2) { |
106 | 107 | // Nullness check |
107 | 108 | if (o1 == null || o2 == null) { |
108 | 109 | assert false; |
109 | 110 | throw new NullPointerException(); |
110 | 111 | } |
111 | 112 |
|
112 | | - if (o1.getElementClass().getAnnotation(NoDoc.class) != null) |
| 113 | + if (o1.type().getAnnotation(NoDoc.class) != null) |
113 | 114 | return 1; |
114 | | - else if (o2.getElementClass().getAnnotation(NoDoc.class) != null) |
| 115 | + else if (o2.type().getAnnotation(NoDoc.class) != null) |
115 | 116 | return -1; |
116 | 117 |
|
117 | | - return o1.name.compareTo(o2.name); |
| 118 | + return o1.name().compareTo(o2.name()); |
118 | 119 | } |
119 | 120 |
|
120 | 121 | } |
@@ -311,11 +312,11 @@ else if (!filesInside.getName().matches("(?i)(.*)\\.(html?|js|css|json)")) { |
311 | 312 | } |
312 | 313 | } |
313 | 314 | if (genType.equals("events") || isDocsPage) { |
314 | | - List<SkriptEventInfo<?>> events = new ArrayList<>(Skript.getEvents()); |
| 315 | + List<BukkitSyntaxInfos.Event<?>> events = new ArrayList<>(Skript.instance().syntaxRegistry().syntaxes(BukkitSyntaxInfos.Event.KEY)); |
315 | 316 | events.sort(eventComparator); |
316 | | - for (SkriptEventInfo<?> info : events) { |
| 317 | + for (BukkitSyntaxInfos.Event<?> info : events) { |
317 | 318 | assert info != null; |
318 | | - if (info.getElementClass().getAnnotation(NoDoc.class) != null) |
| 319 | + if (info.type().getAnnotation(NoDoc.class) != null) |
319 | 320 | continue; |
320 | 321 | generated.append(generateEvent(descTemp, info, generated.toString())); |
321 | 322 | } |
@@ -584,7 +585,8 @@ private String generateAnnotated(String descTemp, SyntaxElementInfo<?> info, @Nu |
584 | 585 | return desc; |
585 | 586 | } |
586 | 587 |
|
587 | | - private String generateEvent(String descTemp, SkriptEventInfo<?> info, @Nullable String page) { |
| 588 | + private String generateEvent(String descTemp, BukkitSyntaxInfos.Event<?> modernInfo, @Nullable String page) { |
| 589 | + SkriptEventInfo<?> info = (SkriptEventInfo<?>) SyntaxElementInfo.fromModern(modernInfo); |
588 | 590 | Class<?> c = info.getElementClass(); |
589 | 591 | String desc; |
590 | 592 |
|
@@ -631,7 +633,7 @@ private String generateEvent(String descTemp, SkriptEventInfo<?> info, @Nullable |
631 | 633 | desc = desc.replace("${element.cancellable}", cancellable ? "Yes" : ""); // if not cancellable the section is hidden |
632 | 634 |
|
633 | 635 | // Documentation ID |
634 | | - desc = desc.replace("${element.id}", DocumentationIdProvider.getId(info)); |
| 636 | + desc = desc.replace("${element.id}", DocumentationIdProvider.getId(modernInfo)); |
635 | 637 |
|
636 | 638 | // Events |
637 | 639 | Events events = c.getAnnotation(Events.class); |
|
0 commit comments