Merge branch 'username_talk_event' into 'dev'

Username Talk Plugin Event

See merge request morningstar/Arcturus-Community!240
This commit is contained in:
Harmonic 2020-07-06 16:29:28 -04:00
commit bd09f5b419
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.RoomLoadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent; import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadingEvent; import com.eu.habbo.plugin.events.rooms.RoomUnloadingEvent;
import com.eu.habbo.plugin.events.users.UserExitRoomEvent; import com.eu.habbo.plugin.events.users.*;
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.threading.runnables.YouAreAPirate; import com.eu.habbo.threading.runnables.YouAreAPirate;
import gnu.trove.TCollections; import gnu.trove.TCollections;
import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.iterator.TIntObjectIterator;
@ -3115,7 +3112,18 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
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; ServerMessage clearPrefixMessage = prefixMessage != null ? new RoomUserNameChangedComposer(habbo).compose() : null;
Rectangle show = this.roomSpecialTypes.tentAt(habbo.getRoomUnit().getCurrentLocation()); 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;
}
}