diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..92cd5af2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "run/world/datapacks"] + path = run/world/datapacks + url = https://github.com/nexia-cts/Nexia-Datapack.git + branch = main diff --git a/README.md b/README.md index e4816ad3..1ee16d1c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@
# Nexia + using **Nexus API** The mod for the Nexia CTS server. @@ -16,7 +17,18 @@ The mod for the Nexia CTS server. - Gradle 8.7 ### Build + - Clone the repository - `git clone https://github.com/nexia-cts/Nexia-Mod` - `git checkout 'main/dev'` - Run `./gradlew build` + +### Run the server locally + +- Extract the zip file [Run_server_locally_(READ_README.md_FIRST).zip](Run_server_locally_(READ_README.md_FIRST).zip) so that the folder `run/` is in the main directory + - e.g. `/Nexia-Mod/run/...` + - **DO NOT DELETE THE ZIP FILE AFTER EXTRACTING!!!!** +- Run `git submodule update --init --recursive` +- Run the `Minecraft Server` Configuration in Intellij IDEA +- Accept the EULA ([/run/eula.txt](/run/eula.txt)) +- Enjoy and don't forget to OP yourself! diff --git a/Run_server_locally_(READ_README.md_FIRST).zip b/Run_server_locally_(READ_README.md_FIRST).zip new file mode 100644 index 00000000..3f4d39ca Binary files /dev/null and b/Run_server_locally_(READ_README.md_FIRST).zip differ diff --git a/build.gradle b/build.gradle index 6acadacd..6a7c364d 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,12 @@ dependencies { // Important! modImplementation("com.nexia.nexus:nexus-api:${project.nexus_version}-full") modImplementation("com.nexia.nexus:nexus-builder:${project.nexus_version}-${project.minecraft_version}-full") - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + // Using Fabric API for CTS apparently just doesn't want to make it build but we have to use it so the server doesn't crash when right clicking something + modCompileOnlyApi("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}") + //modRuntimeOnly("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}.combat") + // ↑ included in run/mods/ instead + include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${project.mixin_extras_version}"))) // MongoDB @@ -78,7 +83,7 @@ dependencies { modApi("me.lucko:fabric-permissions-api:${project.fabric_permissions_api_version}") include(implementation("net.kyori:adventure-text-minimessage:${project.adventure_version}")) include(implementation("net.kyori:adventure-text-serializer-gson:${project.adventure_version}")) - include(compileOnly("de.themoep:minedown-adventure:${project.minedown_adventure_version}")) + include(implementation("de.themoep:minedown-adventure:${project.minedown_adventure_version}")) compileOnly("net.luckperms:api:${project.luckperms_api_version}") // discord shit @@ -89,7 +94,6 @@ dependencies { // useless libraries include(implementation("com.google.code.gson:gson:${project.gson_version}")) include(implementation("com.googlecode.json-simple:json-simple:${project.json_simple_version}")) - } // Custom Manifest and Intermediary mappings declaration diff --git a/gradle.properties b/gradle.properties index f55e0e34..a64e5d8f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.parallel=true # check these on https://fabricmc.net/use minecraft_version=1.16_combat-6 yarn_mappings=1.16_combat-6+build.2 -loader_version=0.14.21 +loader_version=0.14.25 # Mod Properties mod_version = 2.0.0 diff --git a/run/world/datapacks b/run/world/datapacks new file mode 160000 index 00000000..9b9901c9 --- /dev/null +++ b/run/world/datapacks @@ -0,0 +1 @@ +Subproject commit 9b9901c96c02401fcc42508a7d9c21265af56fea diff --git a/src/main/java/com/nexia/base/player/PlayerDataManager.java b/src/main/java/com/nexia/base/player/PlayerDataManager.java index 3b72aa2c..db0eefab 100644 --- a/src/main/java/com/nexia/base/player/PlayerDataManager.java +++ b/src/main/java/com/nexia/base/player/PlayerDataManager.java @@ -1,7 +1,5 @@ package com.nexia.base.player; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import com.mongodb.client.model.Filters; import com.mongodb.client.result.UpdateResult; import com.nexia.core.NexiaCore; @@ -19,9 +17,9 @@ import com.nexia.minigames.games.football.util.player.FootballSavedPlayerData; import com.nexia.minigames.games.oitc.util.player.OITCPlayerData; import com.nexia.minigames.games.skywars.util.player.SkywarsPlayerData; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.resources.ResourceLocation; import org.bson.Document; - import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; @@ -114,6 +112,7 @@ public void removePlayerData(UUID uuid) { } private void savePlayerData(UUID uuid) { + if(FabricLoader.getInstance().isDevelopmentEnvironment()) return; Document document = NexiaCore.mongoManager.toDocument(get(uuid).savedData); document.append("uuid", uuid.toString()); document.remove("data"); @@ -126,6 +125,14 @@ private void savePlayerData(UUID uuid) { } private T loadPlayerData(UUID uuid, Class toLoad) throws InstantiationException, IllegalAccessException { + if(FabricLoader.getInstance().isDevelopmentEnvironment()) { + try { + return toLoad.getDeclaredConstructor().newInstance(); + } catch (InvocationTargetException | NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + T savedPlayerData = NexiaCore.mongoManager.getObject(collectionName, Filters.eq("uuid", uuid.toString()), toLoad); if (savedPlayerData != null) { return savedPlayerData; diff --git a/src/main/java/com/nexia/core/NexiaCore.java b/src/main/java/com/nexia/core/NexiaCore.java index ca97f517..b8534f5e 100644 --- a/src/main/java/com/nexia/core/NexiaCore.java +++ b/src/main/java/com/nexia/core/NexiaCore.java @@ -56,6 +56,11 @@ public void onInitialize() { AutoConfig.register(ModConfig.class, GsonConfigSerializer::new); config = AutoConfig.getConfigHolder(ModConfig.class).getConfig(); + if(FabricLoader.getInstance().isDevelopmentEnvironment()) { + config.serverType = "dev"; + config.debugMode = true; + } + logger.info("Loading mod..."); PlayerDataManager.init(); logger.info("Registering commands..."); diff --git a/src/main/java/com/nexia/core/commands/staff/dev/DeleteInventoryCommand.java b/src/main/java/com/nexia/core/commands/staff/dev/DeleteInventoryCommand.java index 78c022b1..57f0885a 100644 --- a/src/main/java/com/nexia/core/commands/staff/dev/DeleteInventoryCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/dev/DeleteInventoryCommand.java @@ -6,6 +6,7 @@ import com.nexia.core.utilities.chat.LegacyChatFormat; import com.nexia.core.utilities.item.InventoryUtil; import me.lucko.fabric.api.permissions.v0.Permissions; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; @@ -20,7 +21,7 @@ public static void register(CommandDispatcher dispatcher, bo dispatcher.register((Commands.literal("deleteinventory") .requires(commandSourceStack -> { try { - return Permissions.check(commandSourceStack, "nexia.inventory.delete", 4); + return Permissions.check(commandSourceStack, "nexia.inventory.delete", 4) || FabricLoader.getInstance().isDevelopmentEnvironment(); } catch (Exception ignored) { return false; } diff --git a/src/main/java/com/nexia/core/commands/staff/dev/DevExperimentalCommandsCommand.java b/src/main/java/com/nexia/core/commands/staff/dev/DevExperimentalCommandsCommand.java index b501e88c..7761fcfc 100644 --- a/src/main/java/com/nexia/core/commands/staff/dev/DevExperimentalCommandsCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/dev/DevExperimentalCommandsCommand.java @@ -32,7 +32,7 @@ public static void register(CommandDispatcher dispatcher, bo dispatcher.register((Commands.literal("devexperimentalcmds") .requires(commandSourceStack -> { try { - return Permissions.check(commandSourceStack, "nexia.dev.experimentalcmds"); + return Permissions.check(commandSourceStack, "nexia.dev.experimentalcmds") || FabricLoader.getInstance().isDevelopmentEnvironment(); } catch (Exception ignored) { return false; } diff --git a/src/main/java/com/nexia/core/commands/staff/dev/ForceGameEndCommand.java b/src/main/java/com/nexia/core/commands/staff/dev/ForceGameEndCommand.java index 3c0698f2..248a660f 100644 --- a/src/main/java/com/nexia/core/commands/staff/dev/ForceGameEndCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/dev/ForceGameEndCommand.java @@ -8,6 +8,7 @@ import com.nexia.minigames.games.oitc.OitcGame; import com.nexia.minigames.games.skywars.SkywarsGame; import me.lucko.fabric.api.permissions.v0.Permissions; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; @@ -18,7 +19,7 @@ public static void register(CommandDispatcher dispatcher, bo dispatcher.register((Commands.literal("forcegameend") .requires(commandSourceStack -> { try { - return Permissions.check(commandSourceStack, "nexia.dev.forcegameend"); + return Permissions.check(commandSourceStack, "nexia.dev.forcegameend") || FabricLoader.getInstance().isDevelopmentEnvironment(); } catch (Exception ignored) { return false; } diff --git a/src/main/java/com/nexia/core/commands/staff/dev/LoadInventoryCommand.java b/src/main/java/com/nexia/core/commands/staff/dev/LoadInventoryCommand.java index f760204d..fd1a4d4c 100644 --- a/src/main/java/com/nexia/core/commands/staff/dev/LoadInventoryCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/dev/LoadInventoryCommand.java @@ -8,6 +8,7 @@ import com.nexia.core.utilities.item.InventoryUtil; import com.nexia.base.player.NexiaPlayer; import me.lucko.fabric.api.permissions.v0.Permissions; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.Util; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; @@ -25,7 +26,7 @@ public static void register(CommandDispatcher dispatcher, bo dispatcher.register((Commands.literal("loadinventory") .requires(commandSourceStack -> { try { - return Permissions.check(commandSourceStack, "nexia.inventory.load", 4); + return Permissions.check(commandSourceStack, "nexia.inventory.load", 4) || FabricLoader.getInstance().isDevelopmentEnvironment(); } catch (Exception ignored) { return false; } diff --git a/src/main/java/com/nexia/core/commands/staff/dev/SaveInventoryCommand.java b/src/main/java/com/nexia/core/commands/staff/dev/SaveInventoryCommand.java index e6d15a9c..7b0b99b4 100644 --- a/src/main/java/com/nexia/core/commands/staff/dev/SaveInventoryCommand.java +++ b/src/main/java/com/nexia/core/commands/staff/dev/SaveInventoryCommand.java @@ -9,6 +9,7 @@ import com.nexia.core.utilities.chat.LegacyChatFormat; import com.nexia.core.utilities.item.InventoryUtil; import me.lucko.fabric.api.permissions.v0.Permissions; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; @@ -23,7 +24,7 @@ public static void register(CommandDispatcher dispatcher, bo dispatcher.register((Commands.literal("saveinventory") .requires(commandSourceStack -> { try { - return Permissions.check(commandSourceStack, "nexia.inventory.save", 4); + return Permissions.check(commandSourceStack, "nexia.inventory.save", 4) || FabricLoader.getInstance().isDevelopmentEnvironment(); } catch (Exception ignored) { return false; } diff --git a/src/main/java/com/nexia/core/mixin/block/CommandBlockMixin.java b/src/main/java/com/nexia/core/mixin/block/CommandBlockMixin.java index db72e289..57c22094 100644 --- a/src/main/java/com/nexia/core/mixin/block/CommandBlockMixin.java +++ b/src/main/java/com/nexia/core/mixin/block/CommandBlockMixin.java @@ -2,6 +2,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import me.lucko.fabric.api.permissions.v0.Permissions; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -20,6 +21,6 @@ public class CommandBlockMixin { ) ) public boolean canUseCommandBlock(boolean original, BlockState blockState, Level level, BlockPos blockPos, Player player) { - return Permissions.check(player, "nexia.dev.commandblock"); + return Permissions.check(player, "nexia.dev.commandblock") || FabricLoader.getInstance().isDevelopmentEnvironment(); } } \ No newline at end of file diff --git a/src/main/java/com/nexia/core/mixin/entity/ArmorStandMixin.java b/src/main/java/com/nexia/core/mixin/entity/ArmorStandMixin.java index 2569c37e..2c35d555 100644 --- a/src/main/java/com/nexia/core/mixin/entity/ArmorStandMixin.java +++ b/src/main/java/com/nexia/core/mixin/entity/ArmorStandMixin.java @@ -24,7 +24,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - import java.util.List; import java.util.function.Predicate; @@ -81,7 +80,7 @@ public boolean isPushable() { * @reason Make armor stands pushable */ @Overwrite - protected void doPush(Entity entity) { + public void doPush(Entity entity) { if(!FootballGame.world.equals(this.level)) return; entity.push(this); } @@ -92,7 +91,7 @@ protected void doPush(Entity entity) { * @reason Make armor stands pushable */ @Overwrite - protected void pushEntities() { + public void pushEntities() { if(!FootballGame.world.equals(this.level)) { List list = this.level.getEntities(this, this.getBoundingBox(), RIDABLE_MINECARTS); diff --git a/src/main/java/com/nexia/core/mixin/misc/MinecraftServerMixin.java b/src/main/java/com/nexia/core/mixin/misc/MinecraftServerMixin.java index 2f089699..952a912a 100644 --- a/src/main/java/com/nexia/core/mixin/misc/MinecraftServerMixin.java +++ b/src/main/java/com/nexia/core/mixin/misc/MinecraftServerMixin.java @@ -1,6 +1,7 @@ package com.nexia.core.mixin.misc; import com.mojang.authlib.GameProfile; +import com.nexia.core.NexiaCore; import com.nexia.core.utilities.time.ServerTime; import com.nexia.core.utilities.time.ServerType; import net.minecraft.Util; @@ -8,10 +9,8 @@ import net.minecraft.network.protocol.status.ServerStatus; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.players.PlayerList; import net.minecraft.world.entity.player.Player; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -22,8 +21,6 @@ @Mixin(MinecraftServer.class) public abstract class MinecraftServerMixin { - @Shadow public abstract PlayerList getPlayerList(); - @Unique boolean firstTickPassed = false; @@ -53,7 +50,7 @@ private void noSpawnProtection(ServerLevel serverLevel, BlockPos blockPos, Playe @ModifyArg(method = "tickServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/status/ServerStatus$Players;setSample([Lcom/mojang/authlib/GameProfile;)V")) private GameProfile[] hidePlayers(GameProfile[] gameProfiles) { - if(ServerType.returnServer().equals(ServerType.DEV)) { + if(ServerType.returnServer().equals(ServerType.DEV) && !NexiaCore.config.debugMode) { return new GameProfile[]{new GameProfile(Util.NIL_UUID, "§e⟡ you tried ⟡"), new GameProfile(Util.NIL_UUID, "§eヽ(・∀・)ノ"), new GameProfile(Util.NIL_UUID, " "), @@ -68,7 +65,7 @@ private GameProfile[] hidePlayers(GameProfile[] gameProfiles) { @ModifyArg(method = "tickServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/status/ServerStatus;setPlayers(Lnet/minecraft/network/protocol/status/ServerStatus$Players;)V")) private ServerStatus.Players hidePlayerCount(ServerStatus.Players players) { - if(ServerType.returnServer().equals(ServerType.DEV)) { + if(ServerType.returnServer().equals(ServerType.DEV) && !NexiaCore.config.debugMode) { // can't set current player count for some reason (69) return new ServerStatus.Players(420, 69); } diff --git a/src/main/java/com/nexia/core/mixin/player/ServerGamePacketListenerMixin.java b/src/main/java/com/nexia/core/mixin/player/ServerGamePacketListenerMixin.java index 889c8e87..7f95f8ac 100644 --- a/src/main/java/com/nexia/core/mixin/player/ServerGamePacketListenerMixin.java +++ b/src/main/java/com/nexia/core/mixin/player/ServerGamePacketListenerMixin.java @@ -23,6 +23,7 @@ import com.nexia.minigames.games.oitc.OitcGame; import com.nexia.minigames.games.skywars.SkywarsGame; import me.lucko.fabric.api.permissions.v0.Permissions; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.*; @@ -78,7 +79,7 @@ private void onCustomPayload(ServerboundCustomPayloadPacket serverboundCustomPay ) ) public boolean canUseCommandBlock(boolean original) { - return Permissions.check(this.player, "nexia.dev.commandblock"); + return Permissions.check(this.player, "nexia.dev.commandblock") || FabricLoader.getInstance().isDevelopmentEnvironment(); } @Inject(at = @At("HEAD"), method = "onDisconnect") diff --git a/src/main/java/com/nexia/core/utilities/database/MongoManager.java b/src/main/java/com/nexia/core/utilities/database/MongoManager.java index 9bed9896..2008ff6b 100644 --- a/src/main/java/com/nexia/core/utilities/database/MongoManager.java +++ b/src/main/java/com/nexia/core/utilities/database/MongoManager.java @@ -2,7 +2,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.internal.bind.TypeAdapters; import com.mongodb.ConnectionString; import com.mongodb.MongoClientSettings; import com.mongodb.MongoCredential; @@ -10,15 +9,13 @@ import com.mongodb.client.MongoClients; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase; +import net.fabricmc.loader.api.FabricLoader; import org.bson.Document; import org.bson.conversions.Bson; - -import java.util.UUID; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; - import static com.nexia.core.NexiaCore.config; @SuppressWarnings("unused") @@ -36,6 +33,7 @@ public MongoManager() { } public void openConnection() { + if(FabricLoader.getInstance().isDevelopmentEnvironment()) return; final MongoCredential mongoCredential = MongoCredential.createCredential( config.username, config.database, diff --git a/src/main/java/com/nexia/core/utilities/pos/ProtectionMap.java b/src/main/java/com/nexia/core/utilities/pos/ProtectionMap.java index 80f8a943..411b81d5 100644 --- a/src/main/java/com/nexia/core/utilities/pos/ProtectionMap.java +++ b/src/main/java/com/nexia/core/utilities/pos/ProtectionMap.java @@ -93,6 +93,7 @@ public static ProtectionMap importMap(String filePath, ProtectionBlock[] listedB map = gson.fromJson(possibleJson, byte[][][].class); } catch (Exception e) { NexiaCore.logger.error(NexiaCore.MOD_NAME + ": Failed to import protection map from {}", filePath); + NexiaCore.logger.error("Use '/protectionmap' to recreate them (go to the correct dimension first)!"); return null; } return new ProtectionMap(map, listedBlocks, notListedBlock, outsideMessage); diff --git a/src/main/java/com/nexia/discord/NexiaDiscord.java b/src/main/java/com/nexia/discord/NexiaDiscord.java index 16efcdba..84f84406 100644 --- a/src/main/java/com/nexia/discord/NexiaDiscord.java +++ b/src/main/java/com/nexia/discord/NexiaDiscord.java @@ -9,6 +9,7 @@ import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.requests.GatewayIntent; import net.fabricmc.api.ModInitializer; +import net.fabricmc.loader.api.FabricLoader; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; @@ -22,6 +23,7 @@ public class NexiaDiscord implements ModInitializer { public void onInitialize() { AutoConfig.register(ModConfig.class, GsonConfigSerializer::new); config = AutoConfig.getConfigHolder(ModConfig.class).getConfig(); + if(FabricLoader.getInstance().isDevelopmentEnvironment()) return; Logger logger = NexiaCore.logger; diff --git a/src/main/java/com/nexia/ffa/classic/utilities/FfaClassicUtil.java b/src/main/java/com/nexia/ffa/classic/utilities/FfaClassicUtil.java index 2966dc1a..54d8d4bc 100644 --- a/src/main/java/com/nexia/ffa/classic/utilities/FfaClassicUtil.java +++ b/src/main/java/com/nexia/ffa/classic/utilities/FfaClassicUtil.java @@ -9,15 +9,13 @@ import com.nexia.ffa.base.BaseFfaUtil; import com.nexia.nexus.api.world.entity.player.Player; import com.nexia.nexus.api.world.util.Location; +import net.fabricmc.loader.api.FabricLoader; import net.kyori.adventure.text.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.timers.FunctionCallback; import net.minecraft.world.level.timers.TimerQueue; -import java.util.List; - public class FfaClassicUtil extends BaseFfaUtil { public static final FfaClassicUtil INSTANCE = new FfaClassicUtil(); @@ -42,6 +40,8 @@ public PlayerDataManager getDataManager() { @Override public boolean checkBot() { + if(FabricLoader.getInstance().isDevelopmentEnvironment()) return false; + Player bot = ServerTime.nexusServer.getPlayer("femboy.ai"); if (bot != null && getNexusFfaWorld().getPlayers().size() == 1) { diff --git a/src/main/java/com/nexia/minigames/games/bedwars/areas/BwAreas.java b/src/main/java/com/nexia/minigames/games/bedwars/areas/BwAreas.java index 1a935343..74705ba6 100644 --- a/src/main/java/com/nexia/minigames/games/bedwars/areas/BwAreas.java +++ b/src/main/java/com/nexia/minigames/games/bedwars/areas/BwAreas.java @@ -166,6 +166,7 @@ public static void spawnQueueBuild() { } public static void clearQueueBuild() { + if(bedWarsWorld == null) return; for (BlockPos pos : BlockPos.betweenClosed( queueC1.x, queueC1.y, queueC1.z, queueC2.x, queueC2.y, queueC2.z)) { diff --git a/src/main/java/com/nexia/minigames/games/skywars/SkywarsGame.java b/src/main/java/com/nexia/minigames/games/skywars/SkywarsGame.java index 190d6be7..1e1b841f 100644 --- a/src/main/java/com/nexia/minigames/games/skywars/SkywarsGame.java +++ b/src/main/java/com/nexia/minigames/games/skywars/SkywarsGame.java @@ -29,6 +29,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.BossEvent; import net.minecraft.world.Difficulty; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.biome.Biomes; @@ -476,6 +477,11 @@ public static void death(NexiaPlayer victim, @Nullable PlayerDeathEvent playerDe public static void firstTick(){ SkywarsGame.resetAll(); BOSSBAR = ServerTime.minecraftServer.getCustomBossEvents().get(new ResourceLocation("skywars", "timer")); + if(BOSSBAR == null) { + BOSSBAR = ServerTime.minecraftServer.getCustomBossEvents().create(new ResourceLocation("skywars", "timer"), new TextComponent("")); + BOSSBAR.setMax(180); + BOSSBAR.setColor(BossEvent.BossBarColor.GREEN); + } } public static ArrayList getViewers() {