Skip to content

Commit

Permalink
DocumentationIdProvider - fix getId methods returning "2" (#7368)
Browse files Browse the repository at this point in the history
* DocumentationIdProvider - fix collision checker always returning at least 1

* DocumentationIdProvider - fix typo

* DocumentationIdProvider - change number 2

* DocumentationIdProvider - fix event ids
  • Loading branch information
ShaneBeee authored Jan 5, 2025
1 parent 2dba82b commit 205ea15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/ch/njol/skript/doc/DocumentationIdProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import ch.njol.skript.registrations.Classes;
import org.skriptlang.skript.lang.structure.Structure;

import java.util.Arrays;
import java.util.Iterator;
import java.util.Objects;
import java.util.function.Predicate;
Expand Down Expand Up @@ -78,7 +79,7 @@ public static <T> String getId(SyntaxElementInfo<? extends T> syntaxInfo) {
}
int collisionCount = calculateCollisionCount(syntaxElementIterator,
elementInfo -> elementInfo.getElementClass() == syntaxClass,
elementInfo -> elementInfo == syntaxInfo);
elementInfo -> Arrays.equals(elementInfo.getPatterns(), syntaxInfo.getPatterns()));
DocumentationId documentationIdAnnotation = syntaxClass.getAnnotation(DocumentationId.class);
if (documentationIdAnnotation == null) {
return addCollisionSuffix(syntaxClass.getSimpleName(), collisionCount);
Expand Down Expand Up @@ -138,7 +139,7 @@ public static String getId(SkriptEventInfo<?> eventInfo) {
String eventId = getEventId(eventInfo);
int collisionCount = calculateCollisionCount(Skript.getEvents().iterator(),
otherEventInfo -> eventId.equals(getEventId(otherEventInfo)),
otherEventInfo -> otherEventInfo == eventInfo);
otherEventInfo -> Arrays.equals(otherEventInfo.getPatterns(), eventInfo.getPatterns()));
return addCollisionSuffix(eventId, collisionCount);
}

Expand Down

0 comments on commit 205ea15

Please sign in to comment.