[DEV] Backport Fixes from DEV branch
- BUG - Server being pinged constantly during direct connect or lan - BUG - Single Player Nojang Server not returning null in multiplayer - FEAT - Way to check if login/logout event was sent from vanish
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
--- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/client/multiplayer/BridgedServerData.java
|
||||
+++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/client/multiplayer/BridgedServerData.java
|
||||
@@ -24,9 +24,9 @@
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
public int getMaxPlayers() {
|
||||
- if (internal.players == null) {
|
||||
+ if (!internal.pinged || internal.players == null) {
|
||||
try {
|
||||
- new ServerStatusPinger().pingServer(internal, () -> {}, () -> {});
|
||||
+ new ServerStatusPinger().pingServer(internal, () -> {});
|
||||
} catch (Exception ignored) {}
|
||||
return internal.playerList.size() + 1;
|
||||
}
|
||||
|
||||
|
@@ -18,9 +18,9 @@
|
||||
+ @SubscribeEvent
|
||||
+ public void vanishevent(PlayerVanishEvent event) {
|
||||
+ if (event.isVanished()) {
|
||||
+ CraterEventBus.INSTANCE.postEvent(new CraterPlayerEvent.PlayerLoggedOut(BridgedPlayer.of(event.getEntity())));
|
||||
+ CraterEventBus.INSTANCE.postEvent(new CraterPlayerEvent.PlayerLoggedOut(BridgedPlayer.of(event.getEntity()), true));
|
||||
+ } else {
|
||||
+ CraterEventBus.INSTANCE.postEvent(new CraterPlayerEvent.PlayerLoggedIn(BridgedPlayer.of(event.getEntity())));
|
||||
+ CraterEventBus.INSTANCE.postEvent(new CraterPlayerEvent.PlayerLoggedIn(BridgedPlayer.of(event.getEntity()), true));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
Reference in New Issue
Block a user