Added two new plugin events - UserRespectedEvent and HabboAddedToRoomEvent

This commit is contained in:
Beny 2019-05-20 18:35:20 +01:00
parent 1c73aa27a8
commit ecf04c488d
4 changed files with 47 additions and 0 deletions

View File

@ -41,8 +41,10 @@ import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetComposer;
import com.eu.habbo.messages.outgoing.rooms.promotions.RoomPromotionMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.users.*;
import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer;
import com.eu.habbo.plugin.PluginManager;
import com.eu.habbo.plugin.events.navigator.NavigatorRoomCreatedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUncachedEvent;
import com.eu.habbo.plugin.events.users.HabboAddedToRoomEvent;
import com.eu.habbo.plugin.events.users.UserEnterRoomEvent;
import com.eu.habbo.plugin.events.users.UserExitRoomEvent;
import gnu.trove.iterator.TIntObjectIterator;
@ -50,6 +52,7 @@ import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TIntProcedure;
import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
import sun.plugin2.main.server.Plugin;
import java.sql.*;
import java.util.*;
@ -1072,6 +1075,10 @@ public class RoomManager
{
UserNuxEvent.handle(habbo);
}
if(Emulator.getPluginManager().isRegistered(HabboAddedToRoomEvent.class, false)) {
Emulator.getPluginManager().fireEvent(new HabboAddedToRoomEvent(habbo, room));
}
}
void logEnter(Habbo habbo, Room room)

View File

@ -1,7 +1,9 @@
package com.eu.habbo.messages.incoming.rooms.users;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.plugin.events.users.UserRespectedEvent;
public class RoomUserGiveRespectEvent extends MessageHandler
{
@ -14,6 +16,11 @@ public class RoomUserGiveRespectEvent extends MessageHandler
{
Habbo target = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(userId);
if(Emulator.getPluginManager().isRegistered(UserRespectedEvent.class, false)) {
if(Emulator.getPluginManager().fireEvent(new UserRespectedEvent(target, this.client.getHabbo())).isCancelled())
return;
}
this.client.getHabbo().respect(target);
}
}

View File

@ -0,0 +1,18 @@
package com.eu.habbo.plugin.events.users;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
public class HabboAddedToRoomEvent extends UserEvent
{
public final Room room;
public HabboAddedToRoomEvent(Habbo habbo, Room room)
{
super(habbo);
this.room = room;
}
}

View File

@ -0,0 +1,15 @@
package com.eu.habbo.plugin.events.users;
import com.eu.habbo.habbohotel.users.Habbo;
public class UserRespectedEvent extends UserEvent
{
public final Habbo from;
public UserRespectedEvent(Habbo habbo, Habbo from)
{
super(habbo);
this.from = from;
}
}