mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-20 22:01:21 +01:00
1.0.0-SNAPSHOT-U49
+ More small tweaks + Added boss giveEgg cmd + Completed BossInfo cmd + Completed BossKillAll cmd + Completed BossList cmd + begun working on boss nearby cmd + Improved some other methods of how the plugin works + Fixed bugs with loading and killing the boss
This commit is contained in:
parent
945f55a81d
commit
7130f9acd3
@ -1,6 +1,7 @@
|
|||||||
Settings:
|
Settings:
|
||||||
debug: false
|
debug: false
|
||||||
bossTargetRange: 50.0
|
bossTargetRange: 50.0
|
||||||
|
defaultNearbyRadius: 250.0
|
||||||
|
|
||||||
BlockedWorlds:
|
BlockedWorlds:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.songoda.epicbosses.commands.boss;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Charles Cullen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 14-Nov-18
|
||||||
|
*/
|
||||||
|
public class BossGiveEggCmd {
|
||||||
|
}
|
@ -34,8 +34,9 @@ public class BossHelpCmd extends SubCommand {
|
|||||||
case 2:
|
case 2:
|
||||||
Message.Boss_Help_Page2.msg(sender);
|
Message.Boss_Help_Page2.msg(sender);
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
Message.Boss_Help_Page3.msg(sender);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.songoda.epicbosses.commands.boss;
|
package com.songoda.epicbosses.commands.boss;
|
||||||
|
|
||||||
|
import com.songoda.epicbosses.entity.BossEntity;
|
||||||
|
import com.songoda.epicbosses.managers.BossEntityManager;
|
||||||
|
import com.songoda.epicbosses.managers.files.BossesFileManager;
|
||||||
|
import com.songoda.epicbosses.utils.Message;
|
||||||
|
import com.songoda.epicbosses.utils.Permission;
|
||||||
import com.songoda.epicbosses.utils.command.SubCommand;
|
import com.songoda.epicbosses.utils.command.SubCommand;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -7,17 +12,43 @@ import org.bukkit.command.CommandSender;
|
|||||||
* @author Charles Cullen
|
* @author Charles Cullen
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 02-Oct-18
|
* @since 02-Oct-18
|
||||||
*
|
|
||||||
* TODO
|
|
||||||
*/
|
*/
|
||||||
public class BossInfoCmd extends SubCommand {
|
public class BossInfoCmd extends SubCommand {
|
||||||
|
|
||||||
public BossInfoCmd() {
|
private BossEntityManager bossEntityManager;
|
||||||
|
private BossesFileManager bossesFileManager;
|
||||||
|
|
||||||
|
public BossInfoCmd(BossesFileManager bossesFileManager, BossEntityManager bossEntityManager) {
|
||||||
super("info");
|
super("info");
|
||||||
|
|
||||||
|
this.bossesFileManager = bossesFileManager;
|
||||||
|
this.bossEntityManager = bossEntityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(!Permission.admin.hasPermission(sender)) {
|
||||||
|
Message.Boss_Info_NoPermission.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length != 2) {
|
||||||
|
Message.Boss_Info_InvalidArgs.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String input = args[1];
|
||||||
|
BossEntity bossEntity = this.bossesFileManager.getBossEntity(input);
|
||||||
|
|
||||||
|
if(bossEntity == null) {
|
||||||
|
Message.Boss_Info_CouldntFindBoss.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean editing = bossEntity.isEditing();
|
||||||
|
int active = this.bossEntityManager.getCurrentlyActive(bossEntity);
|
||||||
|
boolean complete = bossEntity.isCompleteEnoughToSpawn();
|
||||||
|
|
||||||
|
Message.Boss_Info_Display.msg(sender, input, editing, active, complete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,51 @@
|
|||||||
package com.songoda.epicbosses.commands.boss;
|
package com.songoda.epicbosses.commands.boss;
|
||||||
|
|
||||||
|
import com.songoda.epicbosses.managers.BossEntityManager;
|
||||||
|
import com.songoda.epicbosses.utils.Message;
|
||||||
|
import com.songoda.epicbosses.utils.Permission;
|
||||||
import com.songoda.epicbosses.utils.command.SubCommand;
|
import com.songoda.epicbosses.utils.command.SubCommand;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Charles Cullen
|
* @author Charles Cullen
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 02-Oct-18
|
* @since 02-Oct-18
|
||||||
*
|
|
||||||
* TODO
|
|
||||||
*/
|
*/
|
||||||
public class BossKillAllCmd extends SubCommand {
|
public class BossKillAllCmd extends SubCommand {
|
||||||
|
|
||||||
public BossKillAllCmd() {
|
private BossEntityManager bossEntityManager;
|
||||||
|
|
||||||
|
public BossKillAllCmd(BossEntityManager bossEntityManager) {
|
||||||
super("killall");
|
super("killall");
|
||||||
|
|
||||||
|
this.bossEntityManager = bossEntityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(!Permission.admin.hasPermission(sender)) {
|
||||||
|
Message.Boss_KillAll_NoPermission.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
World world = null;
|
||||||
|
|
||||||
|
if(args.length == 2) {
|
||||||
|
String worldArgs = args[1];
|
||||||
|
|
||||||
|
world = Bukkit.getWorld(worldArgs);
|
||||||
|
|
||||||
|
if(world == null) {
|
||||||
|
Message.Boss_KillAll_WorldNotFound.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int amount = this.bossEntityManager.killAllHolders(world);
|
||||||
|
|
||||||
|
if(args.length == 2) Message.Boss_KillAll_KilledWorld.msg(sender, amount, world.getName());
|
||||||
|
else Message.Boss_KillAll_KilledAll.msg(sender, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,41 @@
|
|||||||
package com.songoda.epicbosses.commands.boss;
|
package com.songoda.epicbosses.commands.boss;
|
||||||
|
|
||||||
|
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||||
|
import com.songoda.epicbosses.utils.Message;
|
||||||
|
import com.songoda.epicbosses.utils.Permission;
|
||||||
import com.songoda.epicbosses.utils.command.SubCommand;
|
import com.songoda.epicbosses.utils.command.SubCommand;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Charles Cullen
|
* @author Charles Cullen
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 02-Oct-18
|
* @since 02-Oct-18
|
||||||
*
|
|
||||||
* TODO
|
|
||||||
*/
|
*/
|
||||||
public class BossListCmd extends SubCommand {
|
public class BossListCmd extends SubCommand {
|
||||||
|
|
||||||
public BossListCmd() {
|
private BossPanelManager bossPanelManager;
|
||||||
|
|
||||||
|
public BossListCmd(BossPanelManager bossPanelManager) {
|
||||||
super("list", "show");
|
super("list", "show");
|
||||||
|
|
||||||
|
this.bossPanelManager = bossPanelManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(!Permission.admin.hasPermission(sender)) {
|
||||||
|
Message.Boss_List_NoPermission.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(sender instanceof Player)) {
|
||||||
|
Message.General_MustBePlayer.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
this.bossPanelManager.getBosses().openFor(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,57 @@
|
|||||||
package com.songoda.epicbosses.commands.boss;
|
package com.songoda.epicbosses.commands.boss;
|
||||||
|
|
||||||
|
import com.songoda.epicbosses.CustomBosses;
|
||||||
|
import com.songoda.epicbosses.file.ConfigFileHandler;
|
||||||
|
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
||||||
|
import com.songoda.epicbosses.utils.Message;
|
||||||
|
import com.songoda.epicbosses.utils.NumberUtils;
|
||||||
|
import com.songoda.epicbosses.utils.Permission;
|
||||||
import com.songoda.epicbosses.utils.command.SubCommand;
|
import com.songoda.epicbosses.utils.command.SubCommand;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Charles Cullen
|
* @author Charles Cullen
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 02-Oct-18
|
* @since 02-Oct-18
|
||||||
*
|
|
||||||
* TODO
|
|
||||||
*/
|
*/
|
||||||
public class BossNearbyCmd extends SubCommand {
|
public class BossNearbyCmd extends SubCommand {
|
||||||
|
|
||||||
public BossNearbyCmd() {
|
private CustomBosses plugin;
|
||||||
|
|
||||||
|
public BossNearbyCmd(CustomBosses plugin) {
|
||||||
super("nearby");
|
super("nearby");
|
||||||
|
|
||||||
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(!Permission.nearby.hasPermission(sender)) {
|
||||||
|
Message.Boss_Nearby_NoPermission.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(sender instanceof Player)) {
|
||||||
|
Message.General_MustBePlayer.msg(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
Location location = player.getLocation();
|
||||||
|
double radius = this.plugin.getConfig().getDouble("Settings.defaultNearbyRadius", 250.0);
|
||||||
|
|
||||||
|
if(args.length == 2) {
|
||||||
|
Integer newNumber = NumberUtils.get().getInteger(args[1]);
|
||||||
|
|
||||||
|
if(newNumber != null) radius = newNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ActiveBossHolder> nearbyBosses = this.plugin.getBossEntityManager().getActiveBossHoldersWithinRadius(radius, location);
|
||||||
|
|
||||||
|
//TODO Finish
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,4 +33,20 @@ public class BossEntity {
|
|||||||
this.messages = messages;
|
this.messages = messages;
|
||||||
this.commands = commands;
|
this.commands = commands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCompleteEnoughToSpawn() {
|
||||||
|
boolean complete = true;
|
||||||
|
|
||||||
|
if(this.entityStats == null) return false;
|
||||||
|
|
||||||
|
EntityStatsElement entityStatsElement = this.entityStats.get(0);
|
||||||
|
|
||||||
|
if(entityStatsElement == null) return false;
|
||||||
|
|
||||||
|
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||||
|
|
||||||
|
if(mainStatsElement == null) return false;
|
||||||
|
|
||||||
|
return mainStatsElement.getPosition() != null && mainStatsElement.getEntityType() != null && mainStatsElement.getHealth() != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.songoda.epicbosses.targeting.TargetHandler;
|
|||||||
import com.songoda.epicbosses.entity.BossEntity;
|
import com.songoda.epicbosses.entity.BossEntity;
|
||||||
import com.songoda.epicbosses.exception.AlreadySetException;
|
import com.songoda.epicbosses.exception.AlreadySetException;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -49,7 +50,41 @@ public class ActiveBossHolder {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LivingEntity getMinionEntity() {
|
||||||
|
for(LivingEntity livingEntity : getMinionEntityMap().values()) {
|
||||||
|
if(livingEntity != null) return livingEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasAttacked(UUID uuid) {
|
public boolean hasAttacked(UUID uuid) {
|
||||||
return this.mapOfDamagingUsers.containsKey(uuid);
|
return this.mapOfDamagingUsers.containsKey(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void killAllMinions() {
|
||||||
|
this.minionEntityMap.values().forEach(LivingEntity::remove);
|
||||||
|
this.minionEntityMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void killAllMinions(World world) {
|
||||||
|
LivingEntity livingEntity = getMinionEntity();
|
||||||
|
|
||||||
|
if(livingEntity == null) return;
|
||||||
|
if(world != null && !livingEntity.getWorld().equals(world)) return;
|
||||||
|
|
||||||
|
this.minionEntityMap.values().forEach(LivingEntity::remove);
|
||||||
|
this.minionEntityMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean killAllSubBosses(World world) {
|
||||||
|
LivingEntity livingEntity = getLivingEntity();
|
||||||
|
|
||||||
|
if(livingEntity == null) return false;
|
||||||
|
if(world != null && !livingEntity.getWorld().equals(world)) return false;
|
||||||
|
|
||||||
|
this.livingEntityMap.values().forEach(LivingEntity::remove);
|
||||||
|
this.livingEntityMap.clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ public class BossDeathListener implements Listener {
|
|||||||
|
|
||||||
private BossEntityManager bossEntityManager;
|
private BossEntityManager bossEntityManager;
|
||||||
|
|
||||||
|
|
||||||
public BossDeathListener(CustomBosses plugin) {
|
public BossDeathListener(CustomBosses plugin) {
|
||||||
this.bossEntityManager = plugin.getBossEntityManager();
|
this.bossEntityManager = plugin.getBossEntityManager();
|
||||||
}
|
}
|
||||||
@ -66,6 +65,7 @@ public class BossDeathListener implements Listener {
|
|||||||
PreBossDeathEvent preBossDeathEvent = new PreBossDeathEvent(activeBossHolder, location);
|
PreBossDeathEvent preBossDeathEvent = new PreBossDeathEvent(activeBossHolder, location);
|
||||||
|
|
||||||
activeBossHolder.setDead(true);
|
activeBossHolder.setDead(true);
|
||||||
|
activeBossHolder.killAllMinions();
|
||||||
ServerUtils.get().callEvent(preBossDeathEvent);
|
ServerUtils.get().callEvent(preBossDeathEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ public class BossDamageListener implements Listener {
|
|||||||
double damage = event.getDamage();
|
double damage = event.getDamage();
|
||||||
Player player = null;
|
Player player = null;
|
||||||
|
|
||||||
|
System.out.println(livingEntity.getActivePotionEffects());
|
||||||
|
|
||||||
if(activeBossHolder == null) return;
|
if(activeBossHolder == null) return;
|
||||||
|
|
||||||
if(entityDamaging instanceof Player) {
|
if(entityDamaging instanceof Player) {
|
||||||
|
@ -36,7 +36,7 @@ public class BossCommandManager implements ILoadable {
|
|||||||
this.commandService.registerSubCommand(new BossHelpCmd());
|
this.commandService.registerSubCommand(new BossHelpCmd());
|
||||||
this.commandService.registerSubCommand(new BossInfoCmd());
|
this.commandService.registerSubCommand(new BossInfoCmd());
|
||||||
this.commandService.registerSubCommand(new BossItemsCmd(this.customBosses.getBossPanelManager()));
|
this.commandService.registerSubCommand(new BossItemsCmd(this.customBosses.getBossPanelManager()));
|
||||||
this.commandService.registerSubCommand(new BossKillAllCmd());
|
this.commandService.registerSubCommand(new BossKillAllCmd(this.customBosses.getBossEntityManager()));
|
||||||
this.commandService.registerSubCommand(new BossListCmd());
|
this.commandService.registerSubCommand(new BossListCmd());
|
||||||
this.commandService.registerSubCommand(new BossMenuCmd(this.customBosses.getBossPanelManager()));
|
this.commandService.registerSubCommand(new BossMenuCmd(this.customBosses.getBossPanelManager()));
|
||||||
this.commandService.registerSubCommand(new BossNearbyCmd());
|
this.commandService.registerSubCommand(new BossNearbyCmd());
|
||||||
|
@ -21,6 +21,7 @@ import com.songoda.epicbosses.utils.Debug;
|
|||||||
import com.songoda.epicbosses.utils.RandomUtils;
|
import com.songoda.epicbosses.utils.RandomUtils;
|
||||||
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -56,6 +57,60 @@ public class BossEntityManager {
|
|||||||
this.bossesFileManager = customBosses.getBossesFileManager();
|
this.bossesFileManager = customBosses.getBossesFileManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getRadius(ActiveBossHolder activeBossHolder, Location centerLocation) {
|
||||||
|
if(activeBossHolder.isDead()) return Double.MAX_VALUE;
|
||||||
|
|
||||||
|
LivingEntity livingEntity = activeBossHolder.getLivingEntity();
|
||||||
|
|
||||||
|
if(livingEntity == null) return Double.MAX_VALUE;
|
||||||
|
|
||||||
|
Location location = livingEntity.getLocation();
|
||||||
|
|
||||||
|
return centerLocation.distance(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ActiveBossHolder> getActiveBossHoldersWithinRadius(double radius, Location centerLocation) {
|
||||||
|
List<ActiveBossHolder> activeBossHolders = new ArrayList<>();
|
||||||
|
|
||||||
|
getActiveBossHolders().forEach(activeBossHolder -> {
|
||||||
|
double distance = getRadius(activeBossHolder, centerLocation);
|
||||||
|
|
||||||
|
if(distance > radius) return;
|
||||||
|
|
||||||
|
activeBossHolders.add(activeBossHolder);
|
||||||
|
});
|
||||||
|
|
||||||
|
return activeBossHolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentlyActive(BossEntity bossEntity) {
|
||||||
|
int amountOfBosses = 0;
|
||||||
|
|
||||||
|
for(ActiveBossHolder activeBossHolder : getActiveBossHolders()) {
|
||||||
|
if(activeBossHolder.getBossEntity().equals(bossEntity)) {
|
||||||
|
amountOfBosses++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return amountOfBosses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int killAllHolders(World world) {
|
||||||
|
int amountOfBosses = 0;
|
||||||
|
|
||||||
|
for(ActiveBossHolder activeBossHolder : getActiveBossHolders()) {
|
||||||
|
if(activeBossHolder.killAllSubBosses(world)) {
|
||||||
|
activeBossHolder.killAllMinions(world);
|
||||||
|
activeBossHolder.setDead(true);
|
||||||
|
amountOfBosses++;
|
||||||
|
|
||||||
|
ACTIVE_BOSS_HOLDERS.remove(activeBossHolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return amountOfBosses;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: Add default item if spawnItem is not set.
|
//TODO: Add default item if spawnItem is not set.
|
||||||
public ItemStack getSpawnItem(BossEntity bossEntity) {
|
public ItemStack getSpawnItem(BossEntity bossEntity) {
|
||||||
if(bossEntity == null) return null;
|
if(bossEntity == null) return null;
|
||||||
@ -216,7 +271,7 @@ public class BossEntityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActiveBossHolder getActiveBossHolder(LivingEntity livingEntity) {
|
public ActiveBossHolder getActiveBossHolder(LivingEntity livingEntity) {
|
||||||
List<ActiveBossHolder> currentList = new ArrayList<>(ACTIVE_BOSS_HOLDERS);
|
List<ActiveBossHolder> currentList = getActiveBossHolders();
|
||||||
|
|
||||||
for(ActiveBossHolder activeBossHolder : currentList) {
|
for(ActiveBossHolder activeBossHolder : currentList) {
|
||||||
for(Map.Entry<Integer, LivingEntity> entry : activeBossHolder.getLivingEntityMap().entrySet()) {
|
for(Map.Entry<Integer, LivingEntity> entry : activeBossHolder.getLivingEntityMap().entrySet()) {
|
||||||
@ -338,4 +393,8 @@ public class BossEntityManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<ActiveBossHolder> getActiveBossHolders() {
|
||||||
|
return new ArrayList<>(ACTIVE_BOSS_HOLDERS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,9 @@ public class BossMechanicManager implements IMechanicManager<BossEntity, ActiveB
|
|||||||
IMechanic<BossEntity> mechanic = queue.poll();
|
IMechanic<BossEntity> mechanic = queue.poll();
|
||||||
|
|
||||||
if(mechanic == null) continue;
|
if(mechanic == null) continue;
|
||||||
|
|
||||||
|
ServerUtils.get().logDebug("Applying " + mechanic.getClass().getSimpleName());
|
||||||
|
|
||||||
if(didMechanicApplicationFail(mechanic, bossEntity, activeBossHolder)) continue;
|
if(didMechanicApplicationFail(mechanic, bossEntity, activeBossHolder)) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import com.songoda.epicbosses.utils.mechanics.IOptionalMechanic;
|
|||||||
import com.songoda.epicbosses.utils.potion.PotionEffectConverter;
|
import com.songoda.epicbosses.utils.potion.PotionEffectConverter;
|
||||||
import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder;
|
import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -38,7 +39,15 @@ public class PotionMechanic implements IOptionalMechanic<BossEntity> {
|
|||||||
if(livingEntity == null) return false;
|
if(livingEntity == null) return false;
|
||||||
|
|
||||||
if(potionElements != null && !potionElements.isEmpty()) {
|
if(potionElements != null && !potionElements.isEmpty()) {
|
||||||
potionElements.forEach(potionElement -> livingEntity.addPotionEffect(this.potionEffectConverter.from(potionElement)));
|
potionElements.forEach(potionElement -> {
|
||||||
|
PotionEffect potionEffect = this.potionEffectConverter.from(potionElement);
|
||||||
|
|
||||||
|
System.out.println(potionEffect);
|
||||||
|
System.out.println(potionEffect.getAmplifier());
|
||||||
|
System.out.println(potionEffect.getDuration());
|
||||||
|
System.out.println(livingEntity);
|
||||||
|
livingEntity.addPotionEffect(potionEffect);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ public class EntityTypeMechanic implements IPrimaryMechanic<MinionEntity> {
|
|||||||
LivingEntity livingEntity = entityFinder.spawnNewLivingEntity(bossEntityType, activeBossHolder.getLivingEntity().getLocation());
|
LivingEntity livingEntity = entityFinder.spawnNewLivingEntity(bossEntityType, activeBossHolder.getLivingEntity().getLocation());
|
||||||
|
|
||||||
if(livingEntity == null) return false;
|
if(livingEntity == null) return false;
|
||||||
|
if(!activeBossHolder.getMinionEntityMap().isEmpty()) activeBossHolder.killAllMinions(null);
|
||||||
|
|
||||||
activeBossHolder.getMinionEntityMap().put(position, livingEntity);
|
activeBossHolder.getMinionEntityMap().put(position, livingEntity);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public abstract class TargetHandler implements ITarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void runTargetCycle() {
|
public void runTargetCycle() {
|
||||||
ServerUtils.get().runLaterAsync(100L, () -> {
|
ServerUtils.get().runLaterAsync(10L, () -> {
|
||||||
updateTarget();
|
updateTarget();
|
||||||
|
|
||||||
if(!getActiveBossHolder().isDead()) runTargetCycle();
|
if(!getActiveBossHolder().isDead()) runTargetCycle();
|
||||||
|
@ -26,10 +26,10 @@ public enum Message {
|
|||||||
Boss_Create_NoEntitySpecified("&c&l(!) &cNo entity type was specified. Make sure to add an entity type! Possible entity types are: \n&7{0}"),
|
Boss_Create_NoEntitySpecified("&c&l(!) &cNo entity type was specified. Make sure to add an entity type! Possible entity types are: \n&7{0}"),
|
||||||
Boss_Create_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
Boss_Create_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
Boss_Create_SomethingWentWrong("&c&l(!) &cSomething went wrong in the API class while finalising the boss creation."),
|
Boss_Create_SomethingWentWrong("&c&l(!) &cSomething went wrong in the API class while finalising the boss creation."),
|
||||||
Boss_Create_SuccessfullyCreated("&e&lCustomBosses &8» &7A boss has successfully been created with the name &f{0}&7 and the entity type &f{1}&7."),
|
Boss_Create_SuccessfullyCreated("&e&lEpicBosses &8» &7A boss has successfully been created with the name &f{0}&7 and the entity type &f{1}&7."),
|
||||||
|
|
||||||
Boss_Debug_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
Boss_Debug_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
Boss_Debug_Toggled("&e&lCustomBosses &8» &7You have toggled debug mode for &fCustomBosses &7to {0}."),
|
Boss_Debug_Toggled("&e&lEpicBosses &8» &7You have toggled debug mode for &fEpicBosses &7to {0}."),
|
||||||
|
|
||||||
Boss_DropTable_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
Boss_DropTable_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ public enum Message {
|
|||||||
"&e/boss info [name] &8» &7Shows information on the specified boss.\n" +
|
"&e/boss info [name] &8» &7Shows information on the specified boss.\n" +
|
||||||
"&e/boss nearby (radius) &8» &7Shows the nearby bosses.\n" +
|
"&e/boss nearby (radius) &8» &7Shows the nearby bosses.\n" +
|
||||||
"&e/boss reload &8» &7Reloads the boss plugin.\n" +
|
"&e/boss reload &8» &7Reloads the boss plugin.\n" +
|
||||||
|
"&e/boss killall (world) &8» &7Kills all bosses/minions." +
|
||||||
"&7\n" +
|
"&7\n" +
|
||||||
"&7Use /boss help 2 to view the next page.\n" +
|
"&7Use /boss help 2 to view the next page.\n" +
|
||||||
"&8&m----*-----------------------------------*----"),
|
"&8&m----*-----------------------------------*----"),
|
||||||
@ -58,13 +59,41 @@ public enum Message {
|
|||||||
"&e/boss skills &8» &7Shows all current set skills.\n" +
|
"&e/boss skills &8» &7Shows all current set skills.\n" +
|
||||||
"&7\n" +
|
"&7\n" +
|
||||||
"&8&m----*-----------------------------------*----"),
|
"&8&m----*-----------------------------------*----"),
|
||||||
|
Boss_Help_Page3(
|
||||||
|
"&8&m----*--------&6&l[ &e&lBoss Help &7(Page 3) &6&l]&8&m--------*----\n" +
|
||||||
|
"&e/boss debug &8» &7Used to toggle the debug aspect of the plugin.\n" +
|
||||||
|
"&e/boss giveegg [name] [name] &8» &7Used to be given a spawn item of the boss.\n" +
|
||||||
|
"&e/boss list &8» &7Shows all the list of current boss entities.\n" +
|
||||||
|
"&e/boss nearby (radius) &8» &7Shows all nearby bosses.\n" +
|
||||||
|
"&e\n" +
|
||||||
|
"&e\n" +
|
||||||
|
"&7\n" +
|
||||||
|
"&8&m----*-----------------------------------*----"),
|
||||||
|
|
||||||
|
Boss_Info_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
|
Boss_Info_InvalidArgs("&c&l(!) &cYou must use &n/boss info [name]&c to view info on a boss."),
|
||||||
|
Boss_Info_CouldntFindBoss("&c&l(!) &cThe specified boss was not able to be retrieved, please try again."),
|
||||||
|
Boss_Info_Display(
|
||||||
|
"&8&m----*--------&6&l[ &e&l{0} Info &6&l]&8&m--------*----\n" +
|
||||||
|
"&6&lEditing: &f{1}\n" +
|
||||||
|
"&6&lCurrently Active: &f{2}\n" +
|
||||||
|
"&6&lComplete enough to spawn: &f{3}"),
|
||||||
|
|
||||||
Boss_Items_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
Boss_Items_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
|
|
||||||
|
Boss_KillAll_WorldNotFound("&c&l(!) &cThe specified world was not found. If you'd like to kill every boss/minion just use &f/boss killall&c without any arguments."),
|
||||||
|
Boss_KillAll_KilledAll("&e&lEpicBosses &8» &7You have killed {0} boss(es) and minions that were currently active on the server."),
|
||||||
|
Boss_KillAll_KilledWorld("&e&lEpicBosses &8» &7You have killed {0} boss(es) and minions that were in the world {1}."),
|
||||||
|
Boss_KillAll_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
|
|
||||||
|
Boss_List_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
|
|
||||||
Boss_Menu_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
Boss_Menu_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
|
|
||||||
|
Boss_Nearby_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
|
|
||||||
Boss_Reload_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
Boss_Reload_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||||
Boss_Reload_Successful("&e&lCustomBosses &8» &7All boss data has been reloaded. The process took &f{0}ms&7."),
|
Boss_Reload_Successful("&e&lEpicBosses &8» &7All boss data has been reloaded. The process took &f{0}ms&7."),
|
||||||
|
|
||||||
Boss_Skills_NoPermission("&c&l(!) &cYou do not have access to this command.");
|
Boss_Skills_NoPermission("&c&l(!) &cYou do not have access to this command.");
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ public enum Permission {
|
|||||||
admin("boss.admin"),
|
admin("boss.admin"),
|
||||||
create("boss.create"),
|
create("boss.create"),
|
||||||
debug("boss.debug"),
|
debug("boss.debug"),
|
||||||
reload("boss.reload");
|
reload("boss.reload"),
|
||||||
|
nearby("boss.nearby");
|
||||||
|
|
||||||
@Getter private String permission;
|
@Getter private String permission;
|
||||||
|
|
||||||
|
@ -35,8 +35,13 @@ public class PotionEffectConverter implements IConverter<PotionEffectHolder, Pot
|
|||||||
Integer level = potionHolder.getLevel();
|
Integer level = potionHolder.getLevel();
|
||||||
PotionEffectType potionEffectTypeConverted = this.potionEffectTypeConverter.from(potionEffectType);
|
PotionEffectType potionEffectTypeConverted = this.potionEffectTypeConverter.from(potionEffectType);
|
||||||
|
|
||||||
|
if(duration == null) duration = 5;
|
||||||
|
if(level == null) level = 1;
|
||||||
|
|
||||||
|
if(duration < 1) duration = (Integer.MAX_VALUE / 20);
|
||||||
|
|
||||||
if(potionEffectTypeConverted == null) return null;
|
if(potionEffectTypeConverted == null) return null;
|
||||||
if(potionEffectType != null && duration != null && level != null) return new PotionEffect(potionEffectTypeConverted, level-1, (duration*20));
|
if(potionEffectType != null) return new PotionEffect(potionEffectTypeConverted, level-1, (duration*20));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
2
pom.xml
2
pom.xml
@ -19,7 +19,7 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<plugin.version>1.0.0-SNAPSHOT-U48</plugin.version>
|
<plugin.version>1.0.0-SNAPSHOT-U49</plugin.version>
|
||||||
<plugin.name>EpicBosses</plugin.name>
|
<plugin.name>EpicBosses</plugin.name>
|
||||||
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
|
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
|
||||||
<plugin.author>AMinecraftDev</plugin.author>
|
<plugin.author>AMinecraftDev</plugin.author>
|
||||||
|
Loading…
Reference in New Issue
Block a user