Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra-Myers committed Aug 1, 2024
1 parent 42f7686 commit 8d2eedf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/nexia/core/NexiaCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class NexiaCore implements ModInitializer, NexusPlugin {

public NetworkingHandler networkingHandler;

public static final ResourceLocation CONVENTIONAL_BRIDGING_UPDATE_ID = new ResourceLocation("c", "update_status");

public static final ResourceLocation CORE_DATA_MANAGER = id("core");

public static final ResourceLocation DISCORD_DATA_MANAGER = id("discord");
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/nexia/core/games/util/LobbyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
import com.nexia.nexus.api.world.nbt.NBTValue;
import com.nexia.nexus.api.world.types.Minecraft;
import com.nexia.nexus.api.world.util.Location;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.kyori.adventure.text.Component;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -117,6 +120,11 @@ public static void returnToLobby(NexiaPlayer player, boolean tp) {


((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode = PlayerGameMode.LOBBY;
if (ServerPlayNetworking.canSend(player.unwrap(), NexiaCore.CONVENTIONAL_BRIDGING_UPDATE_ID)) {
FriendlyByteBuf buf = PacketByteBufs.create();
buf.writeBoolean(true);
ServerPlayNetworking.send(player.unwrap(), NexiaCore.CONVENTIONAL_BRIDGING_UPDATE_ID, buf);
}
}

public static void giveItems(NexiaPlayer player) {
Expand Down Expand Up @@ -230,6 +238,11 @@ public static void sendGame(NexiaPlayer player, String game, boolean message, bo
if (checkGameModeBan(player, game)) {
return;
}
if (ServerPlayNetworking.canSend(player.unwrap(), NexiaCore.CONVENTIONAL_BRIDGING_UPDATE_ID)) {
FriendlyByteBuf buf = PacketByteBufs.create();
buf.writeBoolean(true);
ServerPlayNetworking.send(player.unwrap(), NexiaCore.CONVENTIONAL_BRIDGING_UPDATE_ID, buf);
}

for (BaseFfaUtil util : BaseFfaUtil.ffaUtils) {
if (game.equalsIgnoreCase(util.getNameLowercase() + " ffa") && !util.canGoToSpawn(player)) {
Expand Down

0 comments on commit 8d2eedf

Please sign in to comment.