Set lastonline on habbo.java

This commit is contained in:
brenoepic 2022-04-15 18:57:22 -03:00 committed by Harmonic
parent d7e059326e
commit c33e8675a8
4 changed files with 52 additions and 6 deletions

View File

@ -145,6 +145,8 @@ public class Habbo implements Runnable {
this.habboInfo.setMachineID(this.client.getMachineId());
this.isOnline(true);
this.habboStats.cache.put("previousOnline", this.habboInfo.getLastOnline());
this.habboInfo.setLastOnline(Emulator.getIntUnixTimestamp());
this.messenger.connectionChanged(this, true, false);

View File

@ -0,0 +1,11 @@
package com.eu.habbo.messages.incoming.inventory;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.inventory.BadgePointLimitsComposer;
public class GetBadgePointLimitsEvent extends MessageHandler {
@Override
public void handle() throws Exception {
this.client.sendResponse(new BadgePointLimitsComposer());
}
}

View File

@ -0,0 +1,33 @@
package com.eu.habbo.messages.incoming.users;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.unknown.IgnoredUsersComposer;
import gnu.trove.list.array.TIntArrayList;
import java.util.ArrayList;
public class GetIgnoredUsersEvent extends MessageHandler {
ArrayList<String> ignoredUsernames = new ArrayList<>();
@Override
public void handle() throws Exception {
Habbo habbo = this.client.getHabbo();
if(habbo == null) return;
TIntArrayList ignoredUsersId = habbo.getHabboStats().getIgnoredUsers();
if (ignoredUsersId.size() > 0) {
int userId = ignoredUsersId.iterator().next();
HabboInfo user = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId);
if(user == null) user = HabboManager.getOfflineHabboInfo(userId);
if(user != null) ignoredUsernames.add(user.getUsername());
}
this.client.sendResponse(new IgnoredUsersComposer(ignoredUsernames));
}
}

View File

@ -9,10 +9,10 @@ import com.eu.habbo.messages.outgoing.Outgoing;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure;
public class InventoryAchievementsComposer extends MessageComposer {
public class BadgePointLimitsComposer extends MessageComposer {
@Override
protected ServerMessage composeInternal() {
this.response.init(Outgoing.InventoryAchievementsComposer);
this.response.init(Outgoing.BadgePointLimitsComposer);
synchronized (Emulator.getGameEnvironment().getAchievementManager().getAchievements()) {
THashMap<String, Achievement> achievements = Emulator.getGameEnvironment().getAchievementManager().getAchievements();
@ -21,12 +21,12 @@ public class InventoryAchievementsComposer extends MessageComposer {
achievements.forEachValue(new TObjectProcedure<Achievement>() {
@Override
public boolean execute(Achievement achievement) {
InventoryAchievementsComposer.this.response.appendString((achievement.name.startsWith("ACH_") ? achievement.name.replace("ACH_", "") : achievement.name));
InventoryAchievementsComposer.this.response.appendInt(achievement.levels.size());
BadgePointLimitsComposer.this.response.appendString((achievement.name.startsWith("ACH_") ? achievement.name.replace("ACH_", "") : achievement.name));
BadgePointLimitsComposer.this.response.appendInt(achievement.levels.size());
for (AchievementLevel level : achievement.levels.values()) {
InventoryAchievementsComposer.this.response.appendInt(level.level);
InventoryAchievementsComposer.this.response.appendInt(level.progress);
BadgePointLimitsComposer.this.response.appendInt(level.level);
BadgePointLimitsComposer.this.response.appendInt(level.progress);
}
return true;