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

Commit

Permalink
Fix #32 and #24
Browse files Browse the repository at this point in the history
  • Loading branch information
Runemoro committed Aug 27, 2018
1 parent da620d1 commit 351de0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/dimdev/riftloader/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static void runClientInstaller() {
// Copy rift jar to libraries
try {
String source = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
if (source.startsWith("/")) {
if (source.startsWith("/") && osName.contains("win")) {
source = source.substring(1);
}
File riftJar = new File(minecraftFolder, "libraries/org/dimdev/rift/@VERSION@/rift-@[email protected]");
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/dimdev/riftloader/RiftLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ public <T> void loadListeners(Class<T> listenerInterface) {

for (Class<?> listenerClass : listenerClasses) {
if (listenerInterface.isAssignableFrom(listenerClass)) {
// Initialize the class first, in case it wants to add itself to the listenerInstanceMap
try {
Class.forName(listenerClass.getName(), true, listenerClass.getClassLoader());
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e);
}

// Get the instance of that class, or create a new one if it wasn't instantiated yet
T listenerInstance = listenerInterface.cast(listenerInstanceMap.get(listenerClass));
if (listenerInstance == null) {
Expand Down

0 comments on commit 351de0c

Please sign in to comment.