You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
🆙 Add badge delete for inventory
This commit is contained in:
@@ -369,6 +369,7 @@ public class PacketManager {
|
||||
this.registerHandler(Incoming.HotelViewInventoryEvent, RequestInventoryItemsEvent.class);
|
||||
this.registerHandler(Incoming.RequestInventoryPetsEvent, RequestInventoryPetsEvent.class);
|
||||
this.registerHandler(Incoming.RequestInventoryPetDelete, RequestInventoryPetDelete.class);
|
||||
this.registerHandler(Incoming.RequestInventoryBadgeDelete, RequestInventoryBadgeDelete.class);
|
||||
}
|
||||
|
||||
void registerRooms() throws Exception {
|
||||
|
||||
@@ -408,4 +408,5 @@ public class Incoming {
|
||||
// CUSTOM
|
||||
public static final int UpdateFurniturePositionEvent = 10019;
|
||||
public static final int RequestInventoryPetDelete = 10030;
|
||||
public static final int RequestInventoryBadgeDelete = 10031;
|
||||
}
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.eu.habbo.messages.incoming.inventory;
|
||||
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboBadge;
|
||||
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.inventory.InventoryBadgesComposer;
|
||||
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
|
||||
|
||||
public class RequestInventoryBadgeDelete extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() {
|
||||
final String badgeCode = this.packet.readString();
|
||||
final Habbo habbo = this.client.getHabbo();
|
||||
|
||||
if (habbo == null || badgeCode == null || badgeCode.isEmpty())
|
||||
return;
|
||||
|
||||
final HabboBadge badge = habbo.getInventory().getBadgesComponent().removeBadge(badgeCode);
|
||||
|
||||
if (badge == null)
|
||||
return;
|
||||
|
||||
BadgesComponent.deleteBadge(habbo.getHabboInfo().getId(), badge.getCode());
|
||||
|
||||
this.client.sendResponse(new InventoryBadgesComposer(habbo));
|
||||
|
||||
if (habbo.getHabboInfo().getCurrentRoom() != null)
|
||||
habbo.getHabboInfo().getCurrentRoom().sendComposer(new UserBadgesComposer(habbo.getInventory().getBadgesComponent().getWearingBadges(), habbo.getHabboInfo().getId()).compose());
|
||||
else
|
||||
this.client.sendResponse(new UserBadgesComposer(habbo.getInventory().getBadgesComponent().getWearingBadges(), habbo.getHabboInfo().getId()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user