Commit dde5a609 authored by coooookies's avatar coooookies Committed by Melledy
Browse files

GameServerPacketHandler need to be added a registration interface for plugin developers

parent 677aa2d2
...@@ -22,7 +22,11 @@ public class GameServerPacketHandler { ...@@ -22,7 +22,11 @@ public class GameServerPacketHandler {
this.registerHandlers(handlerClass); this.registerHandlers(handlerClass);
} }
public void registerPacketHandler(int opcode, PacketHandler handler) {
this.handlers.put(opcode, handler);
}
public void registerHandlers(Class<? extends PacketHandler> handlerClass) { public void registerHandlers(Class<? extends PacketHandler> handlerClass) {
Reflections reflections = new Reflections("emu.grasscutter.server.packet"); Reflections reflections = new Reflections("emu.grasscutter.server.packet");
Set<?> handlerClasses = reflections.getSubTypesOf(handlerClass); Set<?> handlerClasses = reflections.getSubTypesOf(handlerClass);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment