Reformat and clean up "net" package

This commit is contained in:
P0nk
2021-09-09 23:26:02 +02:00
parent 69f4580637
commit 6be6ea9927
235 changed files with 3556 additions and 3398 deletions

View File

@@ -29,23 +29,22 @@ import net.packet.InPacket;
import tools.PacketCreator;
/**
*
* @author Matze
*/
public final class ItemMoveHandler extends AbstractPacketHandler {
@Override
public final void handlePacket(InPacket p, Client c) {
p.skip(4);
if(c.getPlayer().getAutobanManager().getLastSpam(6) + 300 > currentServerTime()) {
if (c.getPlayer().getAutobanManager().getLastSpam(6) + 300 > currentServerTime()) {
c.sendPacket(PacketCreator.enableActions());
return;
}
InventoryType type = InventoryType.getByType(p.readByte());
short src = p.readShort(); //is there any reason to use byte instead of short in src and action?
short action = p.readShort();
short quantity = p.readShort();
if (src < 0 && action > 0) {
InventoryManipulator.unequip(c, src, action);
} else if (action < 0) {
@@ -55,8 +54,10 @@ public final class ItemMoveHandler extends AbstractPacketHandler {
} else {
InventoryManipulator.move(c, type, src, action);
}
if (c.getPlayer().getMap().getHPDec() > 0) c.getPlayer().resetHpDecreaseTask();
if (c.getPlayer().getMap().getHPDec() > 0) {
c.getPlayer().resetHpDecreaseTask();
}
c.getPlayer().getAutobanManager().spam(6);
}
}