mirror of
https://github.com/songoda/EpicBosses.git
synced 2024-09-30 14:27:37 +02:00
Merge branch 'Legacy' into 'Legacy'
COMPLETE: 1.1.8-U4 (Legacy) See merge request Songoda/EpicBosses!2
This commit is contained in:
commit
9eb74f9fcd
@ -4,7 +4,7 @@ stages:
|
|||||||
variables:
|
variables:
|
||||||
name: "EpicBosses"
|
name: "EpicBosses"
|
||||||
path: "/builds/$CI_PROJECT_PATH"
|
path: "/builds/$CI_PROJECT_PATH"
|
||||||
version: "1.0.0"
|
version: "1.1.8-U4"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
|
3
TODO
3
TODO
@ -6,6 +6,3 @@
|
|||||||
01:00 -> Wilderness - Button to change max coords, boss that autospawn applies to, maxActiveBosses, spawnChance
|
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 -> 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
|
01:00 -> Biome - Button to change max bosses per biome, boss that autospawn applies to, spawnChance
|
||||||
|
|
||||||
-----------
|
|
||||||
8:45 hrs
|
|
@ -53,7 +53,8 @@
|
|||||||
"otherSkillData": {
|
"otherSkillData": {
|
||||||
"flatType": "IRON_BLOCK",
|
"flatType": "IRON_BLOCK",
|
||||||
"wallType": "IRON_FENCE",
|
"wallType": "IRON_FENCE",
|
||||||
"insideType": "WATER"
|
"insideType": "WATER",
|
||||||
|
"duration": 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2072,10 +2072,10 @@ DropTableMainEditorPanel:
|
|||||||
name: '&e&lType'
|
name: '&e&lType'
|
||||||
lore:
|
lore:
|
||||||
- '&bCurrently: &f{type}'
|
- '&bCurrently: &f{type}'
|
||||||
- '&7Click this to change the skill type. Keep'
|
- '&7Click this to change the drop table type. Keep'
|
||||||
- '&7in mind that when you change your skill'
|
- '&7in mind that when you change your drop table'
|
||||||
- '&7type the previous custom data will be erased'
|
- '&7type the previous table data will be erased'
|
||||||
- '&7to make room for the new custom data.'
|
- '&7to make room for the new table format.'
|
||||||
Button: Type
|
Button: Type
|
||||||
'6':
|
'6':
|
||||||
type: DIAMOND
|
type: DIAMOND
|
||||||
|
@ -7,6 +7,7 @@ import com.songoda.epicbosses.autospawns.IAutoSpawnCustomSettingsHandler;
|
|||||||
import com.songoda.epicbosses.autospawns.handlers.IntervalSpawnHandler;
|
import com.songoda.epicbosses.autospawns.handlers.IntervalSpawnHandler;
|
||||||
import com.songoda.epicbosses.autospawns.settings.AutoSpawnSettings;
|
import com.songoda.epicbosses.autospawns.settings.AutoSpawnSettings;
|
||||||
import com.songoda.epicbosses.entity.BossEntity;
|
import com.songoda.epicbosses.entity.BossEntity;
|
||||||
|
import com.songoda.epicbosses.events.BossSpawnEvent;
|
||||||
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
||||||
import com.songoda.epicbosses.holder.autospawn.ActiveIntervalAutoSpawnHolder;
|
import com.songoda.epicbosses.holder.autospawn.ActiveIntervalAutoSpawnHolder;
|
||||||
import com.songoda.epicbosses.listeners.IBossDeathHandler;
|
import com.songoda.epicbosses.listeners.IBossDeathHandler;
|
||||||
@ -90,6 +91,10 @@ public class IntervalSpawnElement implements IAutoSpawnCustomSettingsHandler {
|
|||||||
|
|
||||||
activeBossHolder.getPostBossDeathHandlers().add(bossDeathHandler);
|
activeBossHolder.getPostBossDeathHandlers().add(bossDeathHandler);
|
||||||
activeAutoSpawnHolder.getActiveBossHolders().add(activeBossHolder);
|
activeAutoSpawnHolder.getActiveBossHolders().add(activeBossHolder);
|
||||||
|
|
||||||
|
BossSpawnEvent bossSpawnEvent = new BossSpawnEvent(activeBossHolder, true);
|
||||||
|
|
||||||
|
ServerUtils.get().callEvent(bossSpawnEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(customSpawnMessage && spawnMessage != null) {
|
if(customSpawnMessage && spawnMessage != null) {
|
||||||
|
@ -14,10 +14,12 @@ public class BossDeathEvent extends Event {
|
|||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
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.activeBossHolder = activeBossHolder;
|
||||||
|
this.autoSpawn = autoSpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,10 +14,12 @@ public class BossSpawnEvent extends Event {
|
|||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
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.activeBossHolder = activeBossHolder;
|
||||||
|
this.autoSpawn = autoSpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,7 +7,6 @@ import com.songoda.epicbosses.events.BossDeathEvent;
|
|||||||
import com.songoda.epicbosses.events.PreBossDeathEvent;
|
import com.songoda.epicbosses.events.PreBossDeathEvent;
|
||||||
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
||||||
import com.songoda.epicbosses.holder.DeadBossHolder;
|
import com.songoda.epicbosses.holder.DeadBossHolder;
|
||||||
import com.songoda.epicbosses.listeners.IBossDeathHandler;
|
|
||||||
import com.songoda.epicbosses.managers.BossEntityManager;
|
import com.songoda.epicbosses.managers.BossEntityManager;
|
||||||
import com.songoda.epicbosses.utils.Debug;
|
import com.songoda.epicbosses.utils.Debug;
|
||||||
import com.songoda.epicbosses.utils.MessageUtils;
|
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));
|
activeBossHolder.getPostBossDeathHandlers().forEach(handler -> handler.onPreDeath(event));
|
||||||
|
|
||||||
DeadBossHolder deadBossHolder = new DeadBossHolder(bossEntity, location, mapOfDamage, mapOfPercent);
|
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);
|
DropTable dropTable = this.bossEntityManager.getDropTable(bossEntity);
|
||||||
|
|
||||||
if(dropTable == null) {
|
if(dropTable == null) {
|
||||||
|
@ -141,7 +141,7 @@ public class BossSpawnListener implements Listener {
|
|||||||
activeBossHolder.getTargetHandler().runTargetCycle();
|
activeBossHolder.getTargetHandler().runTargetCycle();
|
||||||
this.bossTauntManager.handleTauntSystem(activeBossHolder);
|
this.bossTauntManager.handleTauntSystem(activeBossHolder);
|
||||||
|
|
||||||
BossSpawnEvent bossSpawnEvent = new BossSpawnEvent(activeBossHolder);
|
BossSpawnEvent bossSpawnEvent = new BossSpawnEvent(activeBossHolder, false);
|
||||||
|
|
||||||
ServerUtils.get().callEvent(bossSpawnEvent);
|
ServerUtils.get().callEvent(bossSpawnEvent);
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,14 @@ package com.songoda.epicbosses.skills.custom;
|
|||||||
|
|
||||||
import com.songoda.epicbosses.CustomBosses;
|
import com.songoda.epicbosses.CustomBosses;
|
||||||
import com.songoda.epicbosses.api.BossAPI;
|
import com.songoda.epicbosses.api.BossAPI;
|
||||||
|
import com.songoda.epicbosses.autospawns.AutoSpawn;
|
||||||
|
import com.songoda.epicbosses.autospawns.settings.AutoSpawnSettings;
|
||||||
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
||||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||||
import com.songoda.epicbosses.managers.BossSkillManager;
|
import com.songoda.epicbosses.managers.BossSkillManager;
|
||||||
import com.songoda.epicbosses.panel.skills.custom.custom.MaterialTypeEditorPanel;
|
import com.songoda.epicbosses.panel.skills.custom.custom.MaterialTypeEditorPanel;
|
||||||
import com.songoda.epicbosses.skills.CustomSkillHandler;
|
import com.songoda.epicbosses.skills.CustomSkillHandler;
|
||||||
|
import com.songoda.epicbosses.skills.elements.SubCustomSkillElement;
|
||||||
import com.songoda.epicbosses.skills.interfaces.ICustomSettingAction;
|
import com.songoda.epicbosses.skills.interfaces.ICustomSettingAction;
|
||||||
import com.songoda.epicbosses.skills.Skill;
|
import com.songoda.epicbosses.skills.Skill;
|
||||||
import com.songoda.epicbosses.skills.custom.cage.CageLocationData;
|
import com.songoda.epicbosses.skills.custom.cage.CageLocationData;
|
||||||
@ -14,18 +17,19 @@ import com.songoda.epicbosses.skills.custom.cage.CagePlayerData;
|
|||||||
import com.songoda.epicbosses.skills.elements.CustomCageSkillElement;
|
import com.songoda.epicbosses.skills.elements.CustomCageSkillElement;
|
||||||
import com.songoda.epicbosses.skills.interfaces.IOtherSkillDataElement;
|
import com.songoda.epicbosses.skills.interfaces.IOtherSkillDataElement;
|
||||||
import com.songoda.epicbosses.skills.types.CustomSkillElement;
|
import com.songoda.epicbosses.skills.types.CustomSkillElement;
|
||||||
import com.songoda.epicbosses.utils.Debug;
|
import com.songoda.epicbosses.utils.*;
|
||||||
import com.songoda.epicbosses.utils.ObjectUtils;
|
|
||||||
import com.songoda.epicbosses.utils.ServerUtils;
|
|
||||||
import com.songoda.epicbosses.utils.itemstack.converters.MaterialConverter;
|
import com.songoda.epicbosses.utils.itemstack.converters.MaterialConverter;
|
||||||
import com.songoda.epicbosses.utils.panel.base.ClickAction;
|
import com.songoda.epicbosses.utils.panel.base.ClickAction;
|
||||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||||
|
import com.songoda.epicbosses.utils.time.TimeUnit;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -62,13 +66,14 @@ public class Cage extends CustomSkillHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IOtherSkillDataElement getOtherSkillData() {
|
public IOtherSkillDataElement getOtherSkillData() {
|
||||||
return new CustomCageSkillElement("IRON_BLOCK", "IRON_BARS", "AIR");
|
return new CustomCageSkillElement("IRON_BLOCK", "IRON_BARS", "AIR", 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ICustomSettingAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
|
public List<ICustomSettingAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
|
||||||
List<ICustomSettingAction> clickActions = new ArrayList<>();
|
List<ICustomSettingAction> clickActions = new ArrayList<>();
|
||||||
ItemStack clickStack = new ItemStack(Material.STONE_PLATE);
|
ItemStack clickStack = new ItemStack(Material.STONE_PLATE);
|
||||||
|
ItemStack duration = new ItemStack(Material.WATCH);
|
||||||
ClickAction flatAction = (event -> this.flatTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
|
ClickAction flatAction = (event -> this.flatTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
|
||||||
ClickAction wallAction = (event -> this.wallTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
|
ClickAction wallAction = (event -> this.wallTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
|
||||||
ClickAction insideAction = (event -> this.insideTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
|
ClickAction insideAction = (event -> this.insideTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
|
||||||
@ -76,6 +81,7 @@ public class Cage extends CustomSkillHandler {
|
|||||||
clickActions.add(BossSkillManager.createCustomSkillAction("Flat Type Editor", getFlatTypeCurrent(customSkillElement), clickStack.clone(), flatAction));
|
clickActions.add(BossSkillManager.createCustomSkillAction("Flat Type Editor", getFlatTypeCurrent(customSkillElement), clickStack.clone(), flatAction));
|
||||||
clickActions.add(BossSkillManager.createCustomSkillAction("Wall Type Editor", getWallTypeCurrent(customSkillElement), clickStack.clone(), wallAction));
|
clickActions.add(BossSkillManager.createCustomSkillAction("Wall Type Editor", getWallTypeCurrent(customSkillElement), clickStack.clone(), wallAction));
|
||||||
clickActions.add(BossSkillManager.createCustomSkillAction("Inside Type Editor", getInsideTypeCurrent(customSkillElement), clickStack.clone(), insideAction));
|
clickActions.add(BossSkillManager.createCustomSkillAction("Inside Type Editor", getInsideTypeCurrent(customSkillElement), clickStack.clone(), insideAction));
|
||||||
|
clickActions.add(BossSkillManager.createCustomSkillAction("Cage Duration", NumberUtils.get().formatDouble(getCurrentDuration(customSkillElement)), duration.clone(), getDurationAction(skill, customSkillElement)));
|
||||||
|
|
||||||
return clickActions;
|
return clickActions;
|
||||||
}
|
}
|
||||||
@ -96,7 +102,7 @@ public class Cage extends CustomSkillHandler {
|
|||||||
livingEntity.teleport(teleportLocation);
|
livingEntity.teleport(teleportLocation);
|
||||||
|
|
||||||
ServerUtils.get().runLater(1L, () -> setCageBlocks(cagePlayerData, customSkillElement.getCustom().getCustomCageSkillData(), skill));
|
ServerUtils.get().runLater(1L, () -> setCageBlocks(cagePlayerData, customSkillElement.getCustom().getCustomCageSkillData(), skill));
|
||||||
ServerUtils.get().runLater(100L, () -> {
|
ServerUtils.get().runLater((long) TimeUnit.SECONDS.to(TimeUnit.TICK, getCurrentDuration(customSkillElement)), () -> {
|
||||||
restoreCageBlocks(cagePlayerData);
|
restoreCageBlocks(cagePlayerData);
|
||||||
getPlayersInCage().remove(uuid);
|
getPlayersInCage().remove(uuid);
|
||||||
});
|
});
|
||||||
@ -172,6 +178,38 @@ public class Cage extends CustomSkillHandler {
|
|||||||
return currentLocation.clone().add(0.5, 0, 0.5);
|
return currentLocation.clone().add(0.5, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getCurrentDuration(CustomSkillElement customSkillElement) {
|
||||||
|
CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData();
|
||||||
|
|
||||||
|
return ObjectUtils.getValue(customCageSkillElement.getDuration(), 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClickAction getDurationAction(Skill skill, CustomSkillElement customSkillElement) {
|
||||||
|
return event -> {
|
||||||
|
ClickType clickType = event.getClick();
|
||||||
|
int amountToModifyBy;
|
||||||
|
|
||||||
|
if(clickType.name().contains("RIGHT")) {
|
||||||
|
amountToModifyBy = -1;
|
||||||
|
} else {
|
||||||
|
amountToModifyBy = +1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SubCustomSkillElement subCustomSkillElement = customSkillElement.getCustom();
|
||||||
|
CustomCageSkillElement customCageSkillElement = subCustomSkillElement.getCustomCageSkillData();
|
||||||
|
int currentAmount = ObjectUtils.getValue(customCageSkillElement.getDuration(), 5);
|
||||||
|
int newAmount = currentAmount + amountToModifyBy;
|
||||||
|
|
||||||
|
if(newAmount <= 1) newAmount = 1;
|
||||||
|
|
||||||
|
customCageSkillElement.setDuration(newAmount);
|
||||||
|
subCustomSkillElement.setOtherSkillData(BossAPI.convertObjectToJsonObject(customCageSkillElement));
|
||||||
|
customSkillElement.setCustom(subCustomSkillElement);
|
||||||
|
skill.setCustomData(BossAPI.convertObjectToJsonObject(customSkillElement));
|
||||||
|
this.plugin.getSkillsFileManager().save();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private String getFlatTypeCurrent(CustomSkillElement customSkillElement) {
|
private String getFlatTypeCurrent(CustomSkillElement customSkillElement) {
|
||||||
CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData();
|
CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData();
|
||||||
|
|
||||||
|
@ -13,11 +13,13 @@ import lombok.Setter;
|
|||||||
public class CustomCageSkillElement implements IOtherSkillDataElement {
|
public class CustomCageSkillElement implements IOtherSkillDataElement {
|
||||||
|
|
||||||
@Expose @Getter @Setter private String flatType, wallType, insideType;
|
@Expose @Getter @Setter private String flatType, wallType, insideType;
|
||||||
|
@Expose @Getter @Setter private int duration;
|
||||||
|
|
||||||
public CustomCageSkillElement(String flatType, String wallType, String insideType) {
|
public CustomCageSkillElement(String flatType, String wallType, String insideType, int duration) {
|
||||||
this.flatType = flatType;
|
this.flatType = flatType;
|
||||||
this.wallType = wallType;
|
this.wallType = wallType;
|
||||||
this.insideType = insideType;
|
this.insideType = insideType;
|
||||||
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,6 @@ public class TopDamagerTargetHandler<T extends IActiveHolder> extends TargetHand
|
|||||||
|
|
||||||
Map<LivingEntity, Double> sortedMap = MapUtils.get().sortByValue(nearbyDamages);
|
Map<LivingEntity, Double> sortedMap = MapUtils.get().sortByValue(nearbyDamages);
|
||||||
|
|
||||||
return sortedMap.keySet().stream().filter(livingEntity1 -> livingEntity1 != null && livingEntity1.isDead()).findFirst().orElse(null);
|
return sortedMap.keySet().stream().filter(livingEntity1 -> livingEntity1 != null && !livingEntity1.isDead()).findFirst().orElse(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
pom.xml
2
pom.xml
@ -19,7 +19,7 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<plugin.version>1.0.8-U1</plugin.version>
|
<plugin.version>1.1.8-U4</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