-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hijacking now works (in 1.4.7, at least)
- Loading branch information
1 parent
49ee5be
commit 6c3640d
Showing
9 changed files
with
246 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package nilloader; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
/** | ||
* Some state stuff split out of NilAgent to avoid duplicate class loading with hijacks | ||
*/ | ||
public class NilAgentPart { | ||
|
||
static int initializations = 0; | ||
|
||
public static URL getJarURL(URL codeSource) { | ||
if (codeSource == null) return null; | ||
if ("jar".equals(codeSource.getProtocol())) { | ||
String str = codeSource.toString().substring(4); | ||
int bang = str.indexOf('!'); | ||
if (bang != -1) str = str.substring(0, bang); | ||
try { | ||
return new URL(str); | ||
} catch (MalformedURLException e) { | ||
return null; | ||
} | ||
} else if ("union".equals(codeSource.getProtocol())) { | ||
// some ModLauncher nonsense | ||
String str = codeSource.toString().substring(6); | ||
int bullshit = str.indexOf("%23"); | ||
if (bullshit != -1) str = str.substring(0, bullshit); | ||
try { | ||
return new URL("file:"+str); | ||
} catch (MalformedURLException e) { | ||
return null; | ||
} | ||
} | ||
return codeSource; | ||
} | ||
|
||
public static int getInitializations() { | ||
return initializations; | ||
} | ||
|
||
} |
Oops, something went wrong.