mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-27 14:13:11 +02:00
Catch NullPointerException.
This commit is contained in:
parent
bd24e12026
commit
d0235e2358
@ -107,19 +107,18 @@ public class UseEntityAdapter extends BaseAdapter {
|
|||||||
"checks", Arrays.asList(AttackFrequency.class.getSimpleName()));
|
"checks", Arrays.asList(AttackFrequency.class.getSimpleName()));
|
||||||
}
|
}
|
||||||
attackFrequency = new AttackFrequency();
|
attackFrequency = new AttackFrequency();
|
||||||
|
NCPAPIProvider.getNoCheatPlusAPI().addComponent(attackFrequency);
|
||||||
|
this.legacySet = getLegacyReflectionSet();
|
||||||
|
}
|
||||||
|
|
||||||
LegacyReflectionSet set = null;
|
private LegacyReflectionSet getLegacyReflectionSet() {
|
||||||
for (String versionDetail : new String[] {"v1_7_R4", "v1_7_R1"}) {
|
for (String versionDetail : new String[] {"v1_7_R4", "v1_7_R1"}) {
|
||||||
try {
|
try {
|
||||||
set = new LegacyReflectionSet(versionDetail);
|
return new LegacyReflectionSet(versionDetail);
|
||||||
if (set != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (RuntimeException e) {} // +-
|
catch (RuntimeException e) {} // +-
|
||||||
}
|
}
|
||||||
this.legacySet = set;
|
return null;
|
||||||
NCPAPIProvider.getNoCheatPlusAPI().addComponent(attackFrequency);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -158,11 +157,18 @@ public class UseEntityAdapter extends BaseAdapter {
|
|||||||
}
|
}
|
||||||
if (!packetInterpreted) {
|
if (!packetInterpreted) {
|
||||||
// Handle as if latest.
|
// Handle as if latest.
|
||||||
final StructureModifier<EntityUseAction> actions;
|
try {
|
||||||
actions = packet.getEntityUseActions();
|
final StructureModifier<EntityUseAction> actions = packet.getEntityUseActions();
|
||||||
if (actions.size() == 1 && actions.read(0) == EntityUseAction.ATTACK) {
|
if (actions.size() == 1 && actions.read(0) == EntityUseAction.ATTACK) {
|
||||||
isAttack = true;
|
isAttack = true;
|
||||||
packetInterpreted = true;
|
packetInterpreted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NullPointerException e) {
|
||||||
|
/*
|
||||||
|
* TODO: Observed somewhere on 1_7_R4, probably a custom build -
|
||||||
|
* why doesn't the LegacyReflectionSet work here?
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!packetInterpreted) {
|
if (!packetInterpreted) {
|
||||||
|
Loading…
Reference in New Issue
Block a user