Clean up code & Upgrade syntax to new Java

This commit is contained in:
Đạt Nhân Trương
2022-08-07 01:35:02 +07:00
parent bbdf236a10
commit f983b4dccf
17 changed files with 44 additions and 61 deletions

View File

@@ -48,19 +48,15 @@ public class WhereaMiCommand extends Command {
HashSet<Monster> mobs = new HashSet<>();
for (MapObject mmo : player.getMap().getMapObjects()) {
if (mmo instanceof NPC) {
NPC npc = (NPC) mmo;
if (mmo instanceof NPC npc) {
npcs.add(npc);
} else if (mmo instanceof Character) {
Character mc = (Character) mmo;
} else if (mmo instanceof Character mc) {
chars.add(mc);
} else if (mmo instanceof Monster) {
Monster mob = (Monster) mmo;
} else if (mmo instanceof Monster mob) {
if (mob.isAlive()) {
mobs.add(mob);
}
} else if (mmo instanceof PlayerNPC) {
PlayerNPC npc = (PlayerNPC) mmo;
} else if (mmo instanceof PlayerNPC npc) {
playernpcs.add(npc);
}
}