fix a crash, display commit at startup
This commit is contained in:
parent
d17dec15b2
commit
ed5e463141
4 changed files with 19 additions and 11 deletions
|
@ -17,7 +17,6 @@ import de.com.baseband.client.util.net.WebServiceClient;
|
||||||
import de.com.baseband.client.util.render.NotificationRender;
|
import de.com.baseband.client.util.render.NotificationRender;
|
||||||
import de.com.baseband.prod.LoadHandler;
|
import de.com.baseband.prod.LoadHandler;
|
||||||
import de.tudbut.tools.Lock;
|
import de.tudbut.tools.Lock;
|
||||||
import de.tudbut.tools.Tools;
|
|
||||||
import hint.Mobf;
|
import hint.Mobf;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
@ -33,7 +32,7 @@ public class BaseBand {
|
||||||
public static final Logger LOGGER = LogManager.getLogger("BaseBand");
|
public static final Logger LOGGER = LogManager.getLogger("BaseBand");
|
||||||
public static final SecureRandom RANDOM = new SecureRandom();
|
public static final SecureRandom RANDOM = new SecureRandom();
|
||||||
|
|
||||||
public static String buildString = Tools.firstNonNull(LoadHandler.data.getString("build-name"), "Greenland");
|
public static String buildString = LoadHandler.data.getString("build-name");
|
||||||
public static final EventBus EVENT_BUS = new EventBus(Throwable::printStackTrace);
|
public static final EventBus EVENT_BUS = new EventBus(Throwable::printStackTrace);
|
||||||
public static final RemoteEventBus REMOTE_EVENT_BUS = new RemoteEventBus();
|
public static final RemoteEventBus REMOTE_EVENT_BUS = new RemoteEventBus();
|
||||||
public static final StaticEventHandler STATIC_EVENT_HANDLER = new StaticEventHandler();
|
public static final StaticEventHandler STATIC_EVENT_HANDLER = new StaticEventHandler();
|
||||||
|
|
|
@ -28,8 +28,10 @@ public class DevStub implements IFMLLoadingPlugin {
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onInit(FMLPostInitializationEvent event) {
|
public void onInit(FMLPostInitializationEvent event) {
|
||||||
|
LOGGER.info("Booting BaseBand Greenland...");
|
||||||
if(LoadHandler.data.map.get("username") != null)
|
if(LoadHandler.data.map.get("username") != null)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
LoadHandler.data.set("build-name", "Greenland");
|
||||||
LoadHandler.data.set("ip", "baseband.com.de");
|
LoadHandler.data.set("ip", "baseband.com.de");
|
||||||
LoadHandler.data.set("branch", "[dev]");
|
LoadHandler.data.set("branch", "[dev]");
|
||||||
LoadHandler.data.set("allowed-branches", new TCNArray());
|
LoadHandler.data.set("allowed-branches", new TCNArray());
|
||||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Queue;
|
||||||
public class PacketCounter extends Feature {
|
public class PacketCounter extends Feature {
|
||||||
|
|
||||||
long totUp = 0, totDown = 0;
|
long totUp = 0, totDown = 0;
|
||||||
Queue<PacketTimestamp> up = new LinkedList<>(), down = new LinkedList<>();
|
final Queue<PacketTimestamp> up = new LinkedList<>(), down = new LinkedList<>();
|
||||||
|
|
||||||
@Config("Abbreviate")
|
@Config("Abbreviate")
|
||||||
@Description("Abbreviates numbers with ...K and ...M once they get too large.")
|
@Description("Abbreviates numbers with ...K and ...M once they get too large.")
|
||||||
|
@ -51,11 +51,13 @@ public class PacketCounter extends Feature {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processQueue(Queue<PacketTimestamp> queue) {
|
private void processQueue(Queue<PacketTimestamp> queue) {
|
||||||
while (!queue.isEmpty()) {
|
synchronized (queue) {
|
||||||
if(queue.peek().passed())
|
while (!queue.isEmpty()) {
|
||||||
queue.remove();
|
if (queue.peek().passed())
|
||||||
else
|
queue.remove();
|
||||||
break;
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +70,15 @@ public class PacketCounter extends Feature {
|
||||||
public void onPacket(PacketEvent event) {
|
public void onPacket(PacketEvent event) {
|
||||||
if(event instanceof PacketEvent.Send) {
|
if(event instanceof PacketEvent.Send) {
|
||||||
totUp ++;
|
totUp ++;
|
||||||
up.add(new PacketTimestamp());
|
synchronized (up) {
|
||||||
|
up.add(new PacketTimestamp());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(event instanceof PacketEvent.Receive) {
|
if(event instanceof PacketEvent.Receive) {
|
||||||
totDown ++;
|
totDown ++;
|
||||||
down.add(new PacketTimestamp());
|
synchronized (down) {
|
||||||
|
down.add(new PacketTimestamp());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,7 @@ public class Loader implements Util {
|
||||||
LOGGER.warn("No new BaseBand chunk has been downloaded in 2 seconds. Consider restarting your game.");
|
LOGGER.warn("No new BaseBand chunk has been downloaded in 2 seconds. Consider restarting your game.");
|
||||||
}
|
}
|
||||||
else if(System.currentTimeMillis() - lastUpdate >= 500) {
|
else if(System.currentTimeMillis() - lastUpdate >= 500) {
|
||||||
LOGGER.info("Downloading at {}KB/s...", (int) ((bytes.get() / 1024f) * (System.currentTimeMillis() - lastUpdate) / 1000f));
|
//LOGGER.info("Downloading at {}KB/s...", (int) ((bytes.get() / 1024f) * (System.currentTimeMillis() - lastUpdate) / 1000f));
|
||||||
lastUpdate = System.currentTimeMillis();
|
lastUpdate = System.currentTimeMillis();
|
||||||
bytes.set(0);
|
bytes.set(0);
|
||||||
}
|
}
|
||||||
|
@ -308,6 +308,7 @@ public class Loader implements Util {
|
||||||
continueDownload.waitHere();
|
continueDownload.waitHere();
|
||||||
}
|
}
|
||||||
LOGGER.info("BaseBand downloaded: {} chunks.", data.size());
|
LOGGER.info("BaseBand downloaded: {} chunks.", data.size());
|
||||||
|
LOGGER.info("Booting BaseBand {} @ {}", clientData.getString("build-name"), new String(data.get("commit")).trim());
|
||||||
classLoader = new CustomClassLoader(data);
|
classLoader = new CustomClassLoader(data);
|
||||||
downloadUpdated.unlock();
|
downloadUpdated.unlock();
|
||||||
classLoader.inject();
|
classLoader.inject();
|
||||||
|
|
Loading…
Add table
Reference in a new issue