Add in proper handling of equals and hashcode for modjar urls. Fixes very slow loading on windows.
Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
parent
7205c30ece
commit
6982c5dd56
1 changed files with 13 additions and 0 deletions
|
@ -30,6 +30,7 @@ import java.net.URLConnection;
|
|||
import java.net.URLStreamHandler;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
|
@ -44,6 +45,18 @@ public class ModJarURLHandler extends URLStreamHandler
|
|||
return new ModJarURLConnection(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int hashCode(final URL u) {
|
||||
return Objects.hash(u.getHost(), u.getFile());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean equals(final URL u1, final URL u2) {
|
||||
return Objects.equals(u1.getProtocol(), u2.getProtocol())
|
||||
&& Objects.equals(u1.getHost(), u2.getHost())
|
||||
&& Objects.equals(u1.getFile(), u2.getFile());
|
||||
}
|
||||
|
||||
static class ModJarURLConnection extends URLConnection {
|
||||
private Path resource;
|
||||
private String modpath;
|
||||
|
|
Loading…
Reference in a new issue