mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-19 19:59:37 +00:00
All data transfer for the summary inside one packet/msg
This commit is contained in:
1 parent
9d4f036ea4
commit
c7c123c01c
6 files changed
+48
-29
No files matched your search
@@ -10,14 +10,14 @@ import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class NexusData implements ISerializable {
|
||||
|
||||
SerialLong packetOutbound;
|
||||
SerialLong packetInbound;
|
||||
SerialInt chunkForced;
|
||||
SerialInt chunkLoaded;
|
||||
DataTiming timingTick;
|
||||
SerialInt amountTileEnts;
|
||||
SerialInt amountEntities;
|
||||
SerialInt amountPlayers;
|
||||
public SerialLong packetOutbound;
|
||||
public SerialLong packetInbound;
|
||||
public SerialInt chunkForced;
|
||||
public SerialInt chunkLoaded;
|
||||
public DataTiming timingTick;
|
||||
public SerialInt amountTileEnts;
|
||||
public SerialInt amountEntities;
|
||||
public SerialInt amountPlayers;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ public enum OpisServerTickHandler{
|
||||
// One second timer
|
||||
if (timer1000.isDone()){
|
||||
|
||||
|
||||
// Summary panel
|
||||
SerialLong amountUpload = new SerialLong(((ProfilerPacket)ProfilerSection.PACKET_OUTBOUND.getProfiler()).dataAmount);
|
||||
SerialLong amountDownload = new SerialLong(((ProfilerPacket)ProfilerSection.PACKET_INBOUND.getProfiler()).dataAmount);
|
||||
SerialInt chunkForced = new SerialInt(ChunkManager.INSTANCE.getForcedChunkAmount());
|
||||
@@ -75,18 +77,11 @@ public enum OpisServerTickHandler{
|
||||
SerialInt amountEntities = new SerialInt(EntityManager.INSTANCE.getAmountEntities());
|
||||
SerialInt amountPlayers = new SerialInt(FMLCommonHandler.instance().getMinecraftServerInstance().getCurrentPlayerCount());
|
||||
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.VALUE_AMOUNT_UPLOAD, amountUpload));
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.VALUE_AMOUNT_DOWNLOAD, amountDownload));
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.VALUE_CHUNK_FORCED, chunkForced));
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.VALUE_CHUNK_LOADED, chunkLoaded));
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.VALUE_TIMING_TICK, timingTick));
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.VALUE_AMOUNT_TILEENTS, amountTileEnts));
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.VALUE_AMOUNT_ENTITIES, amountEntities));
|
||||
|
||||
RConHandler.sendToAllNexus(new NetDataValue(Message.NEXUS_DATA,
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.NEXUS_DATA,
|
||||
new NexusData(amountUpload, amountDownload, chunkForced, chunkLoaded,
|
||||
timingTick, amountTileEnts, amountEntities, amountPlayers)
|
||||
));
|
||||
));
|
||||
// End of summary update
|
||||
|
||||
for (EntityPlayerMP player : PlayerTracker.INSTANCE.playersSwing){
|
||||
if (!cachedAccess.containsKey(player) || cachedAccess.get(player) != PlayerTracker.INSTANCE.getPlayerAccessLevel(player)){
|
||||
|
||||
@@ -221,8 +221,10 @@ public class PacketManager
|
||||
|
||||
public static void sendToPlayer(PacketBase packet, EntityPlayer player)
|
||||
{
|
||||
if (player instanceof FakePlayer){
|
||||
if ((player instanceof FakePlayer) && (RConHandler.fakePlayersRcon.containsKey(player))){
|
||||
RConHandler.sendToPlayerRCon(packet, (FakePlayer)player);
|
||||
} else if ((player instanceof FakePlayer) && (RConHandler.fakePlayersNexus.containsKey(player))){
|
||||
RConHandler.sendToPlayerNexus(packet, (FakePlayer)player);
|
||||
}
|
||||
else {
|
||||
channels.get(SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
@@ -257,7 +259,11 @@ public class PacketManager
|
||||
|
||||
for (FakePlayer fakePlayer : RConHandler.fakePlayersRcon.keySet()){
|
||||
RConHandler.sendToPlayerRCon(packet, fakePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
for (FakePlayer fakePlayer : RConHandler.fakePlayersNexus.keySet()){
|
||||
RConHandler.sendToPlayerNexus(packet, fakePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public static Packet toMcPacket(PacketBase packet)
|
||||
|
||||
@@ -37,8 +37,8 @@ public class NexusInboundHandler extends ChannelInboundHandlerAdapter {
|
||||
FakePlayer fakePlayer = FakePlayerFactory.get(DimensionManager.getWorld(0), new GameProfile(fakeUUID, ctx.name()));
|
||||
RConHandler.fakePlayersNexus.put(fakePlayer, ctx);
|
||||
|
||||
//PlayerTracker.INSTANCE.playersSwing.add(fakePlayer);
|
||||
//PlayerTracker.INSTANCE.playerTab.put(fakePlayer, SelectedTab.SUMMARY);
|
||||
PlayerTracker.INSTANCE.playersSwing.add(fakePlayer);
|
||||
PlayerTracker.INSTANCE.playerTab.put(fakePlayer, SelectedTab.SUMMARY);
|
||||
RConHandler.sendToPlayerNexus(new NetDataValue(Message.NEXUS_UUID, new NexusAuth(NexusClient.instance.uuid, NexusClient.instance.pass)), fakePlayer);
|
||||
RConHandler.sendToPlayerNexus(new NetDataValue(Message.STATUS_CURRENT_TIME, new SerialLong(System.currentTimeMillis())), fakePlayer);
|
||||
StringCache.INSTANCE.syncCache(fakePlayer);
|
||||
|
||||
@@ -156,14 +156,15 @@ public class ProxyClient extends ProxyServer implements IMessageHandler{
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.STATUS_ACCESS_LEVEL, SwingUI.instance());
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.CLIENT_SHOW_SWING, SwingUI.instance());
|
||||
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_TILEENTS, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_ENTITIES, panelSummary);
|
||||
//MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_TILEENTS, panelSummary);
|
||||
//MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_ENTITIES, panelSummary);
|
||||
//MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_UPLOAD, panelSummary);
|
||||
//MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_DOWNLOAD, panelSummary);
|
||||
//MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_TIMING_TICK, panelSummary);
|
||||
//MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_CHUNK_FORCED, panelSummary);
|
||||
//MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_CHUNK_LOADED, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.NEXUS_DATA, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_HANDLERS, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_UPLOAD, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_AMOUNT_DOWNLOAD, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_TIMING_TICK, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_CHUNK_FORCED, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_CHUNK_LOADED, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_TIMING_TILEENTS, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_TIMING_ENTITIES, panelSummary);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.VALUE_TIMING_HANDLERS, panelSummary);
|
||||
|
||||
@@ -15,6 +15,7 @@ import mcp.mobius.opis.data.holders.basetypes.SerialLong;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataBlockTick;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataTiming;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataTimingMillisecond;
|
||||
import mcp.mobius.opis.data.holders.newtypes.NexusData;
|
||||
import mcp.mobius.opis.network.PacketBase;
|
||||
import mcp.mobius.opis.network.enums.AccessLevel;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
@@ -362,6 +363,22 @@ public class PanelSummary extends JPanelMsgHandler implements ITabPanel{
|
||||
this.getLblAmountLoaded().setText(String.valueOf(((SerialInt)rawdata.value).value));
|
||||
break;
|
||||
}
|
||||
|
||||
case NEXUS_DATA:{
|
||||
NexusData data = (NexusData)rawdata.value;
|
||||
|
||||
this.getLblAmountTileEnts().setText(String.valueOf(data.amountTileEnts.value));
|
||||
this.getLblAmountEntities().setText(String.valueOf(data.amountEntities.value));
|
||||
double uploadKB = data.packetOutbound.value / 1024.0;
|
||||
this.getLblAmountUpload().setText(String.format("%.3f", uploadKB));
|
||||
double downloadKB = data.packetInbound.value / 1024.0;
|
||||
this.getLblAmountDownload().setText(String.format("%.3f", downloadKB));
|
||||
this.setTimingTick(data.timingTick);
|
||||
this.getLblAmountForced().setText(String.valueOf(data.chunkForced.value));
|
||||
this.getLblAmountLoaded().setText(String.valueOf(data.chunkLoaded.value));
|
||||
break;
|
||||
}
|
||||
|
||||
case VALUE_TIMING_NETWORK:{
|
||||
//this.timingNetworkTotal = ((DataNetworkTick)rawdata.value).update.asMillisecond();
|
||||
//this.getLblTimingNetwork().setText(this.timingNetworkTotal.toString());
|
||||
|
||||
Reference in new issue
Block a user