Someone shed some light, I've already added it several times, changed several variables and this code doesn't work, can anyone help? I wanted to add LastAcess to the CommunityBoard.
Код:
EnterWorld.java
@Override
protected void runImpl() {
Player player = getClient().getPlayer();
if (player == null) {
return;
}
//code...
+ String lastLoginTime = player.getLastLoginTime();
+ CreatureSay lastVisit = new CreatureSay(player, ChatType.GENERAL, "System", "Last login: " + lastLoginTime);
+ player.sendPacket(lastVisit);
//code...
}
Player.java
public class Player extends Creature {
//code...
+ public String getLastLoginTime() {
+ Date lastAccess = new Date(getLastAccess());
+ SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
+ return dateFormat.format(lastAccess);
+ }
//code...
}
HomeBoard.java
public class HomeBoard implements IParseBoardHandler
{
// Existing code...
+ public String handleHtmlPlaceholders(Player player, String html) {
+ if (html.contains("%last_login%")) {
+ html = html.replace("%last_login%", player.getLastLoginTime());
+ }
// Handle other placeholders...
return html;
}