Arcturus-Community/src/main/java/com/eu/habbo/messages/rcon/SetRank.java

40 lines
946 B
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.messages.rcon;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.google.gson.Gson;
2019-05-26 20:14:53 +02:00
public class SetRank extends RCONMessage<SetRank.JSONSetRank> {
2018-07-08 23:32:00 +02:00
2019-05-26 20:14:53 +02:00
public SetRank() {
2018-07-06 15:30:00 +02:00
super(JSONSetRank.class);
}
@Override
2019-05-26 20:14:53 +02:00
public void handle(Gson gson, JSONSetRank object) {
try {
2018-07-06 15:30:00 +02:00
Emulator.getGameEnvironment().getHabboManager().setRank(object.user_id, object.rank);
2019-05-26 20:14:53 +02:00
} catch (Exception e) {
2018-07-06 15:30:00 +02:00
this.status = RCONMessage.SYSTEM_ERROR;
this.message = "invalid rank";
return;
}
this.message = "updated offline user";
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(object.user_id);
2019-05-26 20:14:53 +02:00
if (habbo != null) {
2018-07-06 15:30:00 +02:00
this.message = "updated online user";
}
}
2019-05-26 20:14:53 +02:00
static class JSONSetRank {
2018-10-07 00:28:00 +02:00
2018-07-06 15:30:00 +02:00
public int user_id;
2018-10-07 00:28:00 +02:00
2018-07-06 15:30:00 +02:00
public int rank;
}
}