fix auto respawns when boss is killed with /minecraft:kill

This commit is contained in:
Aurora 2020-08-06 19:35:55 +02:00
parent 331fb487e2
commit fe43bc35b5
4 changed files with 10 additions and 0 deletions

View File

@ -67,6 +67,9 @@
<version>2.3.2</version>
<configuration>
<showDeprecation>false</showDeprecation>
<source>1.8</source>
<target>1.8</target>
<encoding>utf8</encoding>
</configuration>
</plugin>
<plugin>

View File

@ -91,6 +91,7 @@ public class IntervalSpawnElement implements IAutoSpawnCustomSettingsHandler {
if (activeBossHolder == null) continue;
activeBossHolder.getPostBossDeathHandlers().add(bossDeathHandler);
activeBossHolder.getPostBossDeathRemoveHandlers().add(bossDeathHandler);
activeAutoSpawnHolder.getActiveBossHolders().add(activeBossHolder);
BossSpawnEvent bossSpawnEvent = new BossSpawnEvent(activeBossHolder, true);

View File

@ -28,6 +28,7 @@ public class ActiveBossHolder implements IActiveHolder {
private Map<Integer, ActiveMinionHolder> activeMinionHolderMap = new HashMap<>();
private Map<Integer, UUID> livingEntityMap = new HashMap<>();
private List<IBossDeathHandler> postBossDeathHandlers = new ArrayList<>();
private List<IBossDeathHandler> postBossDeathRemoveHandlers = new ArrayList<>();
private Map<UUID, Double> mapOfDamagingUsers = new HashMap<>();
private String spawningPlayerName;
@ -145,6 +146,10 @@ public class ActiveBossHolder implements IActiveHolder {
public List<IBossDeathHandler> getPostBossDeathHandlers() {
return this.postBossDeathHandlers;
}
public List<IBossDeathHandler> getPostBossDeathRemoveHandlers() {
return this.postBossDeathRemoveHandlers;
}
public Map<UUID, Double> getMapOfDamagingUsers() {
return this.mapOfDamagingUsers;

View File

@ -60,6 +60,7 @@ public class BossDeathListener implements Listener {
if (damageCause == EntityDamageEvent.DamageCause.VOID || damageCause == EntityDamageEvent.DamageCause.LAVA
|| activeBossHolder.getMapOfDamagingUsers().isEmpty()) {
this.bossEntityManager.removeActiveBossHolder(activeBossHolder);
activeBossHolder.getPostBossDeathRemoveHandlers().forEach(handler -> handler.onPreDeath(new PreBossDeathEvent(activeBossHolder, location, null)));
return;
}