Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Commit 351de0c

Browse files
committed
Fix #32 and #24
1 parent da620d1 commit 351de0c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/org/dimdev/riftloader/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static void runClientInstaller() {
138138
// Copy rift jar to libraries
139139
try {
140140
String source = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
141-
if (source.startsWith("/")) {
141+
if (source.startsWith("/") && osName.contains("win")) {
142142
source = source.substring(1);
143143
}
144144
File riftJar = new File(minecraftFolder, "libraries/org/dimdev/rift/@VERSION@/rift-@[email protected]");

src/main/java/org/dimdev/riftloader/RiftLoader.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ public <T> void loadListeners(Class<T> listenerInterface) {
243243

244244
for (Class<?> listenerClass : listenerClasses) {
245245
if (listenerInterface.isAssignableFrom(listenerClass)) {
246+
// Initialize the class first, in case it wants to add itself to the listenerInstanceMap
247+
try {
248+
Class.forName(listenerClass.getName(), true, listenerClass.getClassLoader());
249+
} catch (ClassNotFoundException e) {
250+
throw new IllegalStateException(e);
251+
}
252+
246253
// Get the instance of that class, or create a new one if it wasn't instantiated yet
247254
T listenerInstance = listenerInterface.cast(listenerInstanceMap.get(listenerClass));
248255
if (listenerInstance == null) {

0 commit comments

Comments
 (0)