Disconnect client by throwing exception in handler
This makes it easier to add checks in handlers, which should improve security over time. I think this approach is more readable and testable than calling Client#disconnect straight up, while it also decentralizes the handling.
This commit is contained in:
@@ -28,6 +28,7 @@ import constants.game.GameConstants;
|
||||
import constants.id.MapId;
|
||||
import constants.skills.*;
|
||||
import database.drop.DropProvider;
|
||||
import net.netty.GameViolationException;
|
||||
import net.packet.InPacket;
|
||||
import server.StatEffect;
|
||||
import tools.PacketCreator;
|
||||
@@ -56,12 +57,8 @@ public final class CloseRangeDamageHandler extends AbstractDealDamageHandler {
|
||||
chr.getAutobanManager().spam(8);*/
|
||||
|
||||
AttackInfo attack = parseDamage(p, chr, false, false);
|
||||
if (chr.getBuffEffect(BuffStat.MORPH) != null) {
|
||||
if (chr.getBuffEffect(BuffStat.MORPH).isMorphWithoutAttack()) {
|
||||
// How are they attacking when the client won't let them?
|
||||
chr.getClient().disconnect(false, false);
|
||||
return;
|
||||
}
|
||||
if (chr.getBuffEffect(BuffStat.MORPH) != null && chr.getBuffEffect(BuffStat.MORPH).isMorphWithoutAttack()) {
|
||||
throw new GameViolationException("Attempt to attack with morph skill that disallows attacking");
|
||||
}
|
||||
|
||||
if (chr.getDojoEnergy() < 10000 && (attack.skill == 1009 || attack.skill == 10001009 || attack.skill == 20001009)) // PE hacking or maybe just lagging
|
||||
|
||||
Reference in New Issue
Block a user