48 lines
1.1 KiB
Java
48 lines
1.1 KiB
Java
package eu.mhsl.minenet.minigames;
|
|
|
|
import eu.mhsl.minenet.minigames.util.ResourceUtils;
|
|
|
|
import java.io.IOException;
|
|
import java.net.URISyntaxException;
|
|
import java.nio.file.Path;
|
|
import java.util.logging.Logger;
|
|
|
|
/**
|
|
* Predefined resources which are extracted on Runtime
|
|
*/
|
|
public enum Resource {
|
|
CONFIG("config.yml", true),
|
|
HUB_MAP("maps/hub"),
|
|
LOBBY_MAP("maps/lobby"),
|
|
RESULT_DISPLAY("maps/resultdisplay"),
|
|
|
|
GAME_MAP("maps/game"),
|
|
LOCALES("lang");
|
|
|
|
private final Path path;
|
|
private final String name;
|
|
Resource(String name, boolean keepOutdated) {
|
|
this.name = name;
|
|
this.path = Path.of("resources/" + name);
|
|
|
|
try {
|
|
Logger.getLogger("ressource").info("extracting resource " + name + " ... ");
|
|
ResourceUtils.extractResource(name, keepOutdated);
|
|
} catch (URISyntaxException | IOException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
|
|
Resource(String name) {
|
|
this(name, false);
|
|
}
|
|
|
|
public Path getPath() {
|
|
return path;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
}
|