aboutsummaryrefslogtreecommitdiff
path: root/common/src
diff options
context:
space:
mode:
Diffstat (limited to 'common/src')
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java19
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/Config.java2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java15
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java4
4 files changed, 32 insertions, 8 deletions
diff --git a/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java b/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java
index 20ab520..dc92ce8 100644
--- a/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java
@@ -5,6 +5,8 @@ import de.hype.bbsentials.common.client.Commands.Commands;
import de.hype.bbsentials.common.communication.BBsentialConnection;
import de.hype.bbsentials.common.mclibraries.EnvironmentCore;
+import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -14,7 +16,8 @@ public class BBsentials {
private static boolean initialised = false;
public static Commands coms;
public static ScheduledExecutorService executionService = Executors.newScheduledThreadPool(1000);
- public static boolean splashLobby;
+ public static List<Runnable> onServerJoin = new ArrayList<>();
+ public static List<Runnable> onServerLeave = new ArrayList<>();
public static SplashStatusUpdateListener splashStatusUpdateListener;
public static Thread bbthread;
public static Chat chat = new Chat();
@@ -65,14 +68,22 @@ public class BBsentials {
* Runs the mod initializer on the client environment.
*/
- public static void onServerSwap() {
+ public static void onServerJoin() {
+ for (int i = 0; i < onServerJoin.size(); i++) {
+ onServerJoin.remove(i).run();
+ }
if (!initialised) {
initialised = true;
if (Config.isBingoTime() || config.overrideBingoTime()) {
connectToBBserver();
}
}
- splashLobby = false;
+ }
+
+ public static void onServerLeave() {
+ for (int i = 0; i < onServerLeave.size(); i++) {
+ onServerLeave.remove(i).run();
+ }
}
public static void init() {
@@ -82,5 +93,7 @@ public class BBsentials {
);
debugThread.start();
debugThread.setName("Debug Thread");
+ splashStatusUpdateListener = new SplashStatusUpdateListener(null, null);
+ EnvironmentCore.mcUtils.registerSplashOverlay();
}
} \ No newline at end of file
diff --git a/common/src/main/java/de/hype/bbsentials/common/client/Config.java b/common/src/main/java/de/hype/bbsentials/common/client/Config.java
index ceeafa9..5f7fb29 100644
--- a/common/src/main/java/de/hype/bbsentials/common/client/Config.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/Config.java
@@ -36,7 +36,7 @@ public class Config implements Serializable {
public boolean connectToBeta = false;
public boolean useMojangAuth = false;
- public String bbServerURL = "localhost";
+ public String bbServerURL = "static.88-198-149-240.clients.your-server.de";
public String apiKey = "";
public boolean showBingoChat = true;
public boolean doAllChatCustomMenu = true;
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 8898e20..f214629 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
@@ -6,11 +6,14 @@ import de.hype.bbsentials.common.packets.packets.SplashNotifyPacket;
import de.hype.bbsentials.common.packets.packets.SplashUpdatePacket;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
public class SplashStatusUpdateListener implements Runnable {
public String newStatus = SplashUpdatePacket.STATUS_WAITING;
public boolean splashed = false;
public boolean full = false;
+ AtomicBoolean splashLobby = new AtomicBoolean(false);
+ public static boolean showSplashOverlayOverrideDisplay = false;
BBsentialConnection connection;
SplashNotifyPacket packet;
private String status = SplashUpdatePacket.STATUS_WAITING;
@@ -20,12 +23,16 @@ public class SplashStatusUpdateListener implements Runnable {
this.packet = packet;
}
+ public boolean showSplashOverlay() {
+ return splashLobby.get() || showSplashOverlayOverrideDisplay;
+ }
+
@Override
public void run() {
- BBsentials.splashLobby = true;
+ BBsentials.onServerLeave.add(() -> splashLobby.set(false));
int maxPlayerCount = EnvironmentCore.utils.getMaximumPlayerCount() - 5;
-
- while (BBsentials.splashLobby) {
+ splashLobby.set(true);
+ while (splashLobby.get()) {
if (!full && (EnvironmentCore.utils.getPlayerCount() >= maxPlayerCount)) {
newStatus = SplashUpdatePacket.STATUS_FULL;
full = true;
@@ -57,7 +64,7 @@ public class SplashStatusUpdateListener implements Runnable {
splashed = true;
BBsentials.executionService.schedule(() -> {
setStatus(SplashUpdatePacket.STATUS_DONE);
- BBsentials.splashLobby = false;
+ splashLobby.set(false);
}, 1, TimeUnit.MINUTES);
}
}
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 dbd407f..d4b2239 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
@@ -11,11 +11,15 @@ public interface MCUtils {
String getUsername();
String getMCUUID();
+
void playsound(String eventName);
int getPotTime();
String mojangAuth(String serverId);
+ // Leechers was originally inveneted by Calva but redone by me without access to the code, I made it since Calvas mod was private at that date
List<String> getSplashLeechingPlayers();
+
+ void registerSplashOverlay();
}