Skip to content

Commit

Permalink
Merge pull request #16 from database-test/dev
Browse files Browse the repository at this point in the history
BRIDGEEEEEE
  • Loading branch information
Inf1nityy authored Oct 24, 2024
2 parents 59e3fcb + cb849f3 commit 9ac666b
Show file tree
Hide file tree
Showing 9 changed files with 796 additions and 3 deletions.
18 changes: 17 additions & 1 deletion src/main/java/com/nexia/core/games/util/LobbyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import com.nexia.minigames.games.football.FootballGame;
import com.nexia.minigames.games.football.FootballGameMode;
import com.nexia.minigames.games.football.util.player.FootballPlayerData;
import com.nexia.minigames.games.bridge.BridgeGame;
import com.nexia.minigames.games.bridge.BridgeGameMode;
import com.nexia.minigames.games.bridge.util.player.BridgePlayerData;
import com.nexia.minigames.games.oitc.OitcGame;
import com.nexia.minigames.games.oitc.OitcGameMode;
import com.nexia.minigames.games.oitc.util.player.OITCPlayerData;
Expand All @@ -42,7 +45,7 @@

public class LobbyUtil {

public static String[] statsGameModes = {"FFA CLASSIC", "SKY FFA", "UHC FFA", "KIT FFA", "BEDWARS", "OITC", "DUELS", "SKYWARS", "FOOTBALL"};
public static String[] statsGameModes = {"FFA CLASSIC", "SKY FFA", "UHC FFA", "KIT FFA", "BEDWARS", "OITC", "DUELS", "SKYWARS", "FOOTBALL", "BRIDGE"};

public static ServerLevel lobbyWorld = null;

Expand Down Expand Up @@ -86,6 +89,9 @@ public static void setLobbyWorld(MinecraftServer server) {
PlayerGameMode.FOOTBALL.tag,
"in_football_game",
"duels",
PlayerGameMode.BRIDGE.tag,
"in_bridge_game",
"duels",
PlayerGameMode.SKYWARS.tag,
PlayerGameMode.OITC.tag,
"in_oitc_game",
Expand Down Expand Up @@ -307,6 +313,16 @@ public static void sendGame(NexiaPlayer player, String game, boolean message, bo
if(message){player.sendActionBarMessage(Component.text("You have joined §7○ §7§lFootball §7\uD83D\uDDE1"));}
}

if(game.equalsIgnoreCase("bridge")){
player.addTag(BridgeGame.BRIDGE_TAG);
((CorePlayerData)PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(player)).gameMode = PlayerGameMode.BRIDGE;
((BridgePlayerData)PlayerDataManager.getDataManager(NexiaCore.BRIDGE_DATA_MANAGER).get(player)).gameMode = BridgeGameMode.LOBBY;

BridgeGame.joinQueue(player);

if(message){player.sendActionBarMessage(Component.text("You have joined §7○ §7§lBridge §7\uD83D\uDDE1"));}
}


if(game.equalsIgnoreCase("skywars")){
player.addTag(PlayerGameMode.SKYWARS.tag);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/nexia/core/games/util/PlayerGameMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.nexia.minigames.games.bedwars.players.BwPlayers;
import com.nexia.minigames.games.football.FootballGame;
import com.nexia.minigames.games.bridge.BridgeGame;
import com.nexia.minigames.games.oitc.OitcGame;
import com.nexia.minigames.games.skywars.SkywarsGame;
import org.jetbrains.annotations.NotNull;
Expand All @@ -27,7 +28,7 @@ public class PlayerGameMode {
public static final PlayerGameMode OITC = new PlayerGameMode("oitc", "OITC", OitcGame.OITC_TAG);
public static final PlayerGameMode FFA = new PlayerGameMode("ffa", "FFA", "ffa");
public static final PlayerGameMode FOOTBALL = new PlayerGameMode("football", "Football", FootballGame.FOOTBALL_TAG);

public static final PlayerGameMode BRIDGE = new PlayerGameMode("bridge", "Bridge", BridgeGame.BRIDGE_TAG);
//public static final PlayerGameMode DUELS = new PlayerGameMode("duels");

PlayerGameMode(String id, String name, String tag) {
Expand Down
20 changes: 19 additions & 1 deletion src/main/java/com/nexia/core/gui/PlayGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.nexia.minigames.games.bedwars.areas.BwAreas;
import com.nexia.minigames.games.duels.DuelGameMode;
import com.nexia.minigames.games.football.FootballGame;
import com.nexia.minigames.games.bridge.BridgeGame;
import com.nexia.minigames.games.oitc.OitcGame;
import com.nexia.minigames.games.skywars.SkywarsGame;
import eu.pb4.sgui.api.ClickType;
Expand Down Expand Up @@ -229,13 +230,25 @@ private void setOtherGamesLayout() {
ItemDisplayUtil.addLore(football, "§f", 4);
ItemDisplayUtil.addLore(football, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", FootballGame.world.players().size()), ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false), 5);

ItemStack bridge = new ItemStack(Items.DIAMOND_PICKAXE, 1);
bridge.setHoverName(ObjectMappings.convertComponent(net.kyori.adventure.text.Component.text("Bridge", ChatFormat.Minecraft.blue).decoration(ChatFormat.italic, false)));
ItemDisplayUtil.addGlint(bridge);
bridge.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS);

ItemDisplayUtil.addLore(bridge, "§f", 0);
ItemDisplayUtil.addLore(bridge, net.kyori.adventure.text.Component.text("FINNALLY BRIDGE", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 1);
ItemDisplayUtil.addLore(bridge, net.kyori.adventure.text.Component.text("Jump into the opponents goal", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 2);
ItemDisplayUtil.addLore(bridge, net.kyori.adventure.text.Component.text("to achieve victory!", ChatFormat.Minecraft.gray).decoration(ChatFormat.italic, false), 3);
ItemDisplayUtil.addLore(bridge, "§f", 4);
ItemDisplayUtil.addLore(bridge, net.kyori.adventure.text.Component.text(String.format("There are %s people playing this gamemode.", BridgeGame.world.players().size()), ChatFormat.Minecraft.white).decoration(ChatFormat.italic, false), 5);

fillEmptySlots(emptySlot);

this.setSlot(2, oitc);
this.setSlot(4, back);
this.setSlot(6, football);
this.setSlot(0, unknown);
this.setSlot(8, unknown);
this.setSlot(8, bridge);
}

public boolean click(int index, ClickType clickType, net.minecraft.world.inventory.ClickType action){
Expand Down Expand Up @@ -294,6 +307,11 @@ public boolean click(int index, ClickType clickType, net.minecraft.world.invento
this.close();
}

if(name.getString().contains("Bridge")){
LobbyUtil.sendGame(nexiaPlayer, "bridge", true, true);
this.close();
}

if(name.getString().contains("Duels")){
LobbyUtil.sendGame(nexiaPlayer, "duels", true, true);
this.close();
Expand Down
Loading

0 comments on commit 9ac666b

Please sign in to comment.