Skip to content

Commit

Permalink
Merge Camper_Samu PR manually
Browse files Browse the repository at this point in the history
- Put some variables into regions
- Add the mod icon
- Use logger instead of printing errors
  • Loading branch information
QPCrummer committed Dec 20, 2023
1 parent 7c8dd5b commit 3ed1774
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
27 changes: 15 additions & 12 deletions src/main/java/com/github/QPCrummer/slumber/Slumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,26 @@
import java.util.concurrent.TimeUnit;

public class Slumber implements ModInitializer {
final static String CONFIG_VERSION_KEY = "config-version";
final static String TOGGLE_KEY = "toggle";
final static String FREEZE_DELAY_SECONDS_KEY = "freeze-delay-seconds";
final static String SAFE_STARTING_KEY = "safe-starting";
final static String DEBUG_KEY = "debug-messages";
final static String
CONFIG_VERSION_KEY = "config-version",
TOGGLE_KEY = "toggle",
FREEZE_DELAY_SECONDS_KEY = "freeze-delay-seconds",
SAFE_STARTING_KEY = "safe-starting",
DEBUG_KEY = "debug-messages";

private static final Path config = FabricLoader.getInstance().getConfigDir().resolve("slumber.properties");

public static final Properties properties = new Properties();
public static final String cfgver = "1.3";
public static int delay;
public static boolean enabled;
public static boolean safe_starting;
private static boolean debug;
public static boolean
enabled,
safe_starting,
debug;

private static long beginningTime;
private static long endingTime;
private static long
beginningTime,
endingTime;

private static final ScheduledExecutorService wait = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setDaemon(true).build());

Expand All @@ -56,13 +59,13 @@ public void onInitialize() {
try {
storecfg();
} catch (IOException e) {
e.printStackTrace();
logger.error("Config storing failed", e);
}
} else {
try {
loadcfg();
} catch (IOException e) {
e.printStackTrace();
logger.error("Config creation failed", e);
}
if (!(Objects.equals(properties.getProperty(CONFIG_VERSION_KEY), cfgver))) {
properties.setProperty(CONFIG_VERSION_KEY, cfgver);
Expand Down
Binary file added src/main/resources/assets/slumber/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"description": "Freezes the world till a player joins",
"authors": [
"QPCrummer",
"Ampflower"
"Ampflower",
"Camper_Samu"
],
"contact": {},
"license": "MIT",
Expand Down

0 comments on commit 3ed1774

Please sign in to comment.