diff --git a/src/main/java/client/MapleClient.java b/src/main/java/client/MapleClient.java
index 10d9764b62..ec8643cd04 100644
--- a/src/main/java/client/MapleClient.java
+++ b/src/main/java/client/MapleClient.java
@@ -31,7 +31,7 @@ import net.MaplePacketHandler;
import net.PacketProcessor;
import net.netty.InvalidPacketHeaderException;
import net.packet.logging.LoggingUtil;
-import net.packet.logging.PacketLogger;
+import net.packet.logging.MapleLogger;
import net.packet.ByteBufOutPacket;
import net.packet.InPacket;
import net.packet.OutPacket;
@@ -189,9 +189,10 @@ public class MapleClient extends ChannelInboundHandlerAdapter {
if (handler != null && handler.validateState(this)) {
// TODO: pass InPacket directly to handler once all handlers have been ported,
// this is just a temporary workaround
- GenericSeekableLittleEndianAccessor accessor = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(packet.getBytes()));
+ final byte[] content = packet.getBytes();
+ GenericSeekableLittleEndianAccessor accessor = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(content));
try {
- MapleLogger.logRecv(this, opcode, msg);
+ MapleLogger.logRecv(this, opcode, content);
handler.handlePacket(accessor, this);
} catch (final Throwable t) {
FilePrinter.printError(FilePrinter.PACKET_HANDLER + handler.getClass().getName() + ".txt", t, "Error for " + (getPlayer() == null ? "" : "player ; " + getPlayer() + " on map ; " + getPlayer().getMapId() + " - ") + "account ; " + getAccountName() + "\r\n" + accessor);
diff --git a/src/main/java/client/autoban/AutobanFactory.java b/src/main/java/client/autoban/AutobanFactory.java
index dbca257ea4..8f65f5463e 100644
--- a/src/main/java/client/autoban/AutobanFactory.java
+++ b/src/main/java/client/autoban/AutobanFactory.java
@@ -26,7 +26,7 @@ import client.MapleCharacter;
import config.YamlConfig;
import net.server.Server;
import tools.FilePrinter;
-import tools.MapleLogger;
+import net.packet.logging.MapleLogger;
import tools.MaplePacketCreator;
/**
diff --git a/src/main/java/client/command/commands/gm3/IgnoreCommand.java b/src/main/java/client/command/commands/gm3/IgnoreCommand.java
index 4fc0ceb168..226e63c323 100644
--- a/src/main/java/client/command/commands/gm3/IgnoreCommand.java
+++ b/src/main/java/client/command/commands/gm3/IgnoreCommand.java
@@ -27,7 +27,7 @@ import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
import net.server.Server;
-import tools.MapleLogger;
+import net.packet.logging.MapleLogger;
import tools.MaplePacketCreator;
public class IgnoreCommand extends Command {
diff --git a/src/main/java/client/command/commands/gm3/IgnoredCommand.java b/src/main/java/client/command/commands/gm3/IgnoredCommand.java
index f15617e6dc..daf704699d 100644
--- a/src/main/java/client/command/commands/gm3/IgnoredCommand.java
+++ b/src/main/java/client/command/commands/gm3/IgnoredCommand.java
@@ -26,7 +26,7 @@ package client.command.commands.gm3;
import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
-import tools.MapleLogger;
+import net.packet.logging.MapleLogger;
public class IgnoredCommand extends Command {
{
diff --git a/src/main/java/client/command/commands/gm3/MonitorCommand.java b/src/main/java/client/command/commands/gm3/MonitorCommand.java
index 89aa250421..0a82ce454b 100644
--- a/src/main/java/client/command/commands/gm3/MonitorCommand.java
+++ b/src/main/java/client/command/commands/gm3/MonitorCommand.java
@@ -27,7 +27,7 @@ import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
import net.server.Server;
-import tools.MapleLogger;
+import net.packet.logging.MapleLogger;
import tools.MaplePacketCreator;
public class MonitorCommand extends Command {
diff --git a/src/main/java/client/command/commands/gm3/MonitorsCommand.java b/src/main/java/client/command/commands/gm3/MonitorsCommand.java
index 2a72da5ed5..97fd37a9d4 100644
--- a/src/main/java/client/command/commands/gm3/MonitorsCommand.java
+++ b/src/main/java/client/command/commands/gm3/MonitorsCommand.java
@@ -26,7 +26,7 @@ package client.command.commands.gm3;
import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
-import tools.MapleLogger;
+import net.packet.logging.MapleLogger;
public class MonitorsCommand extends Command {
{
diff --git a/src/main/java/net/netty/ClientCyphers.java b/src/main/java/net/encryption/ClientCyphers.java
similarity index 94%
rename from src/main/java/net/netty/ClientCyphers.java
rename to src/main/java/net/encryption/ClientCyphers.java
index 6e46fb80ca..13c09292dd 100644
--- a/src/main/java/net/netty/ClientCyphers.java
+++ b/src/main/java/net/encryption/ClientCyphers.java
@@ -1,7 +1,6 @@
-package net.netty;
+package net.encryption;
import constants.net.ServerConstants;
-import tools.MapleAESOFB;
public class ClientCyphers {
private final MapleAESOFB send;
diff --git a/src/main/java/net/netty/InitializationVector.java b/src/main/java/net/encryption/InitializationVector.java
similarity index 96%
rename from src/main/java/net/netty/InitializationVector.java
rename to src/main/java/net/encryption/InitializationVector.java
index 22cd624db1..fb5edaa7b5 100644
--- a/src/main/java/net/netty/InitializationVector.java
+++ b/src/main/java/net/encryption/InitializationVector.java
@@ -1,4 +1,4 @@
-package net.netty;
+package net.encryption;
public class InitializationVector {
private final byte[] bytes;
diff --git a/src/main/java/tools/MapleAESOFB.java b/src/main/java/net/encryption/MapleAESOFB.java
similarity index 99%
rename from src/main/java/tools/MapleAESOFB.java
rename to src/main/java/net/encryption/MapleAESOFB.java
index 3b1bd1e809..96ab7d52bb 100644
--- a/src/main/java/tools/MapleAESOFB.java
+++ b/src/main/java/net/encryption/MapleAESOFB.java
@@ -19,11 +19,11 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
-package tools;
+package net.encryption;
-import net.netty.InitializationVector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import tools.HexTool;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
diff --git a/src/main/java/net/netty/PacketCodec.java b/src/main/java/net/encryption/PacketCodec.java
similarity index 93%
rename from src/main/java/net/netty/PacketCodec.java
rename to src/main/java/net/encryption/PacketCodec.java
index 6292096711..e3541cc734 100644
--- a/src/main/java/net/netty/PacketCodec.java
+++ b/src/main/java/net/encryption/PacketCodec.java
@@ -1,4 +1,4 @@
-package net.netty;
+package net.encryption;
import io.netty.channel.CombinedChannelDuplexHandler;
diff --git a/src/main/java/net/netty/PacketDecoder.java b/src/main/java/net/encryption/PacketDecoder.java
similarity index 95%
rename from src/main/java/net/netty/PacketDecoder.java
rename to src/main/java/net/encryption/PacketDecoder.java
index 748df78de1..cec48f5bcb 100644
--- a/src/main/java/net/netty/PacketDecoder.java
+++ b/src/main/java/net/encryption/PacketDecoder.java
@@ -1,12 +1,12 @@
-package net.netty;
+package net.encryption;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ReplayingDecoder;
import net.MapleCustomEncryption;
+import net.netty.InvalidPacketHeaderException;
import net.packet.ByteBufInPacket;
-import tools.MapleAESOFB;
import java.util.List;
diff --git a/src/main/java/net/netty/PacketEncoder.java b/src/main/java/net/encryption/PacketEncoder.java
similarity index 94%
rename from src/main/java/net/netty/PacketEncoder.java
rename to src/main/java/net/encryption/PacketEncoder.java
index f3156d8591..7a297116c6 100644
--- a/src/main/java/net/netty/PacketEncoder.java
+++ b/src/main/java/net/encryption/PacketEncoder.java
@@ -1,11 +1,10 @@
-package net.netty;
+package net.encryption;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import net.MapleCustomEncryption;
import net.packet.OutPacket;
-import tools.MapleAESOFB;
public class PacketEncoder extends MessageToByteEncoder {
private final MapleAESOFB sendCypher;
diff --git a/src/main/java/net/netty/ServerChannelInitializer.java b/src/main/java/net/netty/ServerChannelInitializer.java
index e4705922b0..9d9f0c6e78 100644
--- a/src/main/java/net/netty/ServerChannelInitializer.java
+++ b/src/main/java/net/netty/ServerChannelInitializer.java
@@ -9,6 +9,9 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;
+import net.encryption.ClientCyphers;
+import net.encryption.InitializationVector;
+import net.encryption.PacketCodec;
import net.packet.logging.InPacketLogger;
import net.packet.logging.OutPacketLogger;
import tools.MaplePacketCreator;
diff --git a/src/main/java/net/packet/logging/MapleLogger.java b/src/main/java/net/packet/logging/MapleLogger.java
new file mode 100644
index 0000000000..68ccc002b4
--- /dev/null
+++ b/src/main/java/net/packet/logging/MapleLogger.java
@@ -0,0 +1,72 @@
+/*
+ This file is part of the OdinMS Maple Story Server
+ Copyright (C) 2008 ~ 2010 Patrick Huy
+ Matthias Butz
+ Jan Christian Meyer
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License version 3
+ as published by the Free Software Foundation. You may not use, modify
+ or distribute this program under any other version of the
+ GNU Affero General Public License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+ */
+package net.packet.logging;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import net.opcodes.RecvOpcode;
+import client.MapleCharacter;
+import client.MapleClient;
+import tools.FilePrinter;
+import tools.HexTool;
+
+/**
+ * Logs packets to console and file.
+ *
+ * @author Alan (SharpAceX)
+ */
+
+public class MapleLogger {
+ public static final Set monitored = new HashSet<>();
+ public static final Set ignored = new HashSet<>();
+
+ public static void logRecv(MapleClient c, short packetId, byte[] packetContent) {
+ MapleCharacter chr = c.getPlayer();
+ if (chr == null) {
+ return;
+ }
+ if (!monitored.contains(chr.getId())) {
+ return;
+ }
+ RecvOpcode op = getOpcodeFromValue(packetId);
+ if (isRecvBlocked(op)) {
+ return;
+ }
+ String packet = op + "\r\n" + HexTool.toString(packetContent);
+ FilePrinter.printError(FilePrinter.PACKET_LOGS + c.getAccountName() + "-" + chr.getName() + ".txt", packet);
+ }
+
+ private static boolean isRecvBlocked(RecvOpcode op) {
+ return switch (op) {
+ case MOVE_PLAYER, GENERAL_CHAT, TAKE_DAMAGE, MOVE_PET, MOVE_LIFE, NPC_ACTION, FACE_EXPRESSION -> true;
+ default -> false;
+ };
+ }
+
+ private static RecvOpcode getOpcodeFromValue(int value) {
+ return Arrays.stream(RecvOpcode.values())
+ .filter(opcode -> value == opcode.getValue())
+ .findAny()
+ .orElse(null);
+ }
+}
diff --git a/src/main/java/tools/MapleLogger.java b/src/main/java/tools/MapleLogger.java
deleted file mode 100644
index 7f2f0b8a6e..0000000000
--- a/src/main/java/tools/MapleLogger.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- This file is part of the OdinMS Maple Story Server
- Copyright (C) 2008 ~ 2010 Patrick Huy
- Matthias Butz
- Jan Christian Meyer
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License version 3
- as published by the Free Software Foundation. You may not use, modify
- or distribute this program under any other version of the
- GNU Affero General Public License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
- */
-package tools;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import net.opcodes.RecvOpcode;
-import client.MapleCharacter;
-import client.MapleClient;
-
-/**
- * Logs packets to console and file.
- *
- * @author Alan (SharpAceX)
- */
-
-public class MapleLogger {
-
- public static Set monitored = new HashSet<>();
- public static Set ignored = new HashSet<>();
-
- public static void logRecv(MapleClient c, short packetId, Object message) {
- MapleCharacter chr = c.getPlayer();
- if (chr == null){
- return;
- }
- if (!monitored.contains(chr.getId())){
- return;
- }
- RecvOpcode op = getOpcodeFromValue(packetId);
- if (isRecvBlocked(op)){
- return;
- }
- String packet = op.toString() + "\r\n" + HexTool.toString((byte[]) message);
- FilePrinter.printError(FilePrinter.PACKET_LOGS + c.getAccountName() + "-" + chr.getName() + ".txt", packet);
- }
-
- private static final boolean isRecvBlocked(RecvOpcode op){
- switch(op){
- case MOVE_PLAYER:
- case GENERAL_CHAT:
- case TAKE_DAMAGE:
- case MOVE_PET:
- case MOVE_LIFE:
- case NPC_ACTION:
- case FACE_EXPRESSION:
- return true;
- default:
- return false;
- }
- }
-
- private static final RecvOpcode getOpcodeFromValue(int value){
- for (RecvOpcode op : RecvOpcode.values()){
- if (op.getValue() == value){
- return op;
- }
- }
- return null;
- }
-}
diff --git a/src/main/java/tools/MaplePacketCreator.java b/src/main/java/tools/MaplePacketCreator.java
index 1f163c2efd..c84994030b 100644
--- a/src/main/java/tools/MaplePacketCreator.java
+++ b/src/main/java/tools/MaplePacketCreator.java
@@ -36,7 +36,7 @@ import constants.inventory.ItemConstants;
import constants.skills.Buccaneer;
import constants.skills.Corsair;
import constants.skills.ThunderBreaker;
-import net.netty.InitializationVector;
+import net.encryption.InitializationVector;
import net.opcodes.SendOpcode;
import net.server.PlayerCoolDownValueHolder;
import net.server.Server;