Don't rely on getPackage to determine generated class name (#2937)

This commit is contained in:
Daniil 2021-03-15 15:12:02 +03:00 committed by GitHub
parent e3138eb94c
commit a17b441165
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<AbstractEvent> builder = new ByteBuddy(ClassFileVersion.JAVA_V8)
// create a subclass of AbstractEvent