From ce4124246481f551f5ca9e9d52ec9534700c32e0 Mon Sep 17 00:00:00 2001 From: Ilya246 <57039557+Ilya246@users.noreply.github.com> Date: Fri, 26 Mar 2021 20:14:35 +0400 Subject: [PATCH] Add files via upload --- src/crawler_arena/CrawlerArenaMod.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/crawler_arena/CrawlerArenaMod.java b/src/crawler_arena/CrawlerArenaMod.java index 2864072..7242cd4 100644 --- a/src/crawler_arena/CrawlerArenaMod.java +++ b/src/crawler_arena/CrawlerArenaMod.java @@ -91,7 +91,7 @@ public void init(){ Events.on(PlayerJoin.class, e -> { if(!units.containsKey(e.player.uuid()) || !money.containsKey(e.player.uuid())){ money.put(e.player.uuid(), new float[]{Mathf.pow(2.71f, 1f + wave / 2 + Mathf.pow(wave, 2) / 4000f) * 7f}); - Unit spawnUnit = UnitTypes.dagger.spawn(worldCenterX * 8, worldCenterY * 8); + Unit spawnUnit = UnitTypes.dagger.spawn(worldCenterX, worldCenterY); spawnUnit.add(); units.put(e.player.uuid(), spawnUnit); e.player.unit(spawnUnit); @@ -106,7 +106,12 @@ public void init(){ }; }); Events.on(PlayerLeave.class, e -> { - Unit u = units.get(e.player.uuid()); + Unit u; + try{ + u = units.get(e.player.uuid()); + }catch(Exception help){ + u = UnitTypes.dagger.spawn(worldCenterX, worldCenterY); + }; float hp = u.health; boolean isAlive = hp > 0; u.kill();