From a17b441165627d1051259e3be5c0714a491d35f4 Mon Sep 17 00:00:00 2001 From: Daniil <75280223+KR33PY@users.noreply.github.com> Date: Mon, 15 Mar 2021 15:12:02 +0300 Subject: [PATCH] Don't rely on getPackage to determine generated class name (#2937) --- .../lucko/luckperms/common/event/gen/GeneratedEventClass.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/event/gen/GeneratedEventClass.java b/common/src/main/java/me/lucko/luckperms/common/event/gen/GeneratedEventClass.java index a379841f3..54fe9fa00 100644 --- a/common/src/main/java/me/lucko/luckperms/common/event/gen/GeneratedEventClass.java +++ b/common/src/main/java/me/lucko/luckperms/common/event/gen/GeneratedEventClass.java @@ -106,7 +106,8 @@ public class GeneratedEventClass { // determine a generated class name of the event String eventClassSuffix = eventClass.getName().substring(LuckPermsEvent.class.getPackage().getName().length()); - String generatedClassName = GeneratedEventClass.class.getPackage().getName() + eventClassSuffix; + String packageWithName = GeneratedEventClass.class.getName(); + String generatedClassName = packageWithName.substring(0, packageWithName.lastIndexOf('.')) + eventClassSuffix; DynamicType.Builder builder = new ByteBuddy(ClassFileVersion.JAVA_V8) // create a subclass of AbstractEvent