diff options
author | hackthetime <l4bg0jb7@duck.com> | 2023-12-14 12:57:03 +0100 |
---|---|---|
committer | hackthetime <l4bg0jb7@duck.com> | 2023-12-14 12:57:03 +0100 |
commit | d7bd502812504373a3d4e181fa4635145d1c10be (patch) | |
tree | d6a47a833e0739c0ae32b9a4a53284b2579f2d63 /common | |
parent | 1f90b12d47118f2a1132f12c39a2977e8c02fa77 (diff) | |
download | BBsentials-d7bd502812504373a3d4e181fa4635145d1c10be.tar.gz BBsentials-d7bd502812504373a3d4e181fa4635145d1c10be.tar.bz2 BBsentials-d7bd502812504373a3d4e181fa4635145d1c10be.zip |
a lot of prob not full working things
Diffstat (limited to 'common')
8 files changed, 104 insertions, 25 deletions
diff --git a/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java b/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java index 5ea2384..b89cfc1 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java @@ -4,6 +4,7 @@ import de.hype.bbsentials.common.communication.BBsentialConnection; import de.hype.bbsentials.common.mclibraries.EnvironmentCore; import de.hype.bbsentials.common.packets.packets.SplashNotifyPacket; import de.hype.bbsentials.common.packets.packets.SplashUpdatePacket; +import sun.java2d.pipe.TextRenderer; import java.util.concurrent.TimeUnit; @@ -24,6 +25,7 @@ public class SplashStatusUpdateListener implements Runnable { public void run() { BBsentials.splashLobby = true; int maxPlayerCount = EnvironmentCore.utils.getMaximumPlayerCount() - 5; + while (BBsentials.splashLobby) { if (!full&&(EnvironmentCore.utils.getPlayerCount() >= maxPlayerCount)) { newStatus = SplashUpdatePacket.STATUS_FULL; @@ -49,7 +51,6 @@ public class SplashStatusUpdateListener implements Runnable { connection.sendPacket(new SplashUpdatePacket(packet.splashId, status)); } } - public void setStatus(String newStatus) { this.newStatus = newStatus; if (newStatus.equals(SplashUpdatePacket.STATUS_SPLASHING)) { diff --git a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java index df0ff63..2269339 100644 --- a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java +++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java @@ -1,7 +1,6 @@ package de.hype.bbsentials.common.constants.enviromentShared; import de.hype.bbsentials.common.constants.BBDisplayNameProvider; - import java.util.ArrayList; import java.util.Collection; import java.util.List; diff --git a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/Islands.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/Islands.java index d88d79b..dff2a97 100644 --- a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/Islands.java +++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/Islands.java @@ -4,21 +4,21 @@ import de.hype.bbsentials.common.constants.BBDisplayNameProvider; /** * List of all Islands - * <li>{@link #CRYSTAL_HOLLOWS} - * <li>{@link #CRIMSON_ISLE} - * <li>{@link #DEEP_CAVERNS} - * <li>{@link #DUNGEON} - * <li>{@link #DUNGEON_HUB} - * <li>{@link #DWARVEN_MINES} - * <li>{@link #GOLD_MINE} - * <li>{@link #HUB} - * <li>{@link #KUUDRA} - * <li>{@link #PRIVATE_ISLAND} - * <li>{@link #SPIDERS_DEN} - * <li>{@link #THE_END} - * <li>{@link #THE_FARMING_ISLANDS} - * <li>{@link #JERRYS_WORKSHOP} - * <li>{@link #THE_RIFT} + * {@link #CRYSTAL_HOLLOWS} + * {@link #CRIMSON_ISLE} + * {@link #DEEP_CAVERNS} + * {@link #DUNGEON} + * {@link #DUNGEON_HUB} + * {@link #DWARVEN_MINES} + * {@link #GOLD_MINE} + * {@link #HUB} + * {@link #KUUDRA} + * {@link #PRIVATE_ISLAND} + * {@link #SPIDERS_DEN} + * {@link #THE_END} + * {@link #THE_FARMING_ISLANDS} + * {@link #JERRYS_WORKSHOP} + * {@link #THE_RIFT} */ public enum Islands implements BBDisplayNameProvider { CRYSTAL_HOLLOWS("crystal_hollows", "Crystal Hollows"), diff --git a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/MiningEvents.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/MiningEvents.java index e364aab..6336fee 100644 --- a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/MiningEvents.java +++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/MiningEvents.java @@ -1,17 +1,17 @@ package de.hype.bbsentials.common.constants.enviromentShared; -// Mining Events - import de.hype.bbsentials.common.constants.BBDisplayNameProvider; +// Mining Events + /** * A List of all Mining Events - * <li>{@link #BETTER_TOGETHER} - * <li>{@link #DOUBLE_POWDER} - * <li>{@link #GONE_WITH_THE_WIND} - * <li>{@link #GOBLIN_RAID} - * <li>{@link #MITHRIL_GOURMAND} - * <li>{@link #RAFFLE} + * {@link #BETTER_TOGETHER} + * {@link #DOUBLE_POWDER} + * {@link #GONE_WITH_THE_WIND} + * {@link #GOBLIN_RAID} + * {@link #MITHRIL_GOURMAND} + * {@link #RAFFLE} */ public enum MiningEvents implements BBDisplayNameProvider { BETTER_TOGETHER("Better Together"), diff --git a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/StatusConstants.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/StatusConstants.java new file mode 100644 index 0000000..288622d --- /dev/null +++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/StatusConstants.java @@ -0,0 +1,43 @@ +package de.hype.bbsentials.common.constants.enviromentShared; + +import de.hype.bbsentials.common.constants.BBDisplayNameProvider; + +import java.awt.*; + +public enum StatusConstants implements BBDisplayNameProvider { + DONEGOOD("Done", Color.GREEN), + DONEBAD("Done", Color.ORANGE), + WAITING("Waiting", Color.GREEN), + FULL("Full", Color.YELLOW), + ONGOING("Ongoing", Color.YELLOW), + OPEN("Open", Color.GREEN), + SPLASHING("Splashing", Color.YELLOW), + CLOSING("Closing", Color.ORANGE), + CLOSINGSOON("Closing Soon", Color.ORANGE), + LEAVINGSOON("Leaving Soon", Color.ORANGE), + CANCELED("Canceled", Color.RED), + CLOSED("Closed", Color.RED), + LEFT("Left", Color.ORANGE), + ; + String displayName; + Color color; + + StatusConstants(String displayName, Color color) { + this.displayName = displayName; + this.color = color; + } + + public String getDisplayName() { + return displayName; + } + + public Color getColor() { + return color; + } + + @Deprecated + @Override + public String toString() { + return displayName; + } +} diff --git a/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java index c007d31..dbd407f 100644 --- a/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java +++ b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java @@ -1,6 +1,7 @@ package de.hype.bbsentials.common.mclibraries; import java.io.File; +import java.util.List; public interface MCUtils { boolean isWindowFocused(); @@ -15,4 +16,6 @@ public interface MCUtils { int getPotTime(); String mojangAuth(String serverId); + + List<String> getSplashLeechingPlayers(); } diff --git a/common/src/main/java/de/hype/bbsentials/common/packets/PacketManager.java b/common/src/main/java/de/hype/bbsentials/common/packets/PacketManager.java index 2cc672d..2a10960 100644 --- a/common/src/main/java/de/hype/bbsentials/common/packets/PacketManager.java +++ b/common/src/main/java/de/hype/bbsentials/common/packets/PacketManager.java @@ -1,5 +1,6 @@ package de.hype.bbsentials.common.packets; +import de.hype.bbsentials.common.client.SplashManager; import de.hype.bbsentials.common.communication.BBsentialConnection; import de.hype.bbsentials.common.packets.packets.*; @@ -40,6 +41,7 @@ public class PacketManager { packets.add(new Packet<>(SystemMessagePacket.class, connection::onSystemMessagePacket)); packets.add(new Packet<>(WelcomeClientPacket.class, connection::onWelcomePacket)); packets.add(new Packet<>(RequestAuthentication.class, connection::onRequestAuthentication)); + packets.add(new Packet<>(SplashUpdatePacket.class, SplashManager::updateSplash)); } // Method to handle a received packet diff --git a/common/src/main/java/de/hype/bbsentials/common/packets/packets/ChChestsUpdatePacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/ChChestsUpdatePacket.java new file mode 100644 index 0000000..2e015ac --- /dev/null +++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/ChChestsUpdatePacket.java @@ -0,0 +1,31 @@ +package de.hype.bbsentials.common.packets.packets; + +import de.hype.bbsentials.common.constants.enviromentShared.StatusConstants; +import de.hype.bbsentials.common.packets.AbstractPacket; + +import java.util.Date; +import java.util.List; + +/** + * Client and Server. Updates ChChests Status. + */ +public class ChChestsUpdatePacket extends AbstractPacket { + public final int lobbyId; + public final StatusConstants status; + public final List<String> playersStillIn; + public final Date closingTime; + + /** + * @param lobbyId id of the lobby + * @param status one of the following types: {@link StatusConstants#OPEN}, {@link StatusConstants#FULL}, {@link StatusConstants#LEAVINGSOON}, {@link StatusConstants#LEFT}, {@link StatusConstants#CLOSED} + * @param playersStillIn Players that were still in when leaving the lobby. + * @param closingTime assumed closingTime. + */ + public ChChestsUpdatePacket(int lobbyId, StatusConstants status, List<String> playersStillIn, Date closingTime) { + super(1, 1); //Min and Max supported Version + this.lobbyId = lobbyId; + this.status = status; + this.playersStillIn = playersStillIn; + this.closingTime = closingTime; + } +} |