mirror of
https://github.com/songoda/EpicBosses.git
synced 2024-12-23 16:38:52 +01:00
1.0.0-SNAPSHOT-U173
+ Completed the AutoSpawnInterval system + Updated TODO + Added some new suggestions to TODO + Added a new method to BossAPI to get BossEntity from name
This commit is contained in:
parent
f941bb45f0
commit
996a6e913a
5
TODO
5
TODO
@ -1,8 +1,7 @@
|
||||
02:00 -> Add full AutoSpawns system
|
||||
02:00 -> Interval based spawn system, so bosses will spawn at location after certain time
|
||||
04:00 -> Add the AutoSpawns Editing GUI (with a button for toggling the type of the autospawn, from wilderness, to spawner, to interval and a button for editing data)
|
||||
01:00 -> Interval - Button to change coords, list of possible spawns, spawnIfChunkIsntLoaded, maxActiveBosses, bossesPerInterval, spawnRate, spawnType (Interval or Random), placeholder, message
|
||||
00:30 -> Connect the /boss time [section] to the AutoSpawns timer (can only be applied to Interval AutoSpawns)
|
||||
00:30 -> Add HolographicDisplay/PlaceholderAPI support for custom placeholders on AutoSpawnInterval times
|
||||
01:00 -> Add a new branch for the plugin and add support for Legacy version
|
||||
-----------
|
||||
8:30 hrs
|
||||
@ -12,9 +11,11 @@
|
||||
------------------------------------- TO DO AFTER RELEASE ---------------------------------------------------
|
||||
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
|
||||
-> AutoSpawns Editing GUI
|
||||
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
|
||||
|
||||
-----------
|
||||
4:45 hrs
|
@ -153,6 +153,17 @@ public class BossAPI {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get a BossEntity instance from a
|
||||
* name.
|
||||
*
|
||||
* @param name - the specified boss you are looking for
|
||||
* @return a bossEntity instance if found, or null if not found
|
||||
*/
|
||||
public static BossEntity getBossEntity(String name) {
|
||||
return PLUGIN.getBossEntityContainer().getData().getOrDefault(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get the Skill configuration section
|
||||
* name from a Skill instance.
|
||||
|
@ -4,15 +4,20 @@ import com.google.gson.annotations.Expose;
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
import com.songoda.epicbosses.autospawns.AutoSpawn;
|
||||
import com.songoda.epicbosses.autospawns.settings.AutoSpawnSettings;
|
||||
import com.songoda.epicbosses.entity.BossEntity;
|
||||
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
||||
import com.songoda.epicbosses.holder.autospawn.ActiveIntervalAutoSpawnHolder;
|
||||
import com.songoda.epicbosses.listeners.IBossDeathHandler;
|
||||
import com.songoda.epicbosses.utils.MessageUtils;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.ObjectUtils;
|
||||
import com.songoda.epicbosses.utils.StringUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
@ -36,9 +41,44 @@ public class IntervalSpawnElement {
|
||||
AutoSpawn autoSpawn = activeAutoSpawnHolder.getAutoSpawn();
|
||||
AutoSpawnSettings autoSpawnSettings = autoSpawn.getAutoSpawnSettings();
|
||||
boolean customSpawnMessage = ObjectUtils.getValue(autoSpawnSettings.getOverrideDefaultSpawnMessage(), false);
|
||||
String spawnMessage = autoSpawnSettings.getSpawnMessage();
|
||||
int amountToSpawn = ObjectUtils.getValue(autoSpawnSettings.getAmountPerSpawn(), 1);
|
||||
boolean shuffleList = ObjectUtils.getValue(autoSpawnSettings.getShuffleEntitiesList(), false);
|
||||
List<String> bosses = autoSpawn.getEntities();
|
||||
Location location = getSpawnLocation();
|
||||
|
||||
if(bosses == null || bosses.isEmpty()) return false;
|
||||
|
||||
if(shuffleList) Collections.shuffle(bosses);
|
||||
|
||||
Queue<String> queue = new LinkedList<>(bosses);
|
||||
|
||||
for(int i = 1; i <= amountToSpawn; i++) {
|
||||
if(queue.isEmpty()) queue = new LinkedList<>(bosses);
|
||||
|
||||
BossEntity bossEntity = BossAPI.getBossEntity(queue.poll());
|
||||
ActiveBossHolder activeBossHolder = BossAPI.spawnNewBoss(bossEntity, location, null, null, customSpawnMessage);
|
||||
|
||||
if(activeBossHolder == null) continue;
|
||||
|
||||
activeBossHolder.getPostBossDeathHandlers().add(bossDeathHandler);
|
||||
activeAutoSpawnHolder.getActiveBossHolders().add(activeBossHolder);
|
||||
}
|
||||
|
||||
if(customSpawnMessage && spawnMessage != null) {
|
||||
String x = NumberUtils.get().formatDouble(location.getBlockX());
|
||||
String y = NumberUtils.get().formatDouble(location.getBlockY());
|
||||
String z = NumberUtils.get().formatDouble(location.getBlockZ());
|
||||
String world = StringUtils.get().formatString(location.getWorld().getName());
|
||||
|
||||
List<String> spawnMessages = BossAPI.getStoredMessages(spawnMessage);
|
||||
|
||||
if(spawnMessages != null) {
|
||||
spawnMessages.replaceAll(s -> s.replace("{x}", x).replace("{y}", y).replace("{z}", z).replace("{world}", world));
|
||||
|
||||
MessageUtils.get().sendMessage(location, -1, spawnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user