Move backgrounds outside of jar file
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user