Merge branch 'patch-furniture-toggle-event' into 'dev'

Furniture Toggle Event

See merge request morningstar/Arcturus-Community!347
This commit is contained in:
Harmonic 2020-12-29 11:10:28 -05:00
commit e54b4e69c2
3 changed files with 31 additions and 0 deletions

View File

@ -11,6 +11,9 @@ import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
import com.eu.habbo.messages.outgoing.rooms.pets.PetPackageComposer; import com.eu.habbo.messages.outgoing.rooms.pets.PetPackageComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.plugin.Event;
import com.eu.habbo.plugin.events.furniture.FurniturePickedUpEvent;
import com.eu.habbo.plugin.events.furniture.FurnitureToggleEvent;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -34,6 +37,12 @@ public class ToggleFloorItemEvent extends MessageHandler {
if (item == null || item instanceof InteractionDice) if (item == null || item instanceof InteractionDice)
return; return;
Event furnitureToggleEvent = new FurnitureToggleEvent(item, this.client.getHabbo(), state);
Emulator.getPluginManager().fireEvent(furnitureToggleEvent);
if (furnitureToggleEvent.isCancelled())
return;
/* /*
if (item.getBaseItem().getName().equalsIgnoreCase("totem_planet")) { if (item.getBaseItem().getName().equalsIgnoreCase("totem_planet")) {
THashSet<HabboItem> items = room.getItemsAt(room.getLayout().getTile(item.getX(), item.getY())); THashSet<HabboItem> items = room.getItemsAt(room.getLayout().getTile(item.getX(), item.getY()));

View File

@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.plugin.Event;
import com.eu.habbo.plugin.events.furniture.FurnitureToggleEvent;
public class ToggleWallItemEvent extends MessageHandler { public class ToggleWallItemEvent extends MessageHandler {
@Override @Override
@ -21,6 +23,12 @@ public class ToggleWallItemEvent extends MessageHandler {
if (item == null) if (item == null)
return; return;
Event furnitureToggleEvent = new FurnitureToggleEvent(item, this.client.getHabbo(), state);
Emulator.getPluginManager().fireEvent(furnitureToggleEvent);
if (furnitureToggleEvent.isCancelled())
return;
if (item.getBaseItem().getName().equalsIgnoreCase("poster")) if (item.getBaseItem().getName().equalsIgnoreCase("poster"))
return; return;

View File

@ -0,0 +1,14 @@
package com.eu.habbo.plugin.events.furniture;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
public class FurnitureToggleEvent extends FurnitureUserEvent {
public int state;
public FurnitureToggleEvent(HabboItem furniture, Habbo habbo, int state) {
super(furniture, habbo);
this.state = state;
}
}