L2JCommand Center Final version 1.1.0

Have you created a useful tool? or Do you want to get help building one? This is the right place!
Forum rules
READ NOW: L2j Forums Rules of Conduct
User avatar
iliqbg
Posts: 27
Joined: Thu Nov 26, 2009 10:12 am
Contact:

Re: L2JCommand Center

Post by iliqbg »

Ok will check
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: L2JCommand Center

Post by Attila »

thanks
Last edited by Attila on Sun May 10, 2015 10:25 am, edited 1 time in total.
darkwolf999
Posts: 87
Joined: Fri May 27, 2005 10:31 pm

Re: L2JCommand Center

Post 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());
}
User avatar
iliqbg
Posts: 27
Joined: Thu Nov 26, 2009 10:12 am
Contact:

Re: L2JCommand Center

Post by iliqbg »

Thanks will update code >> Frist post Updated :) please test it and feadback :)
darkwolf999
Posts: 87
Joined: Fri May 27, 2005 10:31 pm

Re: L2JCommand Center

Post 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
User avatar
iliqbg
Posts: 27
Joined: Thu Nov 26, 2009 10:12 am
Contact:

Re: L2JCommand Center

Post by iliqbg »

for chat window need more time frist will finished Command center will check ram ussage :)
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: L2JCommand Center

Post by Attila »

3 errors with new update i got

Image
darkwolf999
Posts: 87
Joined: Fri May 27, 2005 10:31 pm

Re: L2JCommand Center

Post by darkwolf999 »

change to accounts.
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: L2JCommand Center

Post by Attila »

darkwolf999 wrote:change to accounts.
Yes I had done just report it, everything works well.
darkwolf999
Posts: 87
Joined: Fri May 27, 2005 10:31 pm

Re: L2JCommand Center

Post 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.
User avatar
iliqbg
Posts: 27
Joined: Thu Nov 26, 2009 10:12 am
Contact:

Re: L2JCommand Center

Post by iliqbg »

yes will create chat window but will finish frist Command center :)
darkwolf999
Posts: 87
Joined: Fri May 27, 2005 10:31 pm

Re: L2JCommand Center

Post 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);
Last edited by darkwolf999 on Sun May 10, 2015 6:28 pm, edited 1 time in total.
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: L2JCommand Center

Post 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 ?
darkwolf999
Posts: 87
Joined: Fri May 27, 2005 10:31 pm

Re: L2JCommand Center

Post 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
darkwolf999
Posts: 87
Joined: Fri May 27, 2005 10:31 pm

Re: L2JCommand Center

Post 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);
}
Post Reply