Skip to content

Commit

Permalink
Updated PvPInfo null check
Browse files Browse the repository at this point in the history
  • Loading branch information
IUDevman committed Dec 16, 2020
1 parent cbd353a commit 6681d1d
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ public void setup(){
}

public void onUpdate() {
if (mc.player == null || mc.world == null) {
return;
}

if (visualRange.getValue()) {
if (mc.player == null) return;
players = mc.world.loadedEntityList.stream().filter(e -> e instanceof EntityPlayer).collect(Collectors.toList());
try {
for (Entity e : players) {
Expand All @@ -80,7 +83,7 @@ public void onUpdate() {
}
}
} catch (Exception e) {
} // ez no crasherino
}
try {
for (Entity e : knownPlayers) {
if (e instanceof EntityPlayer && !e.getName().equalsIgnoreCase(mc.player.getName())) {
Expand All @@ -90,7 +93,7 @@ public void onUpdate() {
}
}
} catch (Exception e) {
} // ez no crasherino pt.2
}
}
if (pearlAlert.getValue()) {
pearls = mc.world.loadedEntityList.stream().filter(e -> e instanceof EntityEnderPearl).collect(Collectors.toList());
Expand All @@ -106,7 +109,7 @@ public void onUpdate() {
} catch (Exception e) {
}
}
if (strengthDetect.getValue() && mc.player != null && mc.world != null) {
if (strengthDetect.getValue()) {
for (EntityPlayer player : mc.world.playerEntities){
if (player.isPotionActive(MobEffects.STRENGTH) && !(strengthedPlayers.contains(player))){
MessageBus.sendClientPrefixMessage(getTextColor() + player.getName() + " has (drank) strength!");
Expand All @@ -118,7 +121,7 @@ public void onUpdate() {
}
}
}
if (popCounter.getValue() && mc.world != null && mc.player != null) {
if (popCounter.getValue()) {
for (EntityPlayer player : mc.world.playerEntities) {
if (player.getHealth() <= 0) {
if (popCounterHashMap.containsKey(player.getDisplayNameString())) {
Expand All @@ -132,10 +135,10 @@ public void onUpdate() {

@EventHandler
private final Listener<PacketEvent.Receive> packetEventListener = new Listener<>(event -> {

if (mc.world == null || mc.player == null){
return;
}

if (event.getPacket() instanceof SPacketEntityStatus){
SPacketEntityStatus packet = (SPacketEntityStatus) event.getPacket();
if (packet.getOpCode() == 35){
Expand All @@ -147,6 +150,10 @@ public void onUpdate() {

@EventHandler
private final Listener<TotemPopEvent> totemPopEventListener = new Listener<>(event -> {
if (mc.world == null || mc.player == null){
return;
}

if (popCounter.getValue()) {
if (popCounterHashMap == null) {
popCounterHashMap = new HashMap<>();
Expand Down

0 comments on commit 6681d1d

Please sign in to comment.