-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Added a BattleState enum containing various states of the EnderDrag…
…onBattle process maintained by DragonEggDrop + Added BattleStateChangeEvent to allow other developers to listen in state changes for the ender dragon battle config.yml: - Removed the "respawn" configuration option + Replaced it with two new configuration options, "respawn-on-join" and "respawn-on-death" to separate the two plugin.yml: * Updated the version number to prepare for a release DragonLifeListener: + Called the new event 2 times in different states RespawnListener: * Modified the listeners to use the new configuration booleans rather than the single "respawn" configuration boolean DragonDeathRunnable: + Called the new event 2 times in different states + Added an instance of the EnderDragon to the constructor to be stored in a field (used for event purposes) + Implemented support for the new "respawn-on-death" configuration option RespawnRunnable: + Called the new event 2 times in different states NMSAbstract: + Added a new #getEnderDragonFromBattle(Object) method to get an EnderDragon based on its associated EnderDragonBattle object * Modified all NMSAbstract implementations to properly implement this new method as well
- Loading branch information
Showing
13 changed files
with
355 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
DragonEggDrop | ||
Copyright (C) 2016 NinjaStix | ||
[email protected] | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ninjaguild.dragoneggdrop.api; | ||
|
||
/** | ||
* Various states capable of being processed during an EnderDragonBattle | ||
* | ||
* @author Parker Hawke - 2008Choco | ||
*/ | ||
public enum BattleState { | ||
|
||
/** | ||
* The dragon is dead, awaiting to be respawned | ||
*/ | ||
DRAGON_DEAD, | ||
|
||
/** | ||
* The 4 crystals are starting to spawn on the portal | ||
*/ | ||
CRYSTALS_SPAWNING, | ||
|
||
/** | ||
* The dragon has started its respawn process, including the spawning | ||
* of the crystals on the pillars | ||
*/ | ||
DRAGON_RESPAWNING, | ||
|
||
/** | ||
* The battle has initiated, and the dragon is free to roam | ||
*/ | ||
BATTLE_COMMENCED, | ||
|
||
/** | ||
* The battle has ended and the dragon has been slain. Its death | ||
* animation is playing | ||
*/ | ||
BATTLE_END, | ||
|
||
/** | ||
* The particles have started descending to drop the loot (if any | ||
* at all) | ||
*/ | ||
PARTICLES_START, | ||
|
||
/** | ||
* The loot has been spawned on the portal | ||
*/ | ||
LOOT_SPAWN; | ||
|
||
} |
101 changes: 101 additions & 0 deletions
101
src/com/ninjaguild/dragoneggdrop/api/BattleStateChangeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
DragonEggDrop | ||
Copyright (C) 2016 NinjaStix | ||
[email protected] | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ninjaguild.dragoneggdrop.api; | ||
|
||
import org.bukkit.entity.EnderDragon; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* Called when the state of the EnderDragon battle changes | ||
* | ||
* @author Parker Hawke - 2008Choco | ||
*/ | ||
public class BattleStateChangeEvent extends Event { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final Object dragonBattle; // net.minecraft.server.EnderDragonBattle | ||
private final EnderDragon dragon; | ||
|
||
private final BattleState previousState, newState; | ||
|
||
/** | ||
* Construct a new BattleStateChangeEvent | ||
* | ||
* @param dragonBattle - An instance of the EnderDragonBattle | ||
* @param dragon - An instance of the dragon | ||
* @param previousState - The previous state of the battle | ||
* @param newState - The new state of the battle | ||
*/ | ||
public BattleStateChangeEvent(Object dragonBattle, EnderDragon dragon, BattleState previousState, BattleState newState) { | ||
this.dragonBattle = dragonBattle; | ||
this.dragon = dragon; | ||
this.previousState = previousState; | ||
this.newState = newState; | ||
} | ||
|
||
/** | ||
* Get an instance of the EnderDragonBattle involved in | ||
* this event | ||
* | ||
* @return the involved EnderDragonBattle | ||
*/ | ||
public Object getDragonBattle() { | ||
return dragonBattle; | ||
} | ||
|
||
/** | ||
* Get an instance of the EnderDragon involved in this | ||
* event | ||
* | ||
* @return the involved dragon | ||
*/ | ||
public EnderDragon getDragon() { | ||
return dragon; | ||
} | ||
|
||
/** | ||
* Get the state that the battle was in prior to this change | ||
* | ||
* @return the previous battle state | ||
*/ | ||
public BattleState getPreviousState() { | ||
return previousState; | ||
} | ||
|
||
/** | ||
* Get the new state of the battle | ||
* | ||
* @return the new battle state | ||
*/ | ||
public BattleState getNewState() { | ||
return newState; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.