Hide NPCs in the Player Overview GUI (fixes #29)

NPCs are now by default removed from the Player Overview GUI unless CTRL
is held while the GUI is opened. NPCs are identified my their v2 UUID.
This commit is contained in:
johni0702
2016-11-13 21:42:33 +01:00
parent 1f2c05e696
commit d64ef8b2e1

View File

@@ -3,6 +3,7 @@ package com.replaymod.extras.playeroverview;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.replaymod.core.ReplayMod;
import com.replaymod.core.utils.Utils;
import com.replaymod.extras.Extra;
import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replay.camera.CameraEntity;
@@ -39,6 +40,16 @@ public class PlayerOverview implements Extra {
return !(input instanceof CameraEntity); // Exclude the camera entity
}
});
if (!Utils.isCtrlDown()) {
// Hide all players that have an UUID v2 (commonly used for NPCs)
Iterator<EntityPlayer> iter = players.iterator();
while (iter.hasNext()) {
UUID uuid = iter.next().getGameProfile().getId();
if (uuid != null && uuid.version() == 2) {
iter.remove();
}
}
}
new PlayerOverviewGui(PlayerOverview.this, players).display();
}
}