Page 2 of 5

Re: L2JCommand Center

Posted: Sun May 10, 2015 9:29 am
by iliqbg
Ok will check

Re: L2JCommand Center

Posted: Sun May 10, 2015 10:04 am
by Attila
thanks

Re: L2JCommand Center

Posted: Sun May 10, 2015 10:08 am
by darkwolf999
where is the +import com.l2jserver.tools.images.ImagesTable; ? table


this is for gametime and uptime
GameTime.setText("GameTime : " + GameServer.gameTime());
UpTime.setText("UpTime : " + GameServer.getUptime());


add this to the gameserver

private static int time;

static String getUptime()
{
int uptime = (int) System.currentTimeMillis() - time;
uptime = uptime / 1000;
int h = uptime / 3600;
int m = (uptime - (h * 3600)) / 60;
int s = ((uptime - (h * 3600)) - (m * 60));
return h + " hrs " + m + " mins " + s + " secs";
}

static String gameTime()
{
int t = GameTimeController.getInstance().getGameTime();
int h = t / 60;
int m = t % 60;
SimpleDateFormat format = new SimpleDateFormat("H:mm");
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, h);
cal.set(Calendar.MINUTE, m);
return format.format(cal.getTime());
}

Re: L2JCommand Center

Posted: Sun May 10, 2015 10:44 am
by iliqbg
Thanks will update code >> Frist post Updated :) please test it and feadback :)

Re: L2JCommand Center

Posted: Sun May 10, 2015 12:56 pm
by darkwolf999
tested it and it works only the ram usage is not right it keeps counting up and not down.

only i changed updatime and gametime to 10 seconds

can you now please add the chat window ? thank you for this

Re: L2JCommand Center

Posted: Sun May 10, 2015 1:11 pm
by iliqbg
for chat window need more time frist will finished Command center will check ram ussage :)

Re: L2JCommand Center

Posted: Sun May 10, 2015 1:52 pm
by Attila
3 errors with new update i got

Image

Re: L2JCommand Center

Posted: Sun May 10, 2015 1:55 pm
by darkwolf999
change to accounts.

Re: L2JCommand Center

Posted: Sun May 10, 2015 2:16 pm
by Attila
darkwolf999 wrote:change to accounts.
Yes I had done just report it, everything works well.

Re: L2JCommand Center

Posted: Sun May 10, 2015 2:49 pm
by darkwolf999
ok no problem mate.

i tryed the chat window but don't receive the messages in the window.

i don't understand that part.

Re: L2JCommand Center

Posted: Sun May 10, 2015 4:20 pm
by iliqbg
yes will create chat window but will finish frist Command center :)

Re: L2JCommand Center

Posted: Sun May 10, 2015 5:26 pm
by darkwolf999
small update for uptime in gameserver

static String getUptime()
{
long time = System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis();

final long days = TimeUnit.MILLISECONDS.toDays(time);
time -= TimeUnit.DAYS.toMillis(days);
final long hours = TimeUnit.MILLISECONDS.toHours(time);
time -= TimeUnit.HOURS.toMillis(hours);
final long minutes = TimeUnit.MILLISECONDS.toMinutes(time);

return days + " Days, " + hours + " Hours, " + minutes + " Minutes";
}

command center update :

JLabel GameTime = new JLabel("GameTime : " + GameTimeController.getInstance().getGameHour() + ":" + GameTimeController.getInstance().getGameMinute());
final Timer gametimer = new Timer(10, null);
ActionListener listener = e -> GameTime.setText("GameTime : " + GameTimeController.getInstance().getGameHour() + ":" + GameTimeController.getInstance().getGameMinute());
gametimer.addActionListener(listener);
gametimer.start();
GameTime.setBounds(12, 140, 130, 16);
panel.add(GameTime);

JLabel UpTime = new JLabel("UpTime : " + GameServer.getUptime());
final Timer uptimer = new Timer(10, null);
ActionListener uptimerlistener = e -> UpTime.setText("UpTime : " + GameServer.getUptime());
uptimer.addActionListener(uptimerlistener);
uptimer.start();
UpTime.setBounds(149, 140, 235, 16);
panel.add(UpTime);

now it reads the real uptime and gametime.



added free ram.

final Runtime RunTime = Runtime.getRuntime();
final int mb = 1024 * 1024;
JLabel lblFree = new JLabel("Free : " + ((RunTime.maxMemory() - RunTime.totalMemory()) + RunTime.freeMemory()) / mb);
final Timer free = new Timer(500, null);
ActionListener listenerusageram = e -> lblFree.setText("Free : " + ((RunTime.maxMemory() - RunTime.totalMemory()) + RunTime.freeMemory()) / mb);
free.addActionListener(listenerusageram);
free.start();
lblFree.setBounds(283, 116, 126, 16);
panel.add(lblFree);

get system info

JTextPane txtpnSystemInfo = new JTextPane();
txtpnSystemInfo.setText("System Info");
txtpnSystemInfo.setBounds(417, 9, 88, 20);
panel.add(txtpnSystemInfo);

JTextPane txtpnOs = new JTextPane();
txtpnOs.setText("Os : " + System.getProperty("os.name"));
txtpnOs.setBounds(415, 44, 90, 20);
panel.add(txtpnOs);

JTextPane txtpnOs1 = new JTextPane();
txtpnOs1.setText("Version : " + System.getenv("PROCESSOR_ARCHITEW6432"));
txtpnOs1.setBounds(415, 69, 181, 20);
panel.add(txtpnOs1);

JTextPane txtpnOs2 = new JTextPane();
txtpnOs2.setText("Cpu : " + System.getenv("PROCESSOR_IDENTIFIER"));
txtpnOs2.setBounds(415, 92, 286, 20);
panel.add(txtpnOs2);

JTextPane txtpnOs3 = new JTextPane();
txtpnOs3.setText("Cores : " + Runtime.getRuntime().availableProcessors());
txtpnOs3.setBounds(419, 116, 62, 24);
panel.add(txtpnOs3);

Re: L2JCommand Center

Posted: Sun May 10, 2015 6:28 pm
by Attila
darkwolf999 wrote:small update for uptime in gameserver

static String getUptime()
{
long time = System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis();

final long days = TimeUnit.MILLISECONDS.toDays(time);
time -= TimeUnit.DAYS.toMillis(days);
final long hours = TimeUnit.MILLISECONDS.toHours(time);
time -= TimeUnit.HOURS.toMillis(hours);
final long minutes = TimeUnit.MILLISECONDS.toMinutes(time);

return days + " Days, " + hours + " Hours, " + minutes + " Minutes";
}

command center update :

JLabel GameTime = new JLabel("GameTime : " + GameTimeController.getInstance().getGameHour() + ":" + GameTimeController.getInstance().getGameMinute());
final Timer gametimer = new Timer(10, null);
ActionListener listener = e -> GameTime.setText("GameTime : " + GameTimeController.getInstance().getGameHour() + ":" + GameTimeController.getInstance().getGameMinute());
gametimer.addActionListener(listener);
gametimer.start();
GameTime.setBounds(12, 140, 130, 16);
panel.add(GameTime);

JLabel UpTime = new JLabel("UpTime : " + GameServer.getUptime());
final Timer uptimer = new Timer(10, null);
ActionListener uptimerlistener = e -> UpTime.setText("UpTime : " + GameServer.getUptime());
uptimer.addActionListener(uptimerlistener);
uptimer.start();
UpTime.setBounds(149, 140, 235, 16);
panel.add(UpTime);

now it reads the real uptime and gametime.



added free ram.

final Runtime RunTime = Runtime.getRuntime();
final int mb = 1024 * 1024;
JLabel lblFree = new JLabel("Free : " + ((RunTime.maxMemory() - RunTime.totalMemory()) + RunTime.freeMemory()) / mb);
final Timer free = new Timer(500, null);
ActionListener listenerusageram = e -> lblFree.setText("Free : " + ((RunTime.maxMemory() - RunTime.totalMemory()) + RunTime.freeMemory()) / mb);
free.addActionListener(listenerusageram);
free.start();
lblFree.setBounds(283, 116, 126, 16);
panel.add(lblFree);
Can you tell what we need to change
or what we have to replace and were we need to put this ?

Re: L2JCommand Center

Posted: Sun May 10, 2015 6:34 pm
by darkwolf999
just wait for the guy to add it because i use a different layout.

but if you can change the layout you can add it in the Command Center behind the last jlabel

Re: L2JCommand Center

Posted: Mon May 11, 2015 9:04 pm
by darkwolf999
made ban and unban characters.

txtPlayerName_4 = new JTextField();
txtPlayerName_4.setText("Player Name");
txtPlayerName_4.setBounds(125, 359, 116, 22);
panel.add(txtPlayerName_4);
txtPlayerName_4.setColumns(10);

JButton ban = new JButton("Ban");
ban.addActionListener(e ->
{
int charId = CharNameTable.getInstance().getIdByName(txtPlayerName_4.getText());

if (charId > 0)
{
long expirationTime = -100;
PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.BAN, expirationTime, "Contact to the GM For more Info Thanks!.", " Admin: "));
_log.info("Character : " + txtPlayerName_4.getText() + " Banned for ever!");
_log.info("Character : " + txtPlayerName_4.getText() + " has been Banned");
}
else
{
_log.info("Character : " + txtPlayerName_4.getText() + " was not found!");
}
});
ban.setBounds(16, 358, 97, 25);
panel.add(ban);

txtPlayerName_5 = new JTextField();
txtPlayerName_5.setText("Player Name");
txtPlayerName_5.setBounds(125, 393, 116, 22);
panel.add(txtPlayerName_5);
txtPlayerName_5.setColumns(10);

JButton unban = new JButton("Un-Ban");
unban.addActionListener(e ->
{
int charId = CharNameTable.getInstance().getIdByName(txtPlayerName_5.getText());

if (charId > 0)
{
PunishmentManager.getInstance().stopPunishment(charId, PunishmentAffect.CHARACTER, PunishmentType.BAN);
_log.info("Character : " + txtPlayerName_5.getText() + " has been Un-Banned");
}
else
{
_log.info("Character : " + txtPlayerName_5.getText() + " was not found!");
}
});
unban.setBounds(16, 392, 97, 25);
panel.add(unban);

i made a little start voor de chat window + button and text field.

// Chat Window
TextArea textArea = new TextArea();
textArea.setBounds(301, 367, 380, 160);
panel.add(textArea);
JLabel chat = new JLabel("Chat Window");
chat.setHorizontalAlignment(SwingConstants.CENTER);
chat.setBounds(413, 337, 150, 16);
panel.add(chat);

txtMessage_2 = new JTextField();
txtMessage_2.setHorizontalAlignment(SwingConstants.CENTER);
txtMessage_2.setText("");
txtMessage_2.setBounds(301, 533, 283, 22);
panel.add(txtMessage_2);
txtMessage_2.setColumns(10);
JButton message2 = new JButton("Send");
message2.addActionListener(e ->
{
});
message2.setBounds(593, 532, 88, 24);
panel.add(message2);
}