mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-05 23:21:30 +01:00
Add ArenaCompleteEvent
This event is fired when the final wave was completed and contains a set of all the players who survived until the end.
This commit is contained in:
parent
0b6a017c32
commit
1f91dde9e5
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.garbagemule.MobArena.events.ArenaCompleteEvent;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -105,11 +106,15 @@ public class MASpawnThread implements Runnable
|
|||||||
|
|
||||||
// Check if this is the final wave, in which case, end instead of spawn
|
// Check if this is the final wave, in which case, end instead of spawn
|
||||||
if (nextWave > 1 && (nextWave - 1) == waveManager.getFinalWave()) {
|
if (nextWave > 1 && (nextWave - 1) == waveManager.getFinalWave()) {
|
||||||
|
// Fire the complete event
|
||||||
|
ArenaCompleteEvent complete = new ArenaCompleteEvent(arena);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(complete);
|
||||||
|
|
||||||
|
// Then force leave everyone
|
||||||
List<Player> players = new ArrayList<Player>(arena.getPlayersInArena());
|
List<Player> players = new ArrayList<Player>(arena.getPlayersInArena());
|
||||||
for (Player p : players) {
|
for (Player p : players) {
|
||||||
arena.playerLeave(p);
|
arena.playerLeave(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user