mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 08:50:51 +01:00
Add annotation to mark messages that don't need auth
This commit is contained in:
parent
3f845f38cc
commit
9f8850b0bd
7
src/main/java/com/eu/habbo/messages/NoAuthMessage.java
Normal file
7
src/main/java/com/eu/habbo/messages/NoAuthMessage.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package com.eu.habbo.messages;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface NoAuthMessage {}
|
@ -156,11 +156,20 @@ public class PacketManager {
|
|||||||
if (client == null || Emulator.isShuttingDown)
|
if (client == null || Emulator.isShuttingDown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (client.getHabbo() == null && !(packet.getMessageId() == Incoming.SecureLoginEvent || packet.getMessageId() == Incoming.MachineIDEvent))
|
|
||||||
return;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.isRegistered(packet.getMessageId())) {
|
if (this.isRegistered(packet.getMessageId())) {
|
||||||
|
Class<? extends MessageHandler> handlerClass = this.incoming.get(packet.getMessageId());
|
||||||
|
|
||||||
|
if (handlerClass == null) throw new Exception("Unknown message " + packet.getMessageId());
|
||||||
|
|
||||||
|
if (client.getHabbo() == null && !handlerClass.isAnnotationPresent(NoAuthMessage.class)) {
|
||||||
|
if (DEBUG_SHOW_PACKETS) {
|
||||||
|
Emulator.getLogging().logPacketLine("[\033[36mCLIENT\033[0m][\033[33mNOT LOGGED IN\033[0m][" + packet.getMessageId() + "] => " + packet.getMessageBody());
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (PacketManager.DEBUG_SHOW_PACKETS)
|
if (PacketManager.DEBUG_SHOW_PACKETS)
|
||||||
Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "] => " + packet.getMessageBody());
|
Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "] => " + packet.getMessageBody());
|
||||||
|
|
||||||
@ -168,7 +177,7 @@ public class PacketManager {
|
|||||||
System.out.println(("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + client.getHabbo().getHabboInfo().getUsername() + "][" + packet.getMessageId() + "] => " + packet.getMessageBody()));
|
System.out.println(("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + client.getHabbo().getHabboInfo().getUsername() + "][" + packet.getMessageId() + "] => " + packet.getMessageBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
final MessageHandler handler = this.incoming.get(packet.getMessageId()).newInstance();
|
final MessageHandler handler = handlerClass.newInstance();
|
||||||
|
|
||||||
handler.client = client;
|
handler.client = client;
|
||||||
handler.packet = packet;
|
handler.packet = packet;
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.eu.habbo.messages.incoming.handshake;
|
package com.eu.habbo.messages.incoming.handshake;
|
||||||
|
|
||||||
|
import com.eu.habbo.messages.NoAuthMessage;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.handshake.MachineIDComposer;
|
import com.eu.habbo.messages.outgoing.handshake.MachineIDComposer;
|
||||||
|
|
||||||
|
@NoAuthMessage
|
||||||
public class MachineIDEvent extends MessageHandler {
|
public class MachineIDEvent extends MessageHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.eu.habbo.messages.incoming.handshake;
|
package com.eu.habbo.messages.incoming.handshake;
|
||||||
|
|
||||||
|
import com.eu.habbo.messages.NoAuthMessage;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
|
||||||
|
@NoAuthMessage
|
||||||
public class ReleaseVersionEvent extends MessageHandler {
|
public class ReleaseVersionEvent extends MessageHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch;
|
|||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||||
|
import com.eu.habbo.messages.NoAuthMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.achievements.AchievementListComposer;
|
import com.eu.habbo.messages.outgoing.achievements.AchievementListComposer;
|
||||||
@ -31,6 +32,7 @@ import com.eu.habbo.plugin.events.users.UserLoginEvent;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@NoAuthMessage
|
||||||
public class SecureLoginEvent extends MessageHandler {
|
public class SecureLoginEvent extends MessageHandler {
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user