2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.messages.incoming.rooms;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
2019-03-18 02:22:00 +01:00
|
|
|
import com.eu.habbo.habbohotel.navigation.NavigatorPublicCategory;
|
2018-07-06 15:30:00 +02:00
|
|
|
import com.eu.habbo.habbohotel.rooms.Room;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
|
|
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
|
|
|
import com.eu.habbo.messages.outgoing.rooms.RoomDataComposer;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public class RoomStaffPickEvent extends MessageHandler {
|
2018-07-06 15:30:00 +02:00
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public void handle() throws Exception {
|
|
|
|
if (this.client.getHabbo().hasPermission("acc_staff_pick")) {
|
2018-07-06 15:30:00 +02:00
|
|
|
int roomId = this.packet.readInt();
|
|
|
|
|
|
|
|
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
if (room != null) {
|
2018-07-06 15:30:00 +02:00
|
|
|
room.setStaffPromotedRoom(!room.isStaffPromotedRoom());
|
|
|
|
room.setNeedsUpdate(true);
|
|
|
|
|
2019-03-18 02:22:00 +01:00
|
|
|
NavigatorPublicCategory publicCategory = Emulator.getGameEnvironment().getNavigatorManager().publicCategories.get(Emulator.getConfig().getInt("hotel.navigator.staffpicks.categoryid"));
|
2019-05-26 20:14:53 +02:00
|
|
|
if (room.isStaffPromotedRoom()) {
|
2018-07-06 15:30:00 +02:00
|
|
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(room.getOwnerId());
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
if (habbo != null) {
|
2018-07-06 15:30:00 +02:00
|
|
|
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("Spr"));
|
|
|
|
}
|
2019-03-18 02:22:00 +01:00
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
if (publicCategory != null) {
|
2019-03-18 02:22:00 +01:00
|
|
|
publicCategory.addRoom(room);
|
|
|
|
}
|
2019-05-26 20:14:53 +02:00
|
|
|
} else {
|
|
|
|
if (publicCategory != null) {
|
2019-03-18 02:22:00 +01:00
|
|
|
publicCategory.removeRoom(room);
|
|
|
|
}
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
2019-03-18 02:22:00 +01:00
|
|
|
this.client.sendResponse(new RoomDataComposer(room, this.client.getHabbo(), true, false));
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|