Merge branch 'Legacy' into 'Legacy'

COMPLETE: 1.1.8-U4 (Legacy)

See merge request Songoda/EpicBosses!2
This commit is contained in:
Esophose 2019-03-10 22:53:25 +00:00
commit 9eb74f9fcd
13 changed files with 73 additions and 25 deletions

View File

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

5
TODO
View File

@ -5,7 +5,4 @@
-> 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
-----------
8:45 hrs
01:00 -> Biome - Button to change max bosses per biome, boss that autospawn applies to, spawnChance

View File

@ -53,7 +53,8 @@
"otherSkillData": {
"flatType": "IRON_BLOCK",
"wallType": "IRON_FENCE",
"insideType": "WATER"
"insideType": "WATER",
"duration": 5
}
}
}

View File

@ -2072,10 +2072,10 @@ DropTableMainEditorPanel:
name: '&e&lType'
lore:
- '&bCurrently: &f{type}'
- '&7Click this to change the skill type. Keep'
- '&7in mind that when you change your skill'
- '&7type the previous custom data will be erased'
- '&7to make room for the new custom data.'
- '&7Click this to change the drop table type. Keep'
- '&7in mind that when you change your drop table'
- '&7type the previous table data will be erased'
- '&7to make room for the new table format.'
Button: Type
'6':
type: DIAMOND

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

@ -2,11 +2,14 @@ package com.songoda.epicbosses.skills.custom;
import com.songoda.epicbosses.CustomBosses;
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.managers.BossPanelManager;
import com.songoda.epicbosses.managers.BossSkillManager;
import com.songoda.epicbosses.panel.skills.custom.custom.MaterialTypeEditorPanel;
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.Skill;
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.interfaces.IOtherSkillDataElement;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.Debug;
import com.songoda.epicbosses.utils.ObjectUtils;
import com.songoda.epicbosses.utils.ServerUtils;
import com.songoda.epicbosses.utils.*;
import com.songoda.epicbosses.utils.itemstack.converters.MaterialConverter;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
import com.songoda.epicbosses.utils.time.TimeUnit;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import java.util.*;
@ -62,13 +66,14 @@ public class Cage extends CustomSkillHandler {
@Override
public IOtherSkillDataElement getOtherSkillData() {
return new CustomCageSkillElement("IRON_BLOCK", "IRON_BARS", "AIR");
return new CustomCageSkillElement("IRON_BLOCK", "IRON_BARS", "AIR", 5);
}
@Override
public List<ICustomSettingAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
List<ICustomSettingAction> clickActions = new ArrayList<>();
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 wallAction = (event -> this.wallTypeEditor.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("Wall Type Editor", getWallTypeCurrent(customSkillElement), clickStack.clone(), wallAction));
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;
}
@ -96,7 +102,7 @@ public class Cage extends CustomSkillHandler {
livingEntity.teleport(teleportLocation);
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);
getPlayersInCage().remove(uuid);
});
@ -172,6 +178,38 @@ public class Cage extends CustomSkillHandler {
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) {
CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData();

View File

@ -13,11 +13,13 @@ import lombok.Setter;
public class CustomCageSkillElement implements IOtherSkillDataElement {
@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.wallType = wallType;
this.insideType = insideType;
this.duration = duration;
}
}

View File

@ -34,6 +34,6 @@ public class TopDamagerTargetHandler<T extends IActiveHolder> extends TargetHand
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);
}
}

View File

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