diff --git a/src/main/java/com/reider745/world/WorldMethod.java b/src/main/java/com/reider745/world/WorldMethod.java index 404619550..1fc302dac 100644 --- a/src/main/java/com/reider745/world/WorldMethod.java +++ b/src/main/java/com/reider745/world/WorldMethod.java @@ -4,12 +4,22 @@ import com.reider745.InnerCoreServer; public class WorldMethod { + + private static Level getLevel(){ + return InnerCoreServer.server.getDefaultLevel(); + } + public static long getTime() { - return InnerCoreServer.server.getLevel(0).getTime() % Level.TIME_FULL; + final Level level = getLevel(); + if(level != null) + return level.getTime() % Level.TIME_FULL; + return 0; } public static void setTime(int time) { - InnerCoreServer.server.getLevel(0).setTime(time); + final Level level = getLevel(); + if(level != null) + level.setTime(time); } public static int getGameMode() { @@ -28,7 +38,7 @@ public static void setDifficulty(int difficulty) { } public static double getRainLevel() { - return 0; + } public static void setRainLevel(float v) { @@ -42,6 +52,9 @@ public static void setLightningLevel(float v) { } public static long getSeed() { - return InnerCoreServer.server.getLevelByName("world").getSeed(); + final Level level = getLevel(); + if(level != null) + return level.getSeed(); + return 0; } }