Commits
Doc authored and md_5 committed 3f0281ca2a3
1 1 | package org.bukkit.boss; |
2 2 | |
3 + | import java.util.Collection; |
3 4 | import org.bukkit.Location; |
5 + | import org.bukkit.entity.EnderCrystal; |
4 6 | import org.bukkit.entity.EnderDragon; |
5 7 | import org.jetbrains.annotations.NotNull; |
6 8 | import org.jetbrains.annotations.Nullable; |
7 9 | |
8 10 | /** |
9 11 | * Represents a dragon battle state for a world with an end environment. |
10 12 | */ |
11 13 | public interface DragonBattle { |
12 14 | |
13 15 | /** |
14 16 | * Get the {@link EnderDragon} active in this battle. |
15 - | * |
17 + | * <br> |
16 18 | * Will return null if the dragon has been slain. |
17 19 | * |
18 20 | * @return the ender dragon. null if dead |
19 21 | */ |
20 22 | |
21 23 | public EnderDragon getEnderDragon(); |
22 24 | |
23 25 | /** |
24 26 | * Get the boss bar to be displayed for this dragon battle. |
25 27 | * |
26 28 | * @return the boss bar |
27 29 | */ |
28 30 | |
29 31 | public BossBar getBossBar(); |
30 32 | |
31 33 | /** |
32 34 | * Get the location of the end portal. |
33 - | * |
35 + | * <br> |
34 36 | * This location will be at the center of the base (bottom) of the portal. |
35 37 | * |
36 38 | * @return the end portal location or null if not generated |
37 39 | */ |
38 40 | |
39 41 | public Location getEndPortalLocation(); |
40 42 | |
41 43 | /** |
42 44 | * Generate the end portal. |
43 45 | * |
44 - | * @param withPortals whether or not end portal blocks should be generated |
46 + | * @param withPortals whether end portal blocks should be generated |
45 47 | * |
46 48 | * @return true if generated, false if already present |
47 49 | */ |
48 50 | public boolean generateEndPortal(boolean withPortals); |
49 51 | |
50 52 | /** |
51 - | * Check whether or not the first dragon has been killed already. |
53 + | * Check whether the first dragon has been killed already. |
52 54 | * |
53 55 | * @return true if killed before, false otherwise |
54 56 | */ |
55 57 | public boolean hasBeenPreviouslyKilled(); |
56 58 | |
57 59 | /** |
58 - | * Initiate a respawn sequence to summon the dragon as though a player has |
60 + | * Try to initiate a respawn sequence to summon the dragon as though a player has |
59 61 | * placed 4 end crystals on the portal. |
60 62 | */ |
61 63 | public void initiateRespawn(); |
62 64 | |
65 + | /** |
66 + | * Try to initiate a respawn sequence to summon the dragon. |
67 + | * |
68 + | * @param enderCrystals the {@link EnderCrystal EnderCrystals} to use in the |
69 + | * respawn, or a null or empty list to render the respawn sequence |
70 + | * uncancellable. null entries or crystals that do not reside in the same |
71 + | * world as this dragon battle will be ignored. |
72 + | * |
73 + | * @return true if the respawn was initiated, false otherwise. |
74 + | */ |
75 + | public boolean initiateRespawn( Collection<EnderCrystal> enderCrystals); |
76 + | |
63 77 | /** |
64 78 | * Get this battle's current respawn phase. |
65 79 | * |
66 80 | * @return the current respawn phase. |
67 81 | */ |
68 82 | |
69 83 | public RespawnPhase getRespawnPhase(); |
70 84 | |
71 85 | /** |
72 86 | * Set the dragon's respawn phase. |
73 - | * |
87 + | * <br> |
74 88 | * This method will is unsuccessful if a dragon respawn is not in progress. |
75 89 | * |
76 90 | * @param phase the phase to set |
77 91 | * |
78 92 | * @return true if successful, false otherwise |
79 93 | * |
80 94 | * @see #initiateRespawn() |
81 95 | */ |
82 96 | public boolean setRespawnPhase( RespawnPhase phase); |
83 97 | |