Initial commit
This commit is contained in:
41
src/main/java/eu/mhsl/minenet/minigames/Resource.java
Normal file
41
src/main/java/eu/mhsl/minenet/minigames/Resource.java
Normal file
@@ -0,0 +1,41 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* Predefined resources which are extracted on Runtime
|
||||
*/
|
||||
public enum Resource {
|
||||
HUB_MAP("maps/hub"),
|
||||
LOBBY_MAP("maps/lobby"),
|
||||
RBB("rbb"),
|
||||
LOCALES("lang"),
|
||||
SCHEMATICS("schematics");
|
||||
|
||||
private final Path path;
|
||||
private final String name;
|
||||
Resource(String name) {
|
||||
this.name = name;
|
||||
this.path = Path.of("resources/" + name);
|
||||
|
||||
try {
|
||||
System.out.print("extracting resource " + name + " ... ");
|
||||
ResourceUtils.extractResource(name);
|
||||
System.out.println("ok");
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Path getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user