Username Talk Plugin Event

This commit is contained in:
ArpyAge 2020-06-08 17:46:19 +02:00
parent 62ab54a3e3
commit f18529c3df
2 changed files with 44 additions and 5 deletions

View File

@ -54,10 +54,7 @@ import com.eu.habbo.plugin.events.furniture.*;
import com.eu.habbo.plugin.events.rooms.RoomLoadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadingEvent;
import com.eu.habbo.plugin.events.users.UserExitRoomEvent;
import com.eu.habbo.plugin.events.users.UserIdleEvent;
import com.eu.habbo.plugin.events.users.UserRightsTakenEvent;
import com.eu.habbo.plugin.events.users.UserRolledEvent;
import com.eu.habbo.plugin.events.users.*;
import com.eu.habbo.threading.runnables.YouAreAPirate;
import gnu.trove.TCollections;
import gnu.trove.iterator.TIntObjectIterator;
@ -3110,7 +3107,18 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
habbo.getHabboStats().chatCounter += 2;
ServerMessage prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new RoomUserNameChangedComposer(habbo, true).compose() : null;
ServerMessage prefixMessage = null;
if (Emulator.getPluginManager().isRegistered(UsernameTalkEvent.class, true)) {
UsernameTalkEvent usernameTalkEvent = (UsernameTalkEvent) Emulator.getPluginManager().fireEvent(new UsernameTalkEvent(habbo, roomChatMessage, chatType));
if (usernameTalkEvent.hasCustomComposer()) {
prefixMessage = usernameTalkEvent.getCustomComposer();
}
}
if(prefixMessage != null) {
prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new RoomUserNameChangedComposer(habbo, true).compose() : null;
}
ServerMessage clearPrefixMessage = prefixMessage != null ? new RoomUserNameChangedComposer(habbo).compose() : null;
Rectangle show = this.roomSpecialTypes.tentAt(habbo.getRoomUnit().getCurrentLocation());

View File

@ -0,0 +1,31 @@
package com.eu.habbo.plugin.events.users;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatType;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
public class UsernameTalkEvent extends UserEvent {
public final RoomChatMessage chatMessage;
public final RoomChatType chatType;
private ServerMessage customComposer = null;
public UsernameTalkEvent(Habbo habbo, RoomChatMessage chatMessage, RoomChatType chatType) {
super(habbo);
this.chatMessage = chatMessage;
this.chatType = chatType;
}
public void setCustomComposer(ServerMessage customComposer) {
this.customComposer = customComposer;
}
public boolean hasCustomComposer() {
return this.customComposer != null;
}
public ServerMessage getCustomComposer() {
return this.customComposer;
}
}