UHC Bug fixes!

This commit is contained in:
Sam 2016-11-24 19:26:10 +00:00 committed by Shaun Bennett
parent 6fefd71bb8
commit 4158d09106

View File

@ -63,6 +63,7 @@ import mineplex.core.boosters.event.BoosterItemGiveEvent;
import mineplex.core.common.Pair;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
@ -483,6 +484,18 @@ public abstract class UHC extends Game
}
public void createSpawns()
{
createSpawns(new Callback<Boolean>()
{
@Override
public void run(Boolean data)
{
}
});
}
public void createSpawns(Callback<Boolean> callback)
{
// Disable game commands
Rank lastGameCommandsRank = Manager.getGameCommandRank();
@ -542,6 +555,7 @@ public abstract class UHC extends Game
{
Manager.setGameCommandMode(lastGameCommandsRank);
cancel();
callback.run(true);
}
}
}, 0L, 1L);
@ -599,6 +613,7 @@ public abstract class UHC extends Game
{
Manager.setGameCommandMode(lastGameCommandsRank);
cancel();
callback.run(true);
}
}
}, 0L, 1L);
@ -618,7 +633,13 @@ public abstract class UHC extends Game
_border.prepare();
Manager.runSyncLater(() -> {
Announce(C.cGreenB + "Generating spawns... there maybe some lag for a few moments");
if (!Manager.GetGame().equals(this))
{
System.out.println("Game was switched! Stop spawn generation!");
return;
}
Announce(C.cGreenB + "Generating spawns... there may be some lag for a few moments");
createSpawns();
}, 5 * 20);
}
@ -834,16 +855,12 @@ public abstract class UHC extends Game
_border.setSize(DEATHMATCH_ARENA_SIZE, 0);
// Recreate spawns
createSpawns();
// Delayed to allow time for all spawns to be generated
getArcadeManager().runSyncLater(new BukkitRunnable()
createSpawns(new Callback<Boolean>()
{
@Override
public void run()
public void run(Boolean data)
{
// This delay in generating spawns is accounted for in this delayed task
for (GameTeam gameTeam : GetTeamList())
{
gameTeam.SpawnTeleport();
@ -857,7 +874,7 @@ public abstract class UHC extends Game
}
}
}
}, GetPlayers(true).size() + 2);
});
}
public void startDeathmatch()
@ -881,7 +898,7 @@ public abstract class UHC extends Game
Damage = true;
// Set the border
_border.setSize(0, DEATHMATCH_TIME_SECONDS);
_border.setSize(64, DEATHMATCH_TIME_SECONDS);
}
public void refreshVisability()
@ -1667,7 +1684,7 @@ public abstract class UHC extends Game
if (killer.equals(killed))
return 0;
if (GetTeam(killer) != null && GetTeam(killed) != null && GetTeam(killer).equals(GetTeam(killed)))
if (GetTeam(killer) != null && GetTeam(killed) != null && GetTeam(killer).equals(GetTeam(killed)) && FillTeamsInOrderToCount != -1)
return 0;
if (assist)