Move backgrounds outside of jar file
This commit is contained in:
parent
3b2305949c
commit
1babdb6808
20
.idea/jarRepositories.xml
Normal file
20
.idea/jarRepositories.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
@ -6,9 +6,9 @@ import com.google.gson.JsonElement;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -50,11 +50,10 @@ public class Location {
|
||||
}
|
||||
|
||||
public void loadBackground() {
|
||||
URL backgroundURL = this.getClass().getResource("/backgrounds/" + id + ".png");
|
||||
if (backgroundURL == null) backgroundURL = this.getClass().getResource("/backgrounds/default.png");
|
||||
File backgroundFile = new File("./backgrounds/" + id + ".png");
|
||||
if (!backgroundFile.exists()) backgroundFile = new File("./backgrounds/default.png");
|
||||
try {
|
||||
assert backgroundURL != null;
|
||||
background = ImageIO.read(backgroundURL);
|
||||
background = ImageIO.read(backgroundFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user