mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-18 11:29:28 +00:00
Text of Run Opis buttons will switch when Opis is running.
This commit is contained in:
1 parent
14ef8f5fef
commit
265a31f2e0
6 files changed
+52
-11
No files matched your search
@@ -4,6 +4,7 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialInt;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
import mcp.mobius.opis.data.managers.MetaManager;
|
||||
import mcp.mobius.opis.data.managers.TickHandlerManager;
|
||||
@@ -11,6 +12,8 @@ import mcp.mobius.opis.data.managers.TileEntityManager;
|
||||
import mcp.mobius.opis.data.server.EntityProfiler;
|
||||
import mcp.mobius.opis.data.server.HandlerProfiler;
|
||||
import mcp.mobius.opis.data.server.TileEntityProfiler;
|
||||
import mcp.mobius.opis.network.enums.DataReq;
|
||||
import mcp.mobius.opis.network.server.Packet_DataValue;
|
||||
import mcp.mobius.opis.server.OpisServerTickHandler;
|
||||
import mcp.mobius.opis.server.PlayerTracker;
|
||||
import net.minecraft.command.CommandBase;
|
||||
@@ -47,9 +50,12 @@ public class CommandStart extends CommandBase implements IOpisCommand {
|
||||
modOpis.profilerRun = true;
|
||||
ProfilerRegistrar.turnOn();
|
||||
|
||||
if (icommandsender instanceof EntityPlayer)
|
||||
if (icommandsender instanceof EntityPlayer){
|
||||
PlayerTracker.instance().playersOpis.add((Player)icommandsender);
|
||||
((EntityPlayerMP)icommandsender).playerNetServerHandler.sendPacketToPlayer(Packet_DataValue.create(DataReq.STATUS_START, new SerialInt(modOpis.profilerMaxTicks)));
|
||||
}
|
||||
icommandsender.sendChatToPlayer(ChatMessageComponent.createFromText(String.format("\u00A7oOpis started with a tick delay %s.", modOpis.profilerDelay)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
private JLabel lblSummaryAmountHandlers;
|
||||
private JLabel lblSummary_1;
|
||||
private JLabel label;
|
||||
private JButton btnSummaryReset;
|
||||
private JButton btnSummaryRefresh;
|
||||
private JButton btnTimingEntPull;
|
||||
private JButton btnAmountKillAll;
|
||||
private JLabel lblSummary_11;
|
||||
@@ -199,14 +199,14 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
gbc_lblNewLabel_6.gridy = 1;
|
||||
panelSummary.add(lblNewLabel_6, gbc_lblNewLabel_6);
|
||||
|
||||
btnSummaryReset = new JButton("Run Opis");
|
||||
btnSummaryRefresh = new JButton("Run Opis");
|
||||
GridBagConstraints gbc_btnSummaryReset = new GridBagConstraints();
|
||||
gbc_btnSummaryReset.anchor = GridBagConstraints.EAST;
|
||||
gbc_btnSummaryReset.insets = new Insets(0, 0, 5, 0);
|
||||
gbc_btnSummaryReset.gridx = 15;
|
||||
gbc_btnSummaryReset.gridy = 1;
|
||||
btnSummaryReset.addActionListener(this);
|
||||
panelSummary.add(btnSummaryReset, gbc_btnSummaryReset);
|
||||
btnSummaryRefresh.addActionListener(this);
|
||||
panelSummary.add(btnSummaryRefresh, gbc_btnSummaryReset);
|
||||
|
||||
lblSummary_13 = new JLabel("World Tick");
|
||||
lblSummary_13.setToolTipText("This is the world tick profiling.\nThe server will update the time, do random block ticks\nand this kind of things while inside this code part.");
|
||||
@@ -872,6 +872,22 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
return lblSummaryDownload;
|
||||
}
|
||||
|
||||
public JButton getBtnSummaryRefresh() {
|
||||
return btnSummaryRefresh;
|
||||
}
|
||||
public JButton getBtnTimingTERefresh() {
|
||||
return btnTimingTERefresh;
|
||||
}
|
||||
public JButton getBtnTimingEntRefresh() {
|
||||
return btnTimingEntRefresh;
|
||||
}
|
||||
public JButton getBtnTimingHandlerRefresh() {
|
||||
return btnTimingHandlerRefresh;
|
||||
}
|
||||
public JButton getBtnTimingChunkRefresh() {
|
||||
return btnTimingChunkRefresh;
|
||||
}
|
||||
|
||||
//public JLabel getLblSummaryTimingGlobalUpdate() {
|
||||
// return lblSummaryTimingGlobalUpdate;
|
||||
//}
|
||||
@@ -934,7 +950,7 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
PacketDispatcher.sendPacketToServer(Packet_ReqData.create(DataReq.COMMAND_TELEPORT_PULL_ENTITY, new TargetEntity(eid, dim)));
|
||||
}
|
||||
|
||||
else if ((e.getSource() == btnTimingTERefresh) || (e.getSource() == btnTimingEntRefresh) || (e.getSource() == btnTimingHandlerRefresh) || (e.getSource() == btnTimingChunkRefresh) || (e.getSource() == btnSummaryReset)){
|
||||
else if ((e.getSource() == btnTimingTERefresh) || (e.getSource() == btnTimingEntRefresh) || (e.getSource() == btnTimingHandlerRefresh) || (e.getSource() == btnTimingChunkRefresh) || (e.getSource() == btnSummaryRefresh)){
|
||||
PacketDispatcher.sendPacketToServer(Packet_ReqData.create(DataReq.COMMAND_START));
|
||||
}
|
||||
|
||||
@@ -1003,7 +1019,4 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
@Override
|
||||
public void windowOpened(WindowEvent arg0) {}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -143,6 +143,7 @@ public class DataReqHandler {
|
||||
MetaManager.reset();
|
||||
modOpis.profilerRun = true;
|
||||
ProfilerRegistrar.turnOn();
|
||||
PacketDispatcher.sendPacketToPlayer(Packet_DataValue.create(DataReq.STATUS_START, new SerialInt(modOpis.profilerMaxTicks)), (Player)player);
|
||||
}
|
||||
|
||||
else if (maintype == DataReq.COMMAND_TELEPORT_BLOCK){
|
||||
|
||||
@@ -183,7 +183,23 @@ public class OpisPacketHandler implements IPacketHandler {
|
||||
DataCache.instance().setAmountUpload(((SerialLong)castedPacket.data).value);
|
||||
|
||||
else if (castedPacket.dataReq == DataReq.VALUE_AMOUNT_DOWNLOAD)
|
||||
DataCache.instance().setAmountDownload(((SerialLong)castedPacket.data).value);
|
||||
DataCache.instance().setAmountDownload(((SerialLong)castedPacket.data).value);
|
||||
|
||||
else if (castedPacket.dataReq == DataReq.STATUS_START){
|
||||
SwingUI.instance().getBtnTimingChunkRefresh().setText("Running...");
|
||||
SwingUI.instance().getBtnSummaryRefresh().setText("Running...");
|
||||
SwingUI.instance().getBtnTimingEntRefresh().setText("Running...");
|
||||
SwingUI.instance().getBtnTimingHandlerRefresh().setText("Running...");
|
||||
SwingUI.instance().getBtnTimingTERefresh().setText("Running...");
|
||||
}
|
||||
|
||||
else if (castedPacket.dataReq == DataReq.STATUS_STOP){
|
||||
SwingUI.instance().getBtnTimingChunkRefresh().setText("Run Opis");
|
||||
SwingUI.instance().getBtnSummaryRefresh().setText("Run Opis");
|
||||
SwingUI.instance().getBtnTimingEntRefresh().setText("Run Opis");
|
||||
SwingUI.instance().getBtnTimingHandlerRefresh().setText("Run Opis");
|
||||
SwingUI.instance().getBtnTimingTERefresh().setText("Run Opis");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ public enum DataReq {
|
||||
VALUE_AMOUNT_UPLOAD,
|
||||
VALUE_AMOUNT_DOWNLOAD,
|
||||
|
||||
STATUS_START,
|
||||
STATUS_STOP,
|
||||
|
||||
COMMAND_TELEPORT_BLOCK(PRIVILEGED),
|
||||
COMMAND_TELEPORT_CHUNK(PRIVILEGED),
|
||||
COMMAND_TELEPORT_TO_ENTITY(PRIVILEGED),
|
||||
|
||||
@@ -122,7 +122,9 @@ public class OpisServerTickHandler implements ITickHandler {
|
||||
|
||||
PacketDispatcher.sendPacketToPlayer(Packet_DataValue.create(DataReq.VALUE_AMOUNT_TILEENTS, new SerialInt(TileEntityManager.stats.size())), (Player)player);
|
||||
PacketDispatcher.sendPacketToPlayer(Packet_DataValue.create(DataReq.VALUE_AMOUNT_ENTITIES, new SerialInt(EntityManager.stats.size())), (Player)player);
|
||||
PacketDispatcher.sendPacketToPlayer(Packet_DataValue.create(DataReq.VALUE_AMOUNT_HANDLERS, new SerialInt(TickHandlerManager.startStats.size())),(Player)player);
|
||||
PacketDispatcher.sendPacketToPlayer(Packet_DataValue.create(DataReq.VALUE_AMOUNT_HANDLERS, new SerialInt(TickHandlerManager.startStats.size())),(Player)player);
|
||||
|
||||
PacketDispatcher.sendPacketToPlayer(Packet_DataValue.create(DataReq.STATUS_STOP, new SerialInt(0)), player);
|
||||
}
|
||||
|
||||
for (Player player : PlayerTracker.instance().playersOpis)
|
||||
|
||||
Reference in new issue
Block a user