+ Added feature in BossSpawnEvent and BossDeathEvent where u can do isAutoSpawn to check if the section is an auto spawn section
+ Fixed issue where BossSpawnEvent wasn't being called for AutoSpawn sections
This commit is contained in:
Charles 2019-03-03 23:29:06 +08:00
parent 866d437f05
commit dd6ea71e36
8 changed files with 23 additions and 13 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "EpicBosses"
path: "/builds/$CI_PROJECT_PATH"
version: "1.0.0"
version: "1.1.8-U1"
build:
stage: build

6
TODO
View File

@ -1,4 +1,7 @@
------------------------------------- TO DO AFTER RELEASE ---------------------------------------------------
00:30 -> Make Cage destroy time configurable via. custom skill settings
-> Fix this (in the drop tables menu): http://pramsing.com/fNJUC
-> Inspect Top Damager
02:00 -> Randomly in the wilderness, bosses will spawn with x chance within coords as a player is loading chunks
00:45 -> Randomly from a spawner, bosses will spawn with x chance within coords when a spawner is spawning mobs of the same type
03:00 -> Randomly spawn in a biome bosses will spawn with x chance within each biome as they're loaded in by the players
@ -6,6 +9,3 @@
01:00 -> Wilderness - Button to change max coords, boss that autospawn applies to, maxActiveBosses, spawnChance
01:00 -> Spawner - Button to change max coords, boss that autospawn applies to, maxActiveBosses, spawnChance
01:00 -> Biome - Button to change max bosses per biome, boss that autospawn applies to, spawnChance
-----------
8:45 hrs

View File

@ -7,6 +7,7 @@ import com.songoda.epicbosses.autospawns.IAutoSpawnCustomSettingsHandler;
import com.songoda.epicbosses.autospawns.handlers.IntervalSpawnHandler;
import com.songoda.epicbosses.autospawns.settings.AutoSpawnSettings;
import com.songoda.epicbosses.entity.BossEntity;
import com.songoda.epicbosses.events.BossSpawnEvent;
import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.holder.autospawn.ActiveIntervalAutoSpawnHolder;
import com.songoda.epicbosses.listeners.IBossDeathHandler;
@ -90,6 +91,10 @@ public class IntervalSpawnElement implements IAutoSpawnCustomSettingsHandler {
activeBossHolder.getPostBossDeathHandlers().add(bossDeathHandler);
activeAutoSpawnHolder.getActiveBossHolders().add(activeBossHolder);
BossSpawnEvent bossSpawnEvent = new BossSpawnEvent(activeBossHolder, true);
ServerUtils.get().callEvent(bossSpawnEvent);
}
if(customSpawnMessage && spawnMessage != null) {

View File

@ -14,10 +14,12 @@ public class BossDeathEvent extends Event {
private static final HandlerList handlers = new HandlerList();
@Getter private ActiveBossHolder activeBossHolder;
@Getter private final ActiveBossHolder activeBossHolder;
@Getter private final boolean autoSpawn;
public BossDeathEvent(ActiveBossHolder activeBossHolder) {
public BossDeathEvent(ActiveBossHolder activeBossHolder, boolean autoSpawn) {
this.activeBossHolder = activeBossHolder;
this.autoSpawn = autoSpawn;
}
@Override

View File

@ -14,10 +14,12 @@ public class BossSpawnEvent extends Event {
private static final HandlerList handlers = new HandlerList();
@Getter private ActiveBossHolder activeBossHolder;
@Getter private final ActiveBossHolder activeBossHolder;
@Getter private final boolean autoSpawn;
public BossSpawnEvent(ActiveBossHolder activeBossHolder) {
public BossSpawnEvent(ActiveBossHolder activeBossHolder, boolean autoSpawn) {
this.activeBossHolder = activeBossHolder;
this.autoSpawn = autoSpawn;
}
@Override

View File

@ -7,7 +7,6 @@ import com.songoda.epicbosses.events.BossDeathEvent;
import com.songoda.epicbosses.events.PreBossDeathEvent;
import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.holder.DeadBossHolder;
import com.songoda.epicbosses.listeners.IBossDeathHandler;
import com.songoda.epicbosses.managers.BossEntityManager;
import com.songoda.epicbosses.utils.Debug;
import com.songoda.epicbosses.utils.MessageUtils;
@ -140,10 +139,12 @@ public class BossDeathListener implements Listener {
}
});
boolean autoSpawn = !activeBossHolder.getPostBossDeathHandlers().isEmpty();
activeBossHolder.getPostBossDeathHandlers().forEach(handler -> handler.onPreDeath(event));
DeadBossHolder deadBossHolder = new DeadBossHolder(bossEntity, location, mapOfDamage, mapOfPercent);
BossDeathEvent bossDeathEvent = new BossDeathEvent(activeBossHolder);
BossDeathEvent bossDeathEvent = new BossDeathEvent(activeBossHolder, autoSpawn);
DropTable dropTable = this.bossEntityManager.getDropTable(bossEntity);
if(dropTable == null) {

View File

@ -141,7 +141,7 @@ public class BossSpawnListener implements Listener {
activeBossHolder.getTargetHandler().runTargetCycle();
this.bossTauntManager.handleTauntSystem(activeBossHolder);
BossSpawnEvent bossSpawnEvent = new BossSpawnEvent(activeBossHolder);
BossSpawnEvent bossSpawnEvent = new BossSpawnEvent(activeBossHolder, false);
ServerUtils.get().callEvent(bossSpawnEvent);
}

View File

@ -19,7 +19,7 @@
</modules>
<properties>
<plugin.version>1.0.8-U1</plugin.version>
<plugin.version>1.1.8-U1</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>