From 205ea15cb6010b7cfa09326638138a5efbcdd049 Mon Sep 17 00:00:00 2001 From: Shane Bee Date: Sun, 5 Jan 2025 01:25:50 -0800 Subject: [PATCH] DocumentationIdProvider - fix getId methods returning "2" (#7368) * DocumentationIdProvider - fix collision checker always returning at least 1 * DocumentationIdProvider - fix typo * DocumentationIdProvider - change number 2 * DocumentationIdProvider - fix event ids --- .../java/ch/njol/skript/doc/DocumentationIdProvider.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/njol/skript/doc/DocumentationIdProvider.java b/src/main/java/ch/njol/skript/doc/DocumentationIdProvider.java index 4725e4bfaf6..35a01c143b3 100644 --- a/src/main/java/ch/njol/skript/doc/DocumentationIdProvider.java +++ b/src/main/java/ch/njol/skript/doc/DocumentationIdProvider.java @@ -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; @@ -78,7 +79,7 @@ public static String getId(SyntaxElementInfo 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); @@ -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); }