Skip to content

Commit

Permalink
hope to fix null world issue
Browse files Browse the repository at this point in the history
  • Loading branch information
database-test committed Oct 26, 2024
1 parent dcbdda3 commit cf20c36
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 92 deletions.
20 changes: 14 additions & 6 deletions src/main/java/com/nexia/core/utilities/time/ServerTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.nexia.minigames.games.bedwars.areas.BwAreas;
import com.nexia.minigames.games.bedwars.areas.BwDimension;
import com.nexia.minigames.games.bedwars.shop.BwLoadShop;
import com.nexia.minigames.games.bridge.BridgeGame;
import com.nexia.minigames.games.duels.DuelGameHandler;
import com.nexia.minigames.games.duels.DuelsGame;
import com.nexia.minigames.games.duels.team.TeamDuelsGame;
Expand Down Expand Up @@ -73,6 +74,7 @@ public static void firstTick(MinecraftServer server) {
BwDimension.register();
BwGame.firstTick();
FootballGame.firstTick();
BridgeGame.firstTick();
WorldUtil.deleteTempWorlds();

SkywarsGame.firstTick();
Expand All @@ -82,7 +84,7 @@ public static void firstTick(MinecraftServer server) {

public static void stopServer() {
try {
for(Player player : ServerTime.nexusServer.getPlayers()){
for (Player player : ServerTime.nexusServer.getPlayers()) {
player.disconnect(ChatFormat.nexiaMessage.append(Component.text("The server is restarting!", ChatFormat.Minecraft.white)));
}

Expand All @@ -102,6 +104,7 @@ public static void everyTick() {
BwGame.tick();
SkyFfaBlocks.tick();
FootballGame.tick();
BridgeGame.tick();
OitcGame.tick();

if (totalTickCount % 5 == 0) {
Expand All @@ -115,8 +118,10 @@ public static void everyTick() {
// Most second methods are also handled here to avoid too many methods from being executed at the same time
switch (totalTickCount % 20) {
case 0 -> everySecond();
case 2 -> {}
case 4 -> {}
case 2 -> {
}
case 4 -> {
}
case 6 -> BwGame.bedWarsSecond();
}
}
Expand All @@ -125,23 +130,26 @@ static void everySecond() {
totalSecondCount++;
OitcGame.second();
FootballGame.second();
BridgeGame.second();
SkywarsGame.second();
try {
for (DuelsGame game : DuelGameHandler.duelsGames) {
if (game == null) return;
game.duelSecond();
}
} catch (Exception ignored) { }
} catch (Exception ignored) {
}

try {
for (TeamDuelsGame game : DuelGameHandler.teamDuelsGames) {
if (game == null) return;
game.duelSecond();
}
} catch (Exception ignored) { }
} catch (Exception ignored) {
}


if(totalSecondCount % 3600 == 0 && !UhcFfaAreas.shouldResetMap) {
if (totalSecondCount % 3600 == 0 && !UhcFfaAreas.shouldResetMap) {
UhcFfaAreas.shouldResetMap = true;
}
}
Expand Down
Loading

0 comments on commit cf20c36

Please sign in to comment.