Arcturus-Community/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java

40 lines
1.3 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.messages.outgoing.users;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
2020-05-04 22:24:09 +02:00
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
2018-07-06 15:30:00 +02:00
2019-05-26 20:14:53 +02:00
public class UserCurrencyComposer extends MessageComposer {
2020-05-04 22:24:09 +02:00
private static final Logger LOGGER = LoggerFactory.getLogger(UserCurrencyComposer.class);
2018-07-06 15:30:00 +02:00
private final Habbo habbo;
2019-05-26 20:14:53 +02:00
public UserCurrencyComposer(Habbo habbo) {
2018-07-06 15:30:00 +02:00
this.habbo = habbo;
}
@Override
protected ServerMessage composeInternal() {
2018-07-06 15:30:00 +02:00
this.response.init(Outgoing.UserCurrencyComposer);
String[] pointsTypes = Emulator.getConfig().getValue("seasonal.types").split(";");
this.response.appendInt(pointsTypes.length);
2019-05-26 20:14:53 +02:00
for (String s : pointsTypes) {
2019-03-18 02:22:00 +01:00
int type;
2019-05-26 20:14:53 +02:00
try {
2018-07-06 15:30:00 +02:00
type = Integer.valueOf(s);
2019-05-26 20:14:53 +02:00
} catch (Exception e) {
2020-05-04 22:24:09 +02:00
LOGGER.error("Caught exception", e);
2018-07-06 15:30:00 +02:00
return null;
}
this.response.appendInt(type);
this.response.appendInt(this.habbo.getHabboInfo().getCurrencyAmount(type));
}
return this.response;
}
}