Converted more versioning.
This commit is contained in:
parent
5b8c5f47e0
commit
0eae353afa
|
@ -61,23 +61,38 @@
|
|||
},
|
||||
"SKHelmet": {
|
||||
"type": "GOLDEN_HELMET",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ]
|
||||
"enchants": [
|
||||
"protection:4",
|
||||
"unbreaking:3"
|
||||
]
|
||||
},
|
||||
"SKChestplate": {
|
||||
"type": "GOLDEN_CHESTPLATE",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ]
|
||||
"enchants": [
|
||||
"protection:4",
|
||||
"unbreaking:3"
|
||||
]
|
||||
},
|
||||
"SKLeggings": {
|
||||
"type": "GOLDEN_LEGGINGS",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ]
|
||||
"enchants": [
|
||||
"protection:4",
|
||||
"unbreaking:3"
|
||||
]
|
||||
},
|
||||
"SKBoots": {
|
||||
"type": "DIAMOND_BOOTS",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ]
|
||||
"enchants": [
|
||||
"protection:4",
|
||||
"unbreaking:3"
|
||||
]
|
||||
},
|
||||
"SKMainHand": {
|
||||
"type": "DIAMOND_SWORD",
|
||||
"enchants": [ "sharpness:4", "unbreaking:3" ]
|
||||
"enchants": [
|
||||
"sharpness:4",
|
||||
"unbreaking:3"
|
||||
]
|
||||
},
|
||||
"SKOffHand": {
|
||||
"type": "SHIELD"
|
||||
|
|
|
@ -5,24 +5,24 @@ Display:
|
|||
selectedName: '&bMessage: &f{name} &a&l** Selected **'
|
||||
name: '&bMessage: &f{name}'
|
||||
lore:
|
||||
- '&fStrings within this section:'
|
||||
- '{message}'
|
||||
- '&fStrings within this section:'
|
||||
- '{message}'
|
||||
Commands:
|
||||
menuName: '&b&l{name} Editor'
|
||||
selectedName: '&bCommand: &f{name} &a&l** Selected **'
|
||||
name: '&bCommand: &f{name}'
|
||||
lore:
|
||||
- '&fCommands within this section:'
|
||||
- '{commands}'
|
||||
- '&fCommands within this section:'
|
||||
- '{commands}'
|
||||
Taunts:
|
||||
menuName: '&b&l{name} Editor'
|
||||
Drops:
|
||||
name: '&bDropTable: &f{name}'
|
||||
lore:
|
||||
- '&3Type: &7{type}'
|
||||
- '&7'
|
||||
- '&7Click here to select this drop'
|
||||
- '&7table as the current one.'
|
||||
- '&3Type: &7{type}'
|
||||
- '&7'
|
||||
- '&7Click here to select this drop'
|
||||
- '&7table as the current one.'
|
||||
Equipment:
|
||||
name: '{name} &a&l** Selected **'
|
||||
EntityType:
|
||||
|
@ -32,144 +32,144 @@ Display:
|
|||
List:
|
||||
name: '&3{position} Entity'
|
||||
lore:
|
||||
- '&3Left Click &8»'
|
||||
- '&7Edit the {targetType} for this'
|
||||
- '&7entity in the section.'
|
||||
- '&7'
|
||||
- '&3Right Click &8»'
|
||||
- '&7Remove this section, can be done'
|
||||
- '&7to anything above the first one.'
|
||||
- '&3Left Click &8»'
|
||||
- '&7Edit the {targetType} for this'
|
||||
- '&7entity in the section.'
|
||||
- '&7'
|
||||
- '&3Right Click &8»'
|
||||
- '&7Remove this section, can be done'
|
||||
- '&7to anything above the first one.'
|
||||
Skills:
|
||||
menuName: '&b&l{name} Editor'
|
||||
selectedName: '&b&l{name} Skill &a&l** Selected **'
|
||||
name: '&b&l{name} Skill'
|
||||
lore:
|
||||
- '&3Type: &7{type}'
|
||||
- '&3Display Name: &7{displayName}'
|
||||
- '&3Custom Message: &7{customMessage}'
|
||||
- '&3Radius: &7{radius}'
|
||||
- '&7'
|
||||
- '&7Click to add/remove the skill to'
|
||||
- '&7or from the boss skill list.'
|
||||
- '&3Type: &7{type}'
|
||||
- '&3Display Name: &7{displayName}'
|
||||
- '&3Custom Message: &7{customMessage}'
|
||||
- '&3Radius: &7{radius}'
|
||||
- '&7'
|
||||
- '&7Click to add/remove the skill to'
|
||||
- '&7or from the boss skill list.'
|
||||
AutoSpawns:
|
||||
Main:
|
||||
menuName: '&b&lEpicBosses &3&lAutoSpawns'
|
||||
name: '&bAuto Spawn: &f{name}'
|
||||
lore:
|
||||
- '&3Editing: &f{enabled}'
|
||||
- '&7'
|
||||
- '&3Spawn Type: &f{type}'
|
||||
- '&3Entities: &f{entities}'
|
||||
- '&7'
|
||||
- '&3Max Alive: &f{maxAlive}'
|
||||
- '&3Amount per Spawn: &f{amountPerSpawn}'
|
||||
- '&3When Chunk Isnt Loaded: &f{chunkIsntLoaded}'
|
||||
- '&3Override Spawn Messages: &f{overrideSpawnMessages}'
|
||||
- '&3Shuffle Entities: &f{shuffleEntities}'
|
||||
- '&3Custom Spawn Message: &f{customSpawnMessage}'
|
||||
- '&3Editing: &f{enabled}'
|
||||
- '&7'
|
||||
- '&3Spawn Type: &f{type}'
|
||||
- '&3Entities: &f{entities}'
|
||||
- '&7'
|
||||
- '&3Max Alive: &f{maxAlive}'
|
||||
- '&3Amount per Spawn: &f{amountPerSpawn}'
|
||||
- '&3When Chunk Isnt Loaded: &f{chunkIsntLoaded}'
|
||||
- '&3Override Spawn Messages: &f{overrideSpawnMessages}'
|
||||
- '&3Shuffle Entities: &f{shuffleEntities}'
|
||||
- '&3Custom Spawn Message: &f{customSpawnMessage}'
|
||||
Entities:
|
||||
selectedName: '&bBoss: &f{name} &a** Selected **'
|
||||
name: '&bBoss: &f{name}'
|
||||
lore:
|
||||
- '&3Editing: &f{editing}'
|
||||
- '&3Targeting: &f{targeting}'
|
||||
- '&3Drop Table: &f{dropTable}'
|
||||
- '&7'
|
||||
- '&7Click to select or deselect this boss.'
|
||||
- '&3Editing: &f{editing}'
|
||||
- '&3Targeting: &f{targeting}'
|
||||
- '&3Drop Table: &f{dropTable}'
|
||||
- '&7'
|
||||
- '&7Click to select or deselect this boss.'
|
||||
CustomSettings:
|
||||
name: '&bCustom Setting: &f{name}'
|
||||
lore:
|
||||
- '&3Currently: &f{currently}'
|
||||
- '{extraInformation}'
|
||||
- '&3Currently: &f{currently}'
|
||||
- '{extraInformation}'
|
||||
SpawnMessage:
|
||||
menuName: '&b&l{name} AutoSpawn'
|
||||
selectedName: '&bMessage: &f{name} &a** Selected **'
|
||||
name: '&bMessage: &f{name}'
|
||||
lore:
|
||||
- '&fStrings within this section:'
|
||||
- '{message}'
|
||||
- '&fStrings within this section:'
|
||||
- '{message}'
|
||||
Bosses:
|
||||
menuName: '&b&lEpicBosses &3&lBosses'
|
||||
name: '&b&l{name}'
|
||||
lore:
|
||||
- '&3Editing: &f{enabled}'
|
||||
- '&7'
|
||||
- '&3Left Click &8»'
|
||||
- '&7Get spawn item for custom'
|
||||
- '&7boss.'
|
||||
- '&7'
|
||||
- '&3Right Click &8»'
|
||||
- '&7Edit the custom boss.'
|
||||
- '&3Editing: &f{enabled}'
|
||||
- '&7'
|
||||
- '&3Left Click &8»'
|
||||
- '&7Get spawn item for custom'
|
||||
- '&7boss.'
|
||||
- '&7'
|
||||
- '&3Right Click &8»'
|
||||
- '&7Edit the custom boss.'
|
||||
DropTable:
|
||||
Main:
|
||||
menuName: '&b&lEpicBosses &3&lDropTables'
|
||||
name: '&b&l{name} Drop Table'
|
||||
lore:
|
||||
- '&3Type: &7{type}'
|
||||
- '&7'
|
||||
- '&7Click to edit the drop table.'
|
||||
- '&3Type: &7{type}'
|
||||
- '&7'
|
||||
- '&7Click to edit the drop table.'
|
||||
RewardList:
|
||||
name: '&bReward Section'
|
||||
lore:
|
||||
- '&3Selected Item: &f{itemName}'
|
||||
- '&3Chance: &f{chance}%'
|
||||
- '&7'
|
||||
- '&7Click to modify this reward.'
|
||||
- '&3Selected Item: &f{itemName}'
|
||||
- '&3Chance: &f{chance}%'
|
||||
- '&7'
|
||||
- '&7Click to modify this reward.'
|
||||
CommandRewardList:
|
||||
name: '&bReward Section'
|
||||
lore:
|
||||
- '&3Selected Command: &f{commandName}'
|
||||
- '&3Chance: &f{chance}%'
|
||||
- '&7'
|
||||
- '&7Click to modify this reward.'
|
||||
- '&3Selected Command: &f{commandName}'
|
||||
- '&3Chance: &f{chance}%'
|
||||
- '&7'
|
||||
- '&7Click to modify this reward.'
|
||||
GivePositionList:
|
||||
name: '&bReward Section'
|
||||
lore:
|
||||
- '&3Position: &f{position}'
|
||||
- '&3Drops: &f{dropAmount}'
|
||||
- '&7'
|
||||
- '&7Shift Right-Click to remove.'
|
||||
- '&7Left-Click to edit.'
|
||||
- '&3Position: &f{position}'
|
||||
- '&3Drops: &f{dropAmount}'
|
||||
- '&7'
|
||||
- '&7Shift Right-Click to remove.'
|
||||
- '&7Left-Click to edit.'
|
||||
GiveRewardsList:
|
||||
name: '&bReward Section'
|
||||
lore:
|
||||
- '&3Position: &f{position}'
|
||||
- '&3Required Percentage: &f{percentage}%'
|
||||
- '&7'
|
||||
- '&3Item Drops: &f{items}'
|
||||
- '&3Max Drops: &f{maxDrops}'
|
||||
- '&3Random Drops: &f{randomDrops}'
|
||||
- '&7'
|
||||
- '&3Command Drops: &f{commands}'
|
||||
- '&3Max Commands: &f{maxCommands}'
|
||||
- '&3Random Commands: &f{randomCommands}'
|
||||
- '&7'
|
||||
- '&7Shift Right-Click to remove.'
|
||||
- '&7Left-Click to edit.'
|
||||
- '&3Position: &f{position}'
|
||||
- '&3Required Percentage: &f{percentage}%'
|
||||
- '&7'
|
||||
- '&3Item Drops: &f{items}'
|
||||
- '&3Max Drops: &f{maxDrops}'
|
||||
- '&3Random Drops: &f{randomDrops}'
|
||||
- '&7'
|
||||
- '&3Command Drops: &f{commands}'
|
||||
- '&3Max Commands: &f{maxCommands}'
|
||||
- '&3Random Commands: &f{randomCommands}'
|
||||
- '&7'
|
||||
- '&7Shift Right-Click to remove.'
|
||||
- '&7Left-Click to edit.'
|
||||
Shop:
|
||||
name: '&b&lBuy {name}''s Egg'
|
||||
lore:
|
||||
- '&3Cost: &a$&f{price}'
|
||||
- '&3Cost: &a$&f{price}'
|
||||
Skills:
|
||||
Main:
|
||||
menuName: '&b&lEpicBosses &3&lSkills'
|
||||
name: '&b&l{name} Skill'
|
||||
lore:
|
||||
- '&3Type: &7{type}'
|
||||
- '&3Display Name: &7{displayName}'
|
||||
- '&3Custom Message: &7{customMessage}'
|
||||
- '&3Radius: &7{radius}'
|
||||
- '&7'
|
||||
- '&7Click to edit the custom skill.'
|
||||
- '&3Type: &7{type}'
|
||||
- '&3Display Name: &7{displayName}'
|
||||
- '&3Custom Message: &7{customMessage}'
|
||||
- '&3Radius: &7{radius}'
|
||||
- '&7'
|
||||
- '&7Click to edit the custom skill.'
|
||||
MainEdit:
|
||||
menuName: '&b&l{name} Skill Editor'
|
||||
Potions:
|
||||
name: '&b&l{effect} Potion Effect'
|
||||
lore:
|
||||
- '&3Duration: &7{duration}'
|
||||
- '&3Level: &7{level}'
|
||||
- '&7'
|
||||
- '&7Click to remove potion effect.'
|
||||
- '&3Duration: &7{duration}'
|
||||
- '&3Level: &7{level}'
|
||||
- '&7'
|
||||
- '&7Click to remove potion effect.'
|
||||
CreatePotion:
|
||||
menuName: '&b&lSelect Potion Effect Type'
|
||||
name: '&bEffect: &f{effect}'
|
||||
|
@ -177,35 +177,35 @@ Display:
|
|||
Commands:
|
||||
name: '&b&lCommand Section'
|
||||
lore:
|
||||
- '&3Chance &8» &f{chance}%'
|
||||
- '&7'
|
||||
- '&3Commands &8»'
|
||||
- '&f{commands}'
|
||||
- '&7'
|
||||
- '&7Click to edit command section.'
|
||||
- '&3Chance &8» &f{chance}%'
|
||||
- '&7'
|
||||
- '&3Commands &8»'
|
||||
- '&f{commands}'
|
||||
- '&7'
|
||||
- '&7Click to edit command section.'
|
||||
CommandList:
|
||||
menuName: '&b&l{name} Skill Editor'
|
||||
selectedName: '&bCommand: &f{name} &a&l** Selected **'
|
||||
name: '&bCommand: &f{name}'
|
||||
lore:
|
||||
- '&fCommands within this section:'
|
||||
- '{commands}'
|
||||
- '&fCommands within this section:'
|
||||
- '{commands}'
|
||||
Group:
|
||||
menuName: '&b&l{name} Skill Editor'
|
||||
selectedName: '&bSkill: &f{name} &a&l** Selected **'
|
||||
name: '&bSkill: &f{name}'
|
||||
lore:
|
||||
- '&3Mode: &7{mode}'
|
||||
- '&3Type: &7{type}'
|
||||
- '&3Display Name: &7{displayName}'
|
||||
- '&3Custom Message: &7{customMessage}'
|
||||
- '&3Radius: &7{radius}'
|
||||
- '&3Mode: &7{mode}'
|
||||
- '&3Type: &7{type}'
|
||||
- '&3Display Name: &7{displayName}'
|
||||
- '&3Custom Message: &7{customMessage}'
|
||||
- '&3Radius: &7{radius}'
|
||||
CustomType:
|
||||
selectedName: '&bCustom Skill: &f{name} &a** Selected **'
|
||||
name: '&bCustom Skill: &f{name}'
|
||||
lore:
|
||||
- '&3Uses Multiplier: &7{multiplier}'
|
||||
- '&3Has Custom Data: &7{customData}'
|
||||
- '&3Uses Multiplier: &7{multiplier}'
|
||||
- '&3Has Custom Data: &7{customData}'
|
||||
Material:
|
||||
menuName: '&b&lSelect Material'
|
||||
selectedName: '&bMaterial: &f{type} &a** Selected **'
|
||||
|
@ -215,9 +215,9 @@ Display:
|
|||
selectedName: '&bMinion: &f{name} &a** Selected **'
|
||||
name: '&bMinion: &f{name}'
|
||||
lore:
|
||||
- '&3Editing: &7{editing}'
|
||||
- '&3Targeting: &7{targeting}'
|
||||
- '&3Editing: &7{editing}'
|
||||
- '&3Targeting: &7{targeting}'
|
||||
CustomSetting:
|
||||
name: '&bSetting: &f{setting}'
|
||||
lore:
|
||||
- '&3Currently: &7{currently}'
|
||||
- '&3Currently: &7{currently}'
|
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,6 @@ import com.songoda.epicbosses.utils.IReloadable;
|
|||
import com.songoda.epicbosses.utils.Message;
|
||||
import com.songoda.epicbosses.utils.ServerUtils;
|
||||
import com.songoda.epicbosses.utils.file.YmlFileHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
@ -66,7 +65,6 @@ public class EpicBosses extends SongodaPlugin implements IReloadable {
|
|||
private MinionMechanicManager minionMechanicManager;
|
||||
private MinionEntityContainer minionEntityContainer;
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
private DebugManager debugManager = new DebugManager();
|
||||
|
||||
private YmlFileHandler langFileHandler, editorFileHandler, displayFileHandler;
|
||||
|
@ -74,6 +72,10 @@ public class EpicBosses extends SongodaPlugin implements IReloadable {
|
|||
|
||||
private boolean debug = true;
|
||||
|
||||
public static EpicBosses getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginLoad() {
|
||||
INSTANCE = this;
|
||||
|
@ -241,10 +243,6 @@ public class EpicBosses extends SongodaPlugin implements IReloadable {
|
|||
Message.setFile(lang);
|
||||
}
|
||||
|
||||
public static EpicBosses getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public MessagesFileManager getBossMessagesFileManager() {
|
||||
return this.bossMessagesFileManager;
|
||||
}
|
||||
|
@ -341,10 +339,6 @@ public class EpicBosses extends SongodaPlugin implements IReloadable {
|
|||
return this.minionEntityContainer;
|
||||
}
|
||||
|
||||
public VersionHandler getVersionHandler() {
|
||||
return this.versionHandler;
|
||||
}
|
||||
|
||||
public DebugManager getDebugManager() {
|
||||
return this.debugManager;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class AutoSpawn {
|
|||
}
|
||||
|
||||
public IntervalSpawnElement getIntervalSpawnData() {
|
||||
if(getType().equalsIgnoreCase("INTERVAL")) {
|
||||
if (getType().equalsIgnoreCase("INTERVAL")) {
|
||||
return BossesGson.get().fromJson(this.customData, IntervalSpawnElement.class);
|
||||
}
|
||||
|
||||
|
@ -41,11 +41,11 @@ public class AutoSpawn {
|
|||
}
|
||||
|
||||
public boolean isCompleteEnoughToSpawn() {
|
||||
if(this.type == null) return false;
|
||||
if (this.type == null) return false;
|
||||
|
||||
List<String> entities = getEntities();
|
||||
|
||||
if(entities == null || entities.isEmpty()) return false;
|
||||
if (entities == null || entities.isEmpty()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -54,38 +54,38 @@ public class AutoSpawn {
|
|||
return this.editing;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public List<String> getEntities() {
|
||||
return this.entities;
|
||||
}
|
||||
|
||||
public AutoSpawnSettings getAutoSpawnSettings() {
|
||||
return this.autoSpawnSettings;
|
||||
}
|
||||
|
||||
public JsonObject getCustomData() {
|
||||
return this.customData;
|
||||
}
|
||||
|
||||
public void setEditing(boolean editing) {
|
||||
this.editing = editing;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<String> getEntities() {
|
||||
return this.entities;
|
||||
}
|
||||
|
||||
public void setEntities(List<String> entities) {
|
||||
this.entities = entities;
|
||||
}
|
||||
|
||||
public AutoSpawnSettings getAutoSpawnSettings() {
|
||||
return this.autoSpawnSettings;
|
||||
}
|
||||
|
||||
public void setAutoSpawnSettings(AutoSpawnSettings autoSpawnSettings) {
|
||||
this.autoSpawnSettings = autoSpawnSettings;
|
||||
}
|
||||
|
||||
public JsonObject getCustomData() {
|
||||
return this.customData;
|
||||
}
|
||||
|
||||
public void setCustomData(JsonObject customData) {
|
||||
this.customData = customData;
|
||||
}
|
||||
|
|
|
@ -19,15 +19,11 @@ public enum SpawnType {
|
|||
this.rank = rank;
|
||||
}
|
||||
|
||||
public SpawnType getNext() {
|
||||
return get(this.rank+1);
|
||||
}
|
||||
|
||||
public static SpawnType getCurrent(String input) {
|
||||
if(input == null || input.isEmpty()) return BLANK;
|
||||
if (input == null || input.isEmpty()) return BLANK;
|
||||
|
||||
for(SpawnType spawnTypes : values()) {
|
||||
if(spawnTypes.name().equalsIgnoreCase(input)) return spawnTypes;
|
||||
for (SpawnType spawnTypes : values()) {
|
||||
if (spawnTypes.name().equalsIgnoreCase(input)) return spawnTypes;
|
||||
}
|
||||
|
||||
return BLANK;
|
||||
|
@ -36,20 +32,24 @@ public enum SpawnType {
|
|||
public static List<SpawnType> getSpawnTypes() {
|
||||
List<SpawnType> list = new ArrayList<>();
|
||||
|
||||
for(SpawnType spawnTypes : values()) {
|
||||
if(spawnTypes.rank > 0) list.add(spawnTypes);
|
||||
for (SpawnType spawnTypes : values()) {
|
||||
if (spawnTypes.rank > 0) list.add(spawnTypes);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static SpawnType get(int rank) {
|
||||
for(SpawnType spawnTypes : values()) {
|
||||
if(spawnTypes.rank == rank) {
|
||||
for (SpawnType spawnTypes : values()) {
|
||||
if (spawnTypes.rank == rank) {
|
||||
return spawnTypes;
|
||||
}
|
||||
}
|
||||
|
||||
return INTERVAL;
|
||||
}
|
||||
|
||||
public SpawnType getNext() {
|
||||
return get(this.rank + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,11 +78,11 @@ public class IntervalSpawnHandler {
|
|||
ClickType clickType = event.getClick();
|
||||
int amountToModifyBy;
|
||||
|
||||
if(clickType == ClickType.SHIFT_LEFT) {
|
||||
if (clickType == ClickType.SHIFT_LEFT) {
|
||||
amountToModifyBy = 10;
|
||||
} else if(clickType == ClickType.RIGHT) {
|
||||
} else if (clickType == ClickType.RIGHT) {
|
||||
amountToModifyBy = -1;
|
||||
} else if(clickType == ClickType.SHIFT_RIGHT) {
|
||||
} else if (clickType == ClickType.SHIFT_RIGHT) {
|
||||
amountToModifyBy = -10;
|
||||
} else {
|
||||
amountToModifyBy = 1;
|
||||
|
@ -92,7 +92,7 @@ public class IntervalSpawnHandler {
|
|||
String modifyValue;
|
||||
int newAmount;
|
||||
|
||||
if(amountToModifyBy > 0) {
|
||||
if (amountToModifyBy > 0) {
|
||||
modifyValue = "increased";
|
||||
newAmount = currentAmount + amountToModifyBy;
|
||||
} else {
|
||||
|
@ -100,7 +100,7 @@ public class IntervalSpawnHandler {
|
|||
newAmount = currentAmount + amountToModifyBy;
|
||||
}
|
||||
|
||||
if(newAmount <= 0) {
|
||||
if (newAmount <= 0) {
|
||||
newAmount = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,46 +27,46 @@ public class AutoSpawnSettings {
|
|||
return this.maxAliveAtOnce;
|
||||
}
|
||||
|
||||
public Integer getAmountPerSpawn() {
|
||||
return this.amountPerSpawn;
|
||||
}
|
||||
|
||||
public Boolean getSpawnWhenChunkIsntLoaded() {
|
||||
return this.spawnWhenChunkIsntLoaded;
|
||||
}
|
||||
|
||||
public Boolean getOverrideDefaultSpawnMessage() {
|
||||
return this.overrideDefaultSpawnMessage;
|
||||
}
|
||||
|
||||
public Boolean getShuffleEntitiesList() {
|
||||
return this.shuffleEntitiesList;
|
||||
}
|
||||
|
||||
public String getSpawnMessage() {
|
||||
return this.spawnMessage;
|
||||
}
|
||||
|
||||
public void setMaxAliveAtOnce(Integer maxAliveAtOnce) {
|
||||
this.maxAliveAtOnce = maxAliveAtOnce;
|
||||
}
|
||||
|
||||
public Integer getAmountPerSpawn() {
|
||||
return this.amountPerSpawn;
|
||||
}
|
||||
|
||||
public void setAmountPerSpawn(Integer amountPerSpawn) {
|
||||
this.amountPerSpawn = amountPerSpawn;
|
||||
}
|
||||
|
||||
public Boolean getSpawnWhenChunkIsntLoaded() {
|
||||
return this.spawnWhenChunkIsntLoaded;
|
||||
}
|
||||
|
||||
public void setSpawnWhenChunkIsntLoaded(Boolean spawnWhenChunkIsntLoaded) {
|
||||
this.spawnWhenChunkIsntLoaded = spawnWhenChunkIsntLoaded;
|
||||
}
|
||||
|
||||
public Boolean getOverrideDefaultSpawnMessage() {
|
||||
return this.overrideDefaultSpawnMessage;
|
||||
}
|
||||
|
||||
public void setOverrideDefaultSpawnMessage(Boolean overrideDefaultSpawnMessage) {
|
||||
this.overrideDefaultSpawnMessage = overrideDefaultSpawnMessage;
|
||||
}
|
||||
|
||||
public Boolean getShuffleEntitiesList() {
|
||||
return this.shuffleEntitiesList;
|
||||
}
|
||||
|
||||
public void setShuffleEntitiesList(Boolean shuffleEntitiesList) {
|
||||
this.shuffleEntitiesList = shuffleEntitiesList;
|
||||
}
|
||||
|
||||
public String getSpawnMessage() {
|
||||
return this.spawnMessage;
|
||||
}
|
||||
|
||||
public void setSpawnMessage(String spawnMessage) {
|
||||
this.spawnMessage = spawnMessage;
|
||||
}
|
||||
|
|
|
@ -54,10 +54,10 @@ public class IntervalSpawnElement implements IAutoSpawnCustomSettingsHandler {
|
|||
ClickAction placeholderAction = intervalSpawnHandler.getPlaceholderAction(this, autoSpawn, variablePanelHandler);
|
||||
ClickAction spawnRateAction = intervalSpawnHandler.getSpawnRateAction(this, autoSpawn, variablePanelHandler);
|
||||
|
||||
clickActions.add(AutoSpawnManager.createAutoSpawnAction("Spawn After Last Boss Is Killed", getSpawnAfterLastBossIsKilled()+"", intervalSpawnHandler.getSpawnAfterLastBossIsKilledExtraInformation(), clickStack.clone(), lastBossKilledAction));
|
||||
clickActions.add(AutoSpawnManager.createAutoSpawnAction("Spawn After Last Boss Is Killed", getSpawnAfterLastBossIsKilled() + "", intervalSpawnHandler.getSpawnAfterLastBossIsKilledExtraInformation(), clickStack.clone(), lastBossKilledAction));
|
||||
clickActions.add(AutoSpawnManager.createAutoSpawnAction("Location", getLocation(), intervalSpawnHandler.getLocationExtraInformation(), clickStack.clone(), locationAction));
|
||||
clickActions.add(AutoSpawnManager.createAutoSpawnAction("Placeholder", getPlaceholder(), intervalSpawnHandler.getPlaceholderExtraInformation(), clickStack.clone(), placeholderAction));
|
||||
clickActions.add(AutoSpawnManager.createAutoSpawnAction("Spawn Rate", getSpawnRate()+"", intervalSpawnHandler.getSpawnRateExtraInformation(), clickStack.clone(), spawnRateAction));
|
||||
clickActions.add(AutoSpawnManager.createAutoSpawnAction("Spawn Rate", getSpawnRate() + "", intervalSpawnHandler.getSpawnRateExtraInformation(), clickStack.clone(), spawnRateAction));
|
||||
|
||||
return clickActions;
|
||||
}
|
||||
|
@ -73,22 +73,22 @@ public class IntervalSpawnElement implements IAutoSpawnCustomSettingsHandler {
|
|||
List<String> bosses = autoSpawn.getEntities();
|
||||
Location location = getSpawnLocation();
|
||||
|
||||
if(bosses == null || bosses.isEmpty()) {
|
||||
if (bosses == null || bosses.isEmpty()) {
|
||||
ServerUtils.get().logDebug("BOSSES IS EMPTY!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(shuffleList) Collections.shuffle(bosses);
|
||||
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);
|
||||
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;
|
||||
if (activeBossHolder == null) continue;
|
||||
|
||||
activeBossHolder.getPostBossDeathHandlers().add(bossDeathHandler);
|
||||
activeAutoSpawnHolder.getActiveBossHolders().add(activeBossHolder);
|
||||
|
@ -97,7 +97,7 @@ public class IntervalSpawnElement implements IAutoSpawnCustomSettingsHandler {
|
|||
ServerUtils.get().callEvent(bossSpawnEvent);
|
||||
}
|
||||
|
||||
if(customSpawnMessage && spawnMessage != null) {
|
||||
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());
|
||||
|
@ -105,7 +105,7 @@ public class IntervalSpawnElement implements IAutoSpawnCustomSettingsHandler {
|
|||
|
||||
List<String> spawnMessages = BossAPI.getStoredMessages(spawnMessage);
|
||||
|
||||
if(spawnMessages != null) {
|
||||
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);
|
||||
|
@ -123,30 +123,30 @@ public class IntervalSpawnElement implements IAutoSpawnCustomSettingsHandler {
|
|||
return this.spawnAfterLastBossIsKilled;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public String getPlaceholder() {
|
||||
return this.placeholder;
|
||||
}
|
||||
|
||||
public Integer getSpawnRate() {
|
||||
return this.spawnRate;
|
||||
}
|
||||
|
||||
public void setSpawnAfterLastBossIsKilled(Boolean spawnAfterLastBossIsKilled) {
|
||||
this.spawnAfterLastBossIsKilled = spawnAfterLastBossIsKilled;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getPlaceholder() {
|
||||
return this.placeholder;
|
||||
}
|
||||
|
||||
public void setPlaceholder(String placeholder) {
|
||||
this.placeholder = placeholder;
|
||||
}
|
||||
|
||||
public Integer getSpawnRate() {
|
||||
return this.spawnRate;
|
||||
}
|
||||
|
||||
public void setSpawnRate(Integer spawnRate) {
|
||||
this.spawnRate = spawnRate;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ public class BossEntityContainer implements IContainer<Map<String, BossEntity>,
|
|||
}
|
||||
|
||||
public String getName(BossEntity bossEntity) {
|
||||
for(Map.Entry<String, BossEntity> entry : getData().entrySet()) {
|
||||
if(entry.getValue().equals(bossEntity)) return entry.getKey();
|
||||
for (Map.Entry<String, BossEntity> entry : getData().entrySet()) {
|
||||
if (entry.getValue().equals(bossEntity)) return entry.getKey();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -36,8 +36,8 @@ public class BossEntityContainer implements IContainer<Map<String, BossEntity>,
|
|||
int completed = 0;
|
||||
int failed = 0;
|
||||
|
||||
for(Map.Entry<String, BossEntity> entry : stringBossEntityMap.entrySet()) {
|
||||
if(getData().containsKey(entry.getKey())) {
|
||||
for (Map.Entry<String, BossEntity> entry : stringBossEntityMap.entrySet()) {
|
||||
if (getData().containsKey(entry.getKey())) {
|
||||
failed += 1;
|
||||
stringBuilder.append(entry.getKey()).append("; ");
|
||||
continue;
|
||||
|
@ -48,7 +48,7 @@ public class BossEntityContainer implements IContainer<Map<String, BossEntity>,
|
|||
}
|
||||
|
||||
|
||||
if(failed > 0) {
|
||||
if (failed > 0) {
|
||||
Debug.BOSS_CONTAINER_SAVE.debug(completed, failed, stringBuilder.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ public class MinionEntityContainer implements IContainer<Map<String, MinionEntit
|
|||
}
|
||||
|
||||
public String getName(MinionEntity minionEntity) {
|
||||
for(Map.Entry<String, MinionEntity> entry : getData().entrySet()) {
|
||||
if(entry.getValue().equals(minionEntity)) return entry.getKey();
|
||||
for (Map.Entry<String, MinionEntity> entry : getData().entrySet()) {
|
||||
if (entry.getValue().equals(minionEntity)) return entry.getKey();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -36,8 +36,8 @@ public class MinionEntityContainer implements IContainer<Map<String, MinionEntit
|
|||
int completed = 0;
|
||||
int failed = 0;
|
||||
|
||||
for(Map.Entry<String, MinionEntity> entry : stringMinionEntityMap.entrySet()) {
|
||||
if(getData().containsKey(entry.getKey())) {
|
||||
for (Map.Entry<String, MinionEntity> entry : stringMinionEntityMap.entrySet()) {
|
||||
if (getData().containsKey(entry.getKey())) {
|
||||
failed += 1;
|
||||
stringBuilder.append(entry.getKey()).append("; ");
|
||||
continue;
|
||||
|
@ -47,7 +47,7 @@ public class MinionEntityContainer implements IContainer<Map<String, MinionEntit
|
|||
completed++;
|
||||
}
|
||||
|
||||
if(failed > 0) {
|
||||
if (failed > 0) {
|
||||
Debug.MINION_CONTAINER_SAVE.debug(completed, failed, stringBuilder.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class DropTable {
|
|||
}
|
||||
|
||||
public GiveTableElement getGiveTableData() {
|
||||
if(getDropType().equalsIgnoreCase("GIVE")) {
|
||||
if (getDropType().equalsIgnoreCase("GIVE")) {
|
||||
return BossesGson.get().fromJson(this.rewards, GiveTableElement.class);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class DropTable {
|
|||
}
|
||||
|
||||
public SprayTableElement getSprayTableData() {
|
||||
if(getDropType().equalsIgnoreCase("SPRAY")) {
|
||||
if (getDropType().equalsIgnoreCase("SPRAY")) {
|
||||
return BossesGson.get().fromJson(this.rewards, SprayTableElement.class);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class DropTable {
|
|||
}
|
||||
|
||||
public DropTableElement getDropTableData() {
|
||||
if(getDropType().equalsIgnoreCase("DROP")) {
|
||||
if (getDropType().equalsIgnoreCase("DROP")) {
|
||||
return BossesGson.get().fromJson(this.rewards, DropTableElement.class);
|
||||
}
|
||||
|
||||
|
@ -52,14 +52,14 @@ public class DropTable {
|
|||
return this.dropType;
|
||||
}
|
||||
|
||||
public JsonObject getRewards() {
|
||||
return this.rewards;
|
||||
}
|
||||
|
||||
public void setDropType(String dropType) {
|
||||
this.dropType = dropType;
|
||||
}
|
||||
|
||||
public JsonObject getRewards() {
|
||||
return this.rewards;
|
||||
}
|
||||
|
||||
public void setRewards(JsonObject rewards) {
|
||||
this.rewards = rewards;
|
||||
}
|
||||
|
|
|
@ -28,22 +28,22 @@ public class DropTableElement {
|
|||
return this.dropRewards;
|
||||
}
|
||||
|
||||
public Boolean getRandomDrops() {
|
||||
return this.randomDrops;
|
||||
}
|
||||
|
||||
public Integer getDropMaxDrops() {
|
||||
return this.dropMaxDrops;
|
||||
}
|
||||
|
||||
public void setDropRewards(Map<String, Double> dropRewards) {
|
||||
this.dropRewards = dropRewards;
|
||||
}
|
||||
|
||||
public Boolean getRandomDrops() {
|
||||
return this.randomDrops;
|
||||
}
|
||||
|
||||
public void setRandomDrops(Boolean randomDrops) {
|
||||
this.randomDrops = randomDrops;
|
||||
}
|
||||
|
||||
public Integer getDropMaxDrops() {
|
||||
return this.dropMaxDrops;
|
||||
}
|
||||
|
||||
public void setDropMaxDrops(Integer dropMaxDrops) {
|
||||
this.dropMaxDrops = dropMaxDrops;
|
||||
}
|
||||
|
|
|
@ -34,54 +34,54 @@ public class GiveTableSubElement {
|
|||
return this.items;
|
||||
}
|
||||
|
||||
public Map<String, Double> getCommands() {
|
||||
return this.commands;
|
||||
}
|
||||
|
||||
public Integer getMaxDrops() {
|
||||
return this.maxDrops;
|
||||
}
|
||||
|
||||
public Integer getMaxCommands() {
|
||||
return this.maxCommands;
|
||||
}
|
||||
|
||||
public Boolean getRandomDrops() {
|
||||
return this.randomDrops;
|
||||
}
|
||||
|
||||
public Boolean getRandomCommands() {
|
||||
return this.randomCommands;
|
||||
}
|
||||
|
||||
public Double getRequiredPercentage() {
|
||||
return this.requiredPercentage;
|
||||
}
|
||||
|
||||
public void setItems(Map<String, Double> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public Map<String, Double> getCommands() {
|
||||
return this.commands;
|
||||
}
|
||||
|
||||
public void setCommands(Map<String, Double> commands) {
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
public Integer getMaxDrops() {
|
||||
return this.maxDrops;
|
||||
}
|
||||
|
||||
public void setMaxDrops(Integer maxDrops) {
|
||||
this.maxDrops = maxDrops;
|
||||
}
|
||||
|
||||
public Integer getMaxCommands() {
|
||||
return this.maxCommands;
|
||||
}
|
||||
|
||||
public void setMaxCommands(Integer maxCommands) {
|
||||
this.maxCommands = maxCommands;
|
||||
}
|
||||
|
||||
public Boolean getRandomDrops() {
|
||||
return this.randomDrops;
|
||||
}
|
||||
|
||||
public void setRandomDrops(Boolean randomDrops) {
|
||||
this.randomDrops = randomDrops;
|
||||
}
|
||||
|
||||
public Boolean getRandomCommands() {
|
||||
return this.randomCommands;
|
||||
}
|
||||
|
||||
public void setRandomCommands(Boolean randomCommands) {
|
||||
this.randomCommands = randomCommands;
|
||||
}
|
||||
|
||||
public Double getRequiredPercentage() {
|
||||
return this.requiredPercentage;
|
||||
}
|
||||
|
||||
public void setRequiredPercentage(Double requiredPercentage) {
|
||||
this.requiredPercentage = requiredPercentage;
|
||||
}
|
||||
|
|
|
@ -29,30 +29,30 @@ public class SprayTableElement {
|
|||
return this.sprayRewards;
|
||||
}
|
||||
|
||||
public Boolean getRandomSprayDrops() {
|
||||
return this.randomSprayDrops;
|
||||
}
|
||||
|
||||
public Integer getSprayMaxDistance() {
|
||||
return this.sprayMaxDistance;
|
||||
}
|
||||
|
||||
public Integer getSprayMaxDrops() {
|
||||
return this.sprayMaxDrops;
|
||||
}
|
||||
|
||||
public void setSprayRewards(Map<String, Double> sprayRewards) {
|
||||
this.sprayRewards = sprayRewards;
|
||||
}
|
||||
|
||||
public Boolean getRandomSprayDrops() {
|
||||
return this.randomSprayDrops;
|
||||
}
|
||||
|
||||
public void setRandomSprayDrops(Boolean randomSprayDrops) {
|
||||
this.randomSprayDrops = randomSprayDrops;
|
||||
}
|
||||
|
||||
public Integer getSprayMaxDistance() {
|
||||
return this.sprayMaxDistance;
|
||||
}
|
||||
|
||||
public void setSprayMaxDistance(Integer sprayMaxDistance) {
|
||||
this.sprayMaxDistance = sprayMaxDistance;
|
||||
}
|
||||
|
||||
public Integer getSprayMaxDrops() {
|
||||
return this.sprayMaxDrops;
|
||||
}
|
||||
|
||||
public void setSprayMaxDrops(Integer sprayMaxDrops) {
|
||||
this.sprayMaxDrops = sprayMaxDrops;
|
||||
}
|
||||
|
|
|
@ -57,21 +57,21 @@ public abstract class AutoSpawnVariableHandler implements IHandler {
|
|||
Player player = event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
if(!uuid.equals(getPlayer().getUniqueId())) return;
|
||||
if(isHandled()) return;
|
||||
if (!uuid.equals(getPlayer().getUniqueId())) return;
|
||||
if (isHandled()) return;
|
||||
|
||||
String input = event.getMessage();
|
||||
|
||||
if(input.equalsIgnoreCase("-")) {
|
||||
if (input.equalsIgnoreCase("-")) {
|
||||
input = null;
|
||||
}
|
||||
|
||||
if(input == null) {
|
||||
if (input == null) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(EpicBosses.getInstance(), AutoSpawnVariableHandler.this::finish);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!confirmValue(input, getIntervalSpawnElement())) return;
|
||||
if (!confirmValue(input, getIntervalSpawnElement())) return;
|
||||
|
||||
getAutoSpawn().setCustomData(BossAPI.convertObjectToJsonObject(getIntervalSpawnElement()));
|
||||
getAutoSpawnFileManager().save();
|
||||
|
|
|
@ -54,12 +54,12 @@ public class BossDisplayNameHandler implements IHandler {
|
|||
Player player = event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
if(!uuid.equals(getPlayer().getUniqueId())) return;
|
||||
if(isHandled()) return;
|
||||
if (!uuid.equals(getPlayer().getUniqueId())) return;
|
||||
if (isHandled()) return;
|
||||
|
||||
String input = event.getMessage();
|
||||
|
||||
if(input.equalsIgnoreCase("-")) {
|
||||
if (input.equalsIgnoreCase("-")) {
|
||||
input = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ public class SkillDisplayNameHandler implements IHandler {
|
|||
Player player = event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
if(!uuid.equals(getPlayer().getUniqueId())) return;
|
||||
if(isHandled()) return;
|
||||
if (!uuid.equals(getPlayer().getUniqueId())) return;
|
||||
if (isHandled()) return;
|
||||
|
||||
String input = event.getMessage();
|
||||
|
||||
if(input.equalsIgnoreCase("-")) {
|
||||
if (input.equalsIgnoreCase("-")) {
|
||||
input = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,26 +45,26 @@ public class BossDeathListener implements Listener {
|
|||
ActiveBossHolder activeBossHolder = this.bossEntityManager.getActiveBossHolder(livingEntity);
|
||||
Location location = livingEntity.getLocation();
|
||||
|
||||
if(activeBossHolder == null) return;
|
||||
if (activeBossHolder == null) return;
|
||||
|
||||
EntityDamageEvent.DamageCause damageCause = entityDamageEvent.getCause();
|
||||
Boolean naturalDrops = activeBossHolder.getBossEntity().getDrops().getNaturalDrops();
|
||||
Boolean dropExp = activeBossHolder.getBossEntity().getDrops().getDropExp();
|
||||
|
||||
if(naturalDrops == null) naturalDrops = false;
|
||||
if(dropExp == null) dropExp = true;
|
||||
if (naturalDrops == null) naturalDrops = false;
|
||||
if (dropExp == null) dropExp = true;
|
||||
|
||||
if(!naturalDrops) event.getDrops().clear();
|
||||
if(!dropExp) event.setDroppedExp(0);
|
||||
if (!naturalDrops) event.getDrops().clear();
|
||||
if (!dropExp) event.setDroppedExp(0);
|
||||
|
||||
if(damageCause == EntityDamageEvent.DamageCause.VOID || damageCause == EntityDamageEvent.DamageCause.LAVA
|
||||
if (damageCause == EntityDamageEvent.DamageCause.VOID || damageCause == EntityDamageEvent.DamageCause.LAVA
|
||||
|| activeBossHolder.getMapOfDamagingUsers().isEmpty()) {
|
||||
this.bossEntityManager.removeActiveBossHolder(activeBossHolder);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(this.bossEntityManager.isAllEntitiesDead(activeBossHolder)) {
|
||||
if (this.bossEntityManager.isAllEntitiesDead(activeBossHolder)) {
|
||||
PreBossDeathEvent preBossDeathEvent = new PreBossDeathEvent(activeBossHolder, location, event.getEntity().getKiller());
|
||||
|
||||
activeBossHolder.setDead(true);
|
||||
|
@ -87,8 +87,9 @@ public class BossDeathListener implements Listener {
|
|||
int onlyShow = this.bossEntityManager.getOnDeathShowAmount(bossEntity);
|
||||
ServerUtils serverUtils = ServerUtils.get();
|
||||
|
||||
if(commands != null) {
|
||||
if (activeBossHolder.getSpawningPlayerName() != null) commands.replaceAll(s -> s.replace("{spawner}", activeBossHolder.getSpawningPlayerName()));
|
||||
if (commands != null) {
|
||||
if (activeBossHolder.getSpawningPlayerName() != null)
|
||||
commands.replaceAll(s -> s.replace("{spawner}", activeBossHolder.getSpawningPlayerName()));
|
||||
if (event.getKiller() != null) commands.replaceAll(s -> s.replace("{killer}", event.getKiller().getName()));
|
||||
commands.forEach(serverUtils::sendConsoleCommand);
|
||||
}
|
||||
|
@ -96,19 +97,19 @@ public class BossDeathListener implements Listener {
|
|||
ServerUtils.get().runTaskAsync(() -> {
|
||||
List<String> positionsMessage = this.bossEntityManager.getOnDeathPositionMessage(bossEntity);
|
||||
|
||||
if(messages != null) {
|
||||
if(positionsMessage != null) {
|
||||
if (messages != null) {
|
||||
if (positionsMessage != null) {
|
||||
List<String> finalPositionsMessage = new ArrayList<>();
|
||||
int current = 1;
|
||||
|
||||
for(Map.Entry<UUID, Double> entry : mapOfDamage.entrySet()) {
|
||||
if(current > onlyShow) break;
|
||||
for (Map.Entry<UUID, Double> entry : mapOfDamage.entrySet()) {
|
||||
if (current > onlyShow) break;
|
||||
|
||||
List<String> clonedPositionsMessage = new ArrayList<>(positionsMessage);
|
||||
Double percentage = mapOfPercent.getOrDefault(entry.getKey(), null);
|
||||
int position = current;
|
||||
|
||||
if(percentage == null) percentage = -1.0D;
|
||||
if (percentage == null) percentage = -1.0D;
|
||||
|
||||
double finalPercentage = percentage;
|
||||
|
||||
|
@ -126,16 +127,19 @@ public class BossDeathListener implements Listener {
|
|||
positionsMessage = finalPositionsMessage;
|
||||
}
|
||||
|
||||
if(activeBossHolder.getName() != null) messages.replaceAll(s -> s.replace("{boss}", activeBossHolder.getName()));
|
||||
if (activeBossHolder.getSpawningPlayerName() != null) messages.replaceAll(s -> s.replace("{spawner}", activeBossHolder.getSpawningPlayerName()));
|
||||
if (event.getKiller() != null) messages.replaceAll(s -> s.replace("{killer}", event.getKiller().getName()));
|
||||
if (activeBossHolder.getName() != null)
|
||||
messages.replaceAll(s -> s.replace("{boss}", activeBossHolder.getName()));
|
||||
if (activeBossHolder.getSpawningPlayerName() != null)
|
||||
messages.replaceAll(s -> s.replace("{spawner}", activeBossHolder.getSpawningPlayerName()));
|
||||
if (event.getKiller() != null)
|
||||
messages.replaceAll(s -> s.replace("{killer}", event.getKiller().getName()));
|
||||
|
||||
messages.replaceAll(s -> s.replace('&', '§'));
|
||||
|
||||
List<String> finalMessage = new ArrayList<>();
|
||||
|
||||
for(String s : messages) {
|
||||
if(s.contains("{positions}") && positionsMessage != null) {
|
||||
for (String s : messages) {
|
||||
if (s.contains("{positions}") && positionsMessage != null) {
|
||||
finalMessage.addAll(positionsMessage);
|
||||
} else {
|
||||
finalMessage.add(s);
|
||||
|
@ -154,7 +158,7 @@ public class BossDeathListener implements Listener {
|
|||
BossDeathEvent bossDeathEvent = new BossDeathEvent(activeBossHolder, autoSpawn);
|
||||
DropTable dropTable = this.bossEntityManager.getDropTable(bossEntity);
|
||||
|
||||
if(dropTable == null) {
|
||||
if (dropTable == null) {
|
||||
Debug.FAILED_TO_FIND_DROP_TABLE.debug(activeBossHolder.getName(), bossEntity.getDrops().getDropTable());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,37 +29,37 @@ public class BossDamageListener implements Listener {
|
|||
Entity entityBeingDamaged = event.getEntity();
|
||||
Entity entityDamaging = event.getDamager();
|
||||
|
||||
if(!(entityBeingDamaged instanceof LivingEntity)) return;
|
||||
if (!(entityBeingDamaged instanceof LivingEntity)) return;
|
||||
|
||||
LivingEntity livingEntity = (LivingEntity) entityBeingDamaged;
|
||||
ActiveBossHolder activeBossHolder = this.bossEntityManager.getActiveBossHolder(livingEntity);
|
||||
double damage = event.getDamage();
|
||||
Player player = null;
|
||||
|
||||
if(activeBossHolder == null) return;
|
||||
if (activeBossHolder == null) return;
|
||||
|
||||
if(entityDamaging instanceof Player) {
|
||||
if (entityDamaging instanceof Player) {
|
||||
player = (Player) entityDamaging;
|
||||
} else if(entityDamaging instanceof Projectile) {
|
||||
} else if (entityDamaging instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) entityDamaging;
|
||||
LivingEntity shooter = (LivingEntity) projectile.getShooter();
|
||||
|
||||
if(projectile instanceof ThrownPotion) {
|
||||
if (projectile instanceof ThrownPotion) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if(!(shooter instanceof Player)) return;
|
||||
if (!(shooter instanceof Player)) return;
|
||||
|
||||
player = (Player) shooter;
|
||||
}
|
||||
|
||||
if(player == null) return;
|
||||
if (player == null) return;
|
||||
|
||||
double currentDamage = activeBossHolder.getMapOfDamagingUsers().getOrDefault(player.getUniqueId(), 0.0);
|
||||
BossDamageEvent bossDamageEvent = new BossDamageEvent(activeBossHolder, livingEntity, livingEntity.getEyeLocation(), damage);
|
||||
|
||||
ServerUtils.get().callEvent(bossDamageEvent);
|
||||
activeBossHolder.getMapOfDamagingUsers().put(player.getUniqueId(), currentDamage+damage);
|
||||
activeBossHolder.getMapOfDamagingUsers().put(player.getUniqueId(), currentDamage + damage);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class BossSkillListener implements Listener {
|
|||
Entity entityBeingDamaged = event.getEntity();
|
||||
Entity entityDamaging = event.getDamager();
|
||||
|
||||
if(!(entityBeingDamaged instanceof LivingEntity)) return;
|
||||
if (!(entityBeingDamaged instanceof LivingEntity)) return;
|
||||
|
||||
if (entityDamaging instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) entityDamaging;
|
||||
|
@ -58,18 +58,18 @@ public class BossSkillListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if(!(entityDamaging instanceof LivingEntity)) return;
|
||||
if (!(entityDamaging instanceof LivingEntity)) return;
|
||||
|
||||
LivingEntity livingEntity = (LivingEntity) entityBeingDamaged;
|
||||
ActiveBossHolder activeBossHolder = this.bossEntityManager.getActiveBossHolder(livingEntity);
|
||||
|
||||
if(activeBossHolder == null) return;
|
||||
if (activeBossHolder == null) return;
|
||||
|
||||
BossEntity bossEntity = activeBossHolder.getBossEntity();
|
||||
|
||||
if(bossEntity.getSkills() == null || bossEntity.getSkills().getOverallChance() == null) return;
|
||||
if (bossEntity.getSkills() == null || bossEntity.getSkills().getOverallChance() == null) return;
|
||||
|
||||
if(RandomUtils.get().canPreformAction(bossEntity.getSkills().getOverallChance())) {
|
||||
if (RandomUtils.get().canPreformAction(bossEntity.getSkills().getOverallChance())) {
|
||||
PreBossSkillEvent preBossSkillEvent = new PreBossSkillEvent(activeBossHolder, livingEntity, (LivingEntity) entityDamaging);
|
||||
|
||||
ServerUtils.get().callEvent(preBossSkillEvent);
|
||||
|
@ -84,7 +84,7 @@ public class BossSkillListener implements Listener {
|
|||
List<String> skills = bossEntity.getSkills().getSkills();
|
||||
List<String> masterMessage = BossAPI.getStoredMessages(bossEntity.getSkills().getMasterMessage());
|
||||
|
||||
if(skills.isEmpty()) {
|
||||
if (skills.isEmpty()) {
|
||||
Debug.SKILL_EMPTY_SKILLS.debug(BossAPI.getBossEntityName(bossEntity));
|
||||
return;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class BossSkillListener implements Listener {
|
|||
String skillInput = skills.get(0);
|
||||
Skill skill = this.skillsFileManager.getSkill(skillInput);
|
||||
|
||||
if(skill == null) {
|
||||
if (skill == null) {
|
||||
Debug.SKILL_NOT_FOUND.debug();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.songoda.epicbosses.managers.BossLocationManager;
|
|||
import com.songoda.epicbosses.managers.BossTauntManager;
|
||||
import com.songoda.epicbosses.utils.*;
|
||||
import com.songoda.epicbosses.utils.itemstack.ItemStackUtils;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -39,10 +38,8 @@ public class BossSpawnListener implements Listener {
|
|||
private BossLocationManager bossLocationManager;
|
||||
private BossEntityManager bossEntityManager;
|
||||
private BossTauntManager bossTauntManager;
|
||||
private VersionHandler versionHandler;
|
||||
|
||||
public BossSpawnListener(EpicBosses epicBosses) {
|
||||
this.versionHandler = epicBosses.getVersionHandler();
|
||||
this.bossTauntManager = epicBosses.getBossTauntManager();
|
||||
this.bossEntityManager = epicBosses.getBossEntityManager();
|
||||
this.bossLocationManager = epicBosses.getBossLocationManager();
|
||||
|
@ -55,24 +52,24 @@ public class BossSpawnListener implements Listener {
|
|||
BlockFace blockFace = event.getBlockFace();
|
||||
Action action = event.getAction();
|
||||
|
||||
if(!event.hasItem()) return;
|
||||
if(action != Action.RIGHT_CLICK_BLOCK) return;
|
||||
if(block.getType() == Material.AIR) return;
|
||||
if (!event.hasItem()) return;
|
||||
if (action != Action.RIGHT_CLICK_BLOCK) return;
|
||||
if (block.getType() == Material.AIR) return;
|
||||
|
||||
Map<BossEntity, ItemStack> entitiesAndSpawnItems = this.bossEntityManager.getMapOfEntitiesAndSpawnItems();
|
||||
ItemStack itemStack = this.versionHandler.getItemInHand(player);
|
||||
ItemStack itemStack = player.getItemInHand();
|
||||
BossEntity bossEntity = null;
|
||||
|
||||
for(Map.Entry<BossEntity, ItemStack> entry : entitiesAndSpawnItems.entrySet()) {
|
||||
if(ItemStackUtils.isItemStackSame(itemStack, entry.getValue())) {
|
||||
for (Map.Entry<BossEntity, ItemStack> entry : entitiesAndSpawnItems.entrySet()) {
|
||||
if (ItemStackUtils.isItemStackSame(itemStack, entry.getValue())) {
|
||||
bossEntity = entry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(bossEntity == null) return;
|
||||
if (bossEntity == null) return;
|
||||
|
||||
if(bossEntity.isEditing()) {
|
||||
if (bossEntity.isEditing()) {
|
||||
Message.Boss_Edit_CannotSpawn.msg(player);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -80,11 +77,11 @@ public class BossSpawnListener implements Listener {
|
|||
|
||||
Location location = block.getLocation().clone();
|
||||
|
||||
if(blockFace == BlockFace.UP) {
|
||||
location.add(0,1,0);
|
||||
if (blockFace == BlockFace.UP) {
|
||||
location.add(0, 1, 0);
|
||||
}
|
||||
|
||||
if(!this.bossLocationManager.canSpawnBoss(player, location.clone())) {
|
||||
if (!this.bossLocationManager.canSpawnBoss(player, location.clone())) {
|
||||
Message.General_CannotSpawn.msg(player);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -94,7 +91,7 @@ public class BossSpawnListener implements Listener {
|
|||
|
||||
ActiveBossHolder activeBossHolder = BossAPI.spawnNewBoss(bossEntity, location, player, itemStack, false);
|
||||
|
||||
if(activeBossHolder == null) {
|
||||
if (activeBossHolder == null) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +116,7 @@ public class BossSpawnListener implements Listener {
|
|||
int messageRadius = this.bossEntityManager.getOnSpawnMessageRadius(bossEntity);
|
||||
ServerUtils serverUtils = ServerUtils.get();
|
||||
|
||||
if(event instanceof PreBossSpawnItemEvent) {
|
||||
if (event instanceof PreBossSpawnItemEvent) {
|
||||
PreBossSpawnItemEvent preBossSpawnItemEvent = (PreBossSpawnItemEvent) event;
|
||||
ItemStack itemStack = preBossSpawnItemEvent.getItemStackUsed().clone();
|
||||
Player player = preBossSpawnItemEvent.getPlayer();
|
||||
|
@ -143,8 +140,9 @@ public class BossSpawnListener implements Listener {
|
|||
if (!commands.isEmpty())
|
||||
commands.forEach(serverUtils::sendConsoleCommand);
|
||||
|
||||
if(!messages.isEmpty() && !activeBossHolder.isCustomSpawnMessage()) {
|
||||
if(activeBossHolder.getName() != null) messages.replaceAll(s -> s.replace("{boss}", activeBossHolder.getName()));
|
||||
if (!messages.isEmpty() && !activeBossHolder.isCustomSpawnMessage()) {
|
||||
if (activeBossHolder.getName() != null)
|
||||
messages.replaceAll(s -> s.replace("{boss}", activeBossHolder.getName()));
|
||||
final String locationString = StringUtils.get().translateLocation(location);
|
||||
messages.replaceAll(s -> s.replace("{location}", locationString));
|
||||
|
||||
|
|
|
@ -31,10 +31,14 @@ public class AutoSpawnManager {
|
|||
this.autoSpawnFileManager = plugin.getAutoSpawnFileManager();
|
||||
}
|
||||
|
||||
public static ICustomSettingAction createAutoSpawnAction(String name, String current, List<String> extraInformation, ItemStack displayStack, ClickAction clickAction) {
|
||||
return new CustomAutoSpawnActionCreator(name, current, extraInformation, displayStack, clickAction);
|
||||
}
|
||||
|
||||
public void startIntervalSystems() {
|
||||
Map<String, AutoSpawn> autoSpawnMap = this.autoSpawnFileManager.getAutoSpawnMap();
|
||||
|
||||
if(!this.activeAutoSpawnHolders.isEmpty()) {
|
||||
if (!this.activeAutoSpawnHolders.isEmpty()) {
|
||||
stopIntervalSystems();
|
||||
}
|
||||
|
||||
|
@ -56,7 +60,7 @@ public class AutoSpawnManager {
|
|||
List<String> intervalAutoSpawns = new ArrayList<>();
|
||||
|
||||
autoSpawnHolderMap.forEach((name, autoSpawnHolder) -> {
|
||||
if(autoSpawnHolder.getSpawnType() == SpawnType.INTERVAL) {
|
||||
if (autoSpawnHolder.getSpawnType() == SpawnType.INTERVAL) {
|
||||
intervalAutoSpawns.add(name);
|
||||
}
|
||||
});
|
||||
|
@ -68,7 +72,7 @@ public class AutoSpawnManager {
|
|||
List<String> keyList = new ArrayList<>(this.activeAutoSpawnHolders.keySet());
|
||||
|
||||
for (String s : keyList) {
|
||||
if(s.equalsIgnoreCase(name)) return true;
|
||||
if (s.equalsIgnoreCase(name)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -93,7 +97,7 @@ public class AutoSpawnManager {
|
|||
private void removeActiveAutoSpawnHolder(String name) {
|
||||
ActiveAutoSpawnHolder autoSpawnHolder = this.activeAutoSpawnHolders.getOrDefault(name, null);
|
||||
|
||||
if(autoSpawnHolder != null) {
|
||||
if (autoSpawnHolder != null) {
|
||||
stopInterval(autoSpawnHolder);
|
||||
this.activeAutoSpawnHolders.remove(name);
|
||||
}
|
||||
|
@ -113,20 +117,16 @@ public class AutoSpawnManager {
|
|||
String autoSpawnType = autoSpawn.getType();
|
||||
SpawnType spawnType = SpawnType.getCurrent(autoSpawnType);
|
||||
|
||||
if(spawnType == SpawnType.INTERVAL) {
|
||||
if (spawnType == SpawnType.INTERVAL) {
|
||||
ActiveIntervalAutoSpawnHolder autoSpawnHolder = new ActiveIntervalAutoSpawnHolder(spawnType, autoSpawn);
|
||||
|
||||
if(autoSpawn.isEditing()) return;
|
||||
if (autoSpawn.isEditing()) return;
|
||||
|
||||
autoSpawnHolder.restartInterval();
|
||||
this.activeAutoSpawnHolders.put(name, autoSpawnHolder);
|
||||
}
|
||||
}
|
||||
|
||||
public static ICustomSettingAction createAutoSpawnAction(String name, String current, List<String> extraInformation, ItemStack displayStack, ClickAction clickAction) {
|
||||
return new CustomAutoSpawnActionCreator(name, current, extraInformation, displayStack, clickAction);
|
||||
}
|
||||
|
||||
private static class CustomAutoSpawnActionCreator implements ICustomSettingAction {
|
||||
|
||||
private final List<String> extraInformation;
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.songoda.epicbosses.EpicBosses;
|
|||
import com.songoda.epicbosses.commands.boss.*;
|
||||
import com.songoda.epicbosses.utils.Debug;
|
||||
import com.songoda.epicbosses.utils.ILoadable;
|
||||
import com.songoda.epicbosses.utils.IReloadable;
|
||||
import com.songoda.epicbosses.utils.command.SubCommandService;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +24,7 @@ public class BossCommandManager implements ILoadable {
|
|||
|
||||
@Override
|
||||
public void load() {
|
||||
if(this.hasBeenLoaded) {
|
||||
if (this.hasBeenLoaded) {
|
||||
Debug.FAILED_TO_LOAD_BOSSCOMMANDMANAGER.debug();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public class BossDropTableManager {
|
|||
Integer maxDrops = sprayTableElement.getSprayMaxDrops();
|
||||
Boolean randomDrops = sprayTableElement.getRandomSprayDrops();
|
||||
|
||||
if(maxDrops == null) maxDrops = -1;
|
||||
if(randomDrops == null) randomDrops = false;
|
||||
if (maxDrops == null) maxDrops = -1;
|
||||
if (randomDrops == null) randomDrops = false;
|
||||
|
||||
return getCustomRewards(randomDrops, maxDrops, rewards);
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ public class BossDropTableManager {
|
|||
Integer maxDrops = dropTableElement.getDropMaxDrops();
|
||||
Boolean randomDrops = dropTableElement.getRandomDrops();
|
||||
|
||||
if(maxDrops == null) maxDrops = -1;
|
||||
if(randomDrops == null) randomDrops = false;
|
||||
if (maxDrops == null) maxDrops = -1;
|
||||
if (randomDrops == null) randomDrops = false;
|
||||
|
||||
return getCustomRewards(randomDrops, maxDrops, rewards);
|
||||
}
|
||||
|
@ -66,14 +66,14 @@ public class BossDropTableManager {
|
|||
ServerUtils serverUtils = ServerUtils.get();
|
||||
|
||||
rewards.forEach((positionString, lootMap) -> {
|
||||
if(!NumberUtils.get().isInt(positionString)) {
|
||||
if (!NumberUtils.get().isInt(positionString)) {
|
||||
Debug.DROP_TABLE_FAILED_INVALID_NUMBER.debug(positionString);
|
||||
return;
|
||||
}
|
||||
|
||||
int position = NumberUtils.get().getInteger(positionString) - 1;
|
||||
|
||||
if(position >= positions.size()) return;
|
||||
if (position >= positions.size()) return;
|
||||
|
||||
UUID uuid = positions.get(position);
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
|
@ -81,20 +81,20 @@ public class BossDropTableManager {
|
|||
List<ItemStack> totalRewards = new ArrayList<>();
|
||||
List<String> totalCommands = new ArrayList<>();
|
||||
|
||||
if(player == null) return;
|
||||
if (player == null) return;
|
||||
|
||||
lootMap.forEach((key, subElement) -> {
|
||||
Double requiredPercentage = subElement.getRequiredPercentage();
|
||||
Integer maxDrops = subElement.getMaxDrops(), maxCommands = subElement.getMaxCommands();
|
||||
Boolean randomDrops = subElement.getRandomDrops(), randomCommands = subElement.getRandomCommands();
|
||||
|
||||
if(requiredPercentage == null) requiredPercentage = 0.0D;
|
||||
if(maxDrops == null) maxDrops = -1;
|
||||
if(maxCommands == null) maxCommands = -1;
|
||||
if(randomDrops == null) randomDrops = false;
|
||||
if(randomCommands == null) randomCommands = false;
|
||||
if (requiredPercentage == null) requiredPercentage = 0.0D;
|
||||
if (maxDrops == null) maxDrops = -1;
|
||||
if (maxCommands == null) maxCommands = -1;
|
||||
if (randomDrops == null) randomDrops = false;
|
||||
if (randomCommands == null) randomCommands = false;
|
||||
|
||||
if(requiredPercentage > percentage) return;
|
||||
if (requiredPercentage > percentage) return;
|
||||
|
||||
totalRewards.addAll(getCustomRewards(randomDrops, maxDrops, subElement.getItems()));
|
||||
totalCommands.addAll(getCommands(randomCommands, maxCommands, subElement.getCommands()));
|
||||
|
@ -104,7 +104,7 @@ public class BossDropTableManager {
|
|||
totalCommands.forEach(serverUtils::sendConsoleCommand);
|
||||
|
||||
totalRewards.forEach(itemStack -> {
|
||||
if(player.getInventory().firstEmpty() == -1) {
|
||||
if (player.getInventory().firstEmpty() == -1) {
|
||||
player.getWorld().dropItemNaturally(player.getLocation(), itemStack);
|
||||
} else {
|
||||
player.getInventory().addItem(itemStack);
|
||||
|
@ -117,21 +117,21 @@ public class BossDropTableManager {
|
|||
private List<ItemStack> getCustomRewards(boolean random, int max, Map<String, Double> chanceMap) {
|
||||
List<ItemStack> newListToMerge = new ArrayList<>();
|
||||
|
||||
if(chanceMap == null) return newListToMerge;
|
||||
if (chanceMap == null) return newListToMerge;
|
||||
|
||||
List<String> keyList = new ArrayList<>(chanceMap.keySet());
|
||||
|
||||
if(random) Collections.shuffle(keyList);
|
||||
if (random) Collections.shuffle(keyList);
|
||||
|
||||
for(String itemName : keyList) {
|
||||
for (String itemName : keyList) {
|
||||
Double chance = chanceMap.get(itemName);
|
||||
|
||||
if(!RandomUtils.get().canPreformAction(chance)) continue;
|
||||
if((max > 0) && (newListToMerge.size() >= max)) break;
|
||||
if (!RandomUtils.get().canPreformAction(chance)) continue;
|
||||
if ((max > 0) && (newListToMerge.size() >= max)) break;
|
||||
|
||||
ItemStack itemStack = this.getDropTableItemStack.getListItem(itemName);
|
||||
|
||||
if(itemStack == null) {
|
||||
if (itemStack == null) {
|
||||
Debug.DROP_TABLE_FAILED_TO_GET_ITEM.debug();
|
||||
continue;
|
||||
}
|
||||
|
@ -145,21 +145,21 @@ public class BossDropTableManager {
|
|||
private List<String> getCommands(boolean random, int max, Map<String, Double> chanceMap) {
|
||||
List<String> newListToMerge = new ArrayList<>();
|
||||
|
||||
if(chanceMap == null) return newListToMerge;
|
||||
if (chanceMap == null) return newListToMerge;
|
||||
|
||||
List<String> keyList = new ArrayList<>(chanceMap.keySet());
|
||||
|
||||
if(random) Collections.shuffle(keyList);
|
||||
if (random) Collections.shuffle(keyList);
|
||||
|
||||
for(String itemName : keyList) {
|
||||
for (String itemName : keyList) {
|
||||
Double chance = chanceMap.get(itemName);
|
||||
|
||||
if(!RandomUtils.get().canPreformAction(chance)) continue;
|
||||
if((max > 0) && (newListToMerge.size() >= max)) break;
|
||||
if (!RandomUtils.get().canPreformAction(chance)) continue;
|
||||
if ((max > 0) && (newListToMerge.size() >= max)) break;
|
||||
|
||||
List<String> commands = this.getDropTableCommand.getListItem(itemName);
|
||||
|
||||
if(commands == null) {
|
||||
if (commands == null) {
|
||||
Debug.DROP_TABLE_FAILED_TO_GET_ITEM.debug();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -65,11 +65,11 @@ public class BossEntityManager {
|
|||
}
|
||||
|
||||
public double getRadius(ActiveBossHolder activeBossHolder, Location centerLocation) {
|
||||
if(activeBossHolder.isDead()) return Double.MAX_VALUE;
|
||||
if (activeBossHolder.isDead()) return Double.MAX_VALUE;
|
||||
|
||||
LivingEntity livingEntity = activeBossHolder.getLivingEntity();
|
||||
|
||||
if(livingEntity == null) return Double.MAX_VALUE;
|
||||
if (livingEntity == null) return Double.MAX_VALUE;
|
||||
|
||||
Location location = livingEntity.getLocation();
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class BossEntityManager {
|
|||
getActiveBossHolders().forEach(activeBossHolder -> {
|
||||
double distance = getRadius(activeBossHolder, centerLocation);
|
||||
|
||||
if(distance > radius) return;
|
||||
if (distance > radius) return;
|
||||
|
||||
distanceMap.put(activeBossHolder, distance);
|
||||
});
|
||||
|
@ -93,8 +93,8 @@ public class BossEntityManager {
|
|||
public int getCurrentlyActive(BossEntity bossEntity) {
|
||||
int amountOfBosses = 0;
|
||||
|
||||
for(ActiveBossHolder activeBossHolder : getActiveBossHolders()) {
|
||||
if(activeBossHolder.getBossEntity().equals(bossEntity)) {
|
||||
for (ActiveBossHolder activeBossHolder : getActiveBossHolders()) {
|
||||
if (activeBossHolder.getBossEntity().equals(bossEntity)) {
|
||||
amountOfBosses++;
|
||||
}
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ public class BossEntityManager {
|
|||
public int killAllHolders(World world) {
|
||||
int amountOfBosses = 0;
|
||||
|
||||
for(ActiveBossHolder activeBossHolder : getActiveBossHolders()) {
|
||||
if(activeBossHolder.killAllSubBosses(world)) {
|
||||
for (ActiveBossHolder activeBossHolder : getActiveBossHolders()) {
|
||||
if (activeBossHolder.killAllSubBosses(world)) {
|
||||
activeBossHolder.killAllMinions(world);
|
||||
activeBossHolder.setDead(true);
|
||||
amountOfBosses++;
|
||||
|
@ -121,8 +121,8 @@ public class BossEntityManager {
|
|||
}
|
||||
|
||||
public void killAllHolders(BossEntity bossEntity) {
|
||||
for(ActiveBossHolder activeBossHolder : getActiveBossHolders()) {
|
||||
if(activeBossHolder.getBossEntity().equals(bossEntity)) {
|
||||
for (ActiveBossHolder activeBossHolder : getActiveBossHolders()) {
|
||||
if (activeBossHolder.getBossEntity().equals(bossEntity)) {
|
||||
activeBossHolder.killAll();
|
||||
activeBossHolder.killAllMinions();
|
||||
activeBossHolder.setDead(true);
|
||||
|
@ -133,19 +133,19 @@ public class BossEntityManager {
|
|||
}
|
||||
|
||||
public ItemStack getDisplaySpawnItem(BossEntity bossEntity) {
|
||||
if(bossEntity == null) return null;
|
||||
if (bossEntity == null) return null;
|
||||
|
||||
String spawnItemName = bossEntity.getSpawnItem() == null? DEFAULT_BOSS_MENU_ITEM : bossEntity.getSpawnItem();
|
||||
String spawnItemName = bossEntity.getSpawnItem() == null ? DEFAULT_BOSS_MENU_ITEM : bossEntity.getSpawnItem();
|
||||
ItemStackHolder itemStackHolder = BossAPI.getStoredItemStack(spawnItemName);
|
||||
|
||||
if(itemStackHolder == null) {
|
||||
if (itemStackHolder == null) {
|
||||
Debug.FAILED_TO_LOAD_CUSTOM_ITEM.debug(spawnItemName);
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack itemStack = this.bossItemFileManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
if(itemStack == null) {
|
||||
if (itemStack == null) {
|
||||
Debug.FAILED_TO_LOAD_CUSTOM_ITEM.debug(spawnItemName);
|
||||
return null;
|
||||
}
|
||||
|
@ -154,20 +154,20 @@ public class BossEntityManager {
|
|||
}
|
||||
|
||||
public ItemStack getSpawnItem(BossEntity bossEntity) {
|
||||
if(bossEntity == null) return null;
|
||||
if(bossEntity.getSpawnItem() == null) return null;
|
||||
if (bossEntity == null) return null;
|
||||
if (bossEntity.getSpawnItem() == null) return null;
|
||||
|
||||
String spawnItemName = bossEntity.getSpawnItem();
|
||||
ItemStackHolder itemStackHolder = BossAPI.getStoredItemStack(spawnItemName);
|
||||
|
||||
if(itemStackHolder == null) {
|
||||
if (itemStackHolder == null) {
|
||||
Debug.FAILED_TO_LOAD_CUSTOM_ITEM.debug(spawnItemName);
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack itemStack = this.bossItemFileManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
if(itemStack == null) {
|
||||
if (itemStack == null) {
|
||||
Debug.FAILED_TO_LOAD_CUSTOM_ITEM.debug(spawnItemName);
|
||||
return null;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class BossEntityManager {
|
|||
String id = bossEntity.getMessages().getOnSpawn().getMessage();
|
||||
List<String> messages = BossAPI.getStoredMessages(id);
|
||||
|
||||
if(messages == null) {
|
||||
if (messages == null) {
|
||||
Debug.FAILED_TO_LOAD_MESSAGES.debug(id);
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class BossEntityManager {
|
|||
public int getOnSpawnMessageRadius(BossEntity bossEntity) {
|
||||
Integer radius = bossEntity.getMessages().getOnSpawn().getRadius();
|
||||
|
||||
if(radius == null) radius = -1;
|
||||
if (radius == null) radius = -1;
|
||||
|
||||
return radius;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ public class BossEntityManager {
|
|||
String id = bossEntity.getCommands().getOnSpawn();
|
||||
List<String> commands = BossAPI.getStoredCommands(id);
|
||||
|
||||
if(commands == null) {
|
||||
if (commands == null) {
|
||||
Debug.FAILED_TO_LOAD_COMMANDS.debug(id);
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class BossEntityManager {
|
|||
String id = bossEntity.getMessages().getOnDeath().getMessage();
|
||||
List<String> messages = BossAPI.getStoredMessages(id);
|
||||
|
||||
if(messages == null) {
|
||||
if (messages == null) {
|
||||
Debug.FAILED_TO_LOAD_MESSAGES.debug(id);
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class BossEntityManager {
|
|||
public int getOnDeathMessageRadius(BossEntity bossEntity) {
|
||||
Integer radius = bossEntity.getMessages().getOnDeath().getRadius();
|
||||
|
||||
if(radius == null) radius = -1;
|
||||
if (radius == null) radius = -1;
|
||||
|
||||
return radius;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ public class BossEntityManager {
|
|||
public int getOnDeathShowAmount(BossEntity bossEntity) {
|
||||
Integer onlyShow = bossEntity.getMessages().getOnDeath().getOnlyShow();
|
||||
|
||||
if(onlyShow == null) onlyShow = 3;
|
||||
if (onlyShow == null) onlyShow = 3;
|
||||
|
||||
return onlyShow;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public class BossEntityManager {
|
|||
String id = bossEntity.getMessages().getOnDeath().getPositionMessage();
|
||||
List<String> messages = BossAPI.getStoredMessages(id);
|
||||
|
||||
if(messages == null) {
|
||||
if (messages == null) {
|
||||
Debug.FAILED_TO_LOAD_MESSAGES.debug(id);
|
||||
return null;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class BossEntityManager {
|
|||
String id = bossEntity.getCommands().getOnDeath();
|
||||
List<String> commands = BossAPI.getStoredCommands(id);
|
||||
|
||||
if(commands == null) {
|
||||
if (commands == null) {
|
||||
Debug.FAILED_TO_LOAD_COMMANDS.debug(id);
|
||||
return null;
|
||||
}
|
||||
|
@ -281,24 +281,24 @@ public class BossEntityManager {
|
|||
String minionToSpawn = minionSkillElement.getMinionToSpawn();
|
||||
Integer amount = minionSkillElement.getAmount();
|
||||
|
||||
if(minionToSpawn == null || minionToSpawn.isEmpty()) {
|
||||
if (minionToSpawn == null || minionToSpawn.isEmpty()) {
|
||||
Debug.FAILED_TO_SPAWN_MINIONS_FROM_SKILL.debug(skill.getDisplayName());
|
||||
return;
|
||||
}
|
||||
|
||||
if(amount == null) amount = 1;
|
||||
if (amount == null) amount = 1;
|
||||
|
||||
MinionEntity minionEntity = this.minionsFileManager.getMinionEntity(minionToSpawn);
|
||||
Location location = activeBossHolder.getLivingEntity().getLocation();
|
||||
|
||||
if(minionEntity == null) {
|
||||
if (minionEntity == null) {
|
||||
Debug.FAILED_TO_FIND_MINION.debug(skill.getDisplayName(), minionToSpawn);
|
||||
return;
|
||||
}
|
||||
|
||||
activeBossHolder.killAllMinions();
|
||||
|
||||
for(int i = 1; i <= amount; i++) {
|
||||
for (int i = 1; i <= amount; i++) {
|
||||
ActiveMinionHolder activeMinionHolder = new ActiveMinionHolder(activeBossHolder, minionEntity, location, minionToSpawn);
|
||||
|
||||
this.minionMechanicManager.handleMechanicApplication(minionEntity, activeMinionHolder);
|
||||
|
@ -313,9 +313,9 @@ public class BossEntityManager {
|
|||
public ActiveBossHolder getActiveBossHolder(LivingEntity livingEntity) {
|
||||
List<ActiveBossHolder> currentList = getActiveBossHolders();
|
||||
|
||||
for(ActiveBossHolder activeBossHolder : currentList) {
|
||||
for(Map.Entry<Integer, UUID> entry : activeBossHolder.getLivingEntityMap().entrySet()) {
|
||||
if(entry.getValue().equals(livingEntity.getUniqueId())) return activeBossHolder;
|
||||
for (ActiveBossHolder activeBossHolder : currentList) {
|
||||
for (Map.Entry<Integer, UUID> entry : activeBossHolder.getLivingEntityMap().entrySet()) {
|
||||
if (entry.getValue().equals(livingEntity.getUniqueId())) return activeBossHolder;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ public class BossEntityManager {
|
|||
}
|
||||
|
||||
public void removeActiveBossHolder(ActiveBossHolder activeBossHolder) {
|
||||
for(Map.Entry<Integer, UUID> entry : activeBossHolder.getLivingEntityMap().entrySet()) {
|
||||
for (Map.Entry<Integer, UUID> entry : activeBossHolder.getLivingEntityMap().entrySet()) {
|
||||
LivingEntity livingEntity = (LivingEntity) ServerUtils.get().getEntity(entry.getValue());
|
||||
if (livingEntity != null && !livingEntity.isDead())
|
||||
livingEntity.remove();
|
||||
|
@ -333,7 +333,7 @@ public class BossEntityManager {
|
|||
}
|
||||
|
||||
public boolean isAllEntitiesDead(ActiveBossHolder activeBossHolder) {
|
||||
for(Map.Entry<Integer, UUID> entry : activeBossHolder.getLivingEntityMap().entrySet()) {
|
||||
for (Map.Entry<Integer, UUID> entry : activeBossHolder.getLivingEntityMap().entrySet()) {
|
||||
LivingEntity livingEntity = (LivingEntity) ServerUtils.get().getEntity(entry.getValue());
|
||||
if (livingEntity != null && !livingEntity.isDead())
|
||||
return false;
|
||||
|
@ -356,14 +356,14 @@ public class BossEntityManager {
|
|||
Map<UUID, Double> percentageMap = new HashMap<>();
|
||||
double totalDamage = 0.0;
|
||||
|
||||
for(Double damage : damagingUsers.values()) {
|
||||
if(damage != null) totalDamage += damage;
|
||||
for (Double damage : damagingUsers.values()) {
|
||||
if (damage != null) totalDamage += damage;
|
||||
}
|
||||
|
||||
double onePercent = totalDamage / 100;
|
||||
|
||||
damagingUsers.forEach((uuid, damage) -> {
|
||||
if(uuid == null || damage == null) return;
|
||||
if (uuid == null || damage == null) return;
|
||||
|
||||
double playerPercent = damage / onePercent;
|
||||
|
||||
|
@ -382,23 +382,23 @@ public class BossEntityManager {
|
|||
BossEntity bossEntity = deadBossHolder.getBossEntity();
|
||||
String tableName = bossEntity.getDrops().getDropTable();
|
||||
|
||||
if(dropType == null) {
|
||||
if (dropType == null) {
|
||||
Debug.FAILED_TO_FIND_DROP_TABLE_TYPE.debug(tableName);
|
||||
return;
|
||||
}
|
||||
|
||||
Gson gson = BossesGson.get();
|
||||
|
||||
if(dropType.equalsIgnoreCase("SPRAY")) {
|
||||
if (dropType.equalsIgnoreCase("SPRAY")) {
|
||||
SprayTableElement sprayTableElement = dropTable.getSprayTableData();
|
||||
List<ItemStack> itemStacks = this.bossDropTableManager.getSprayItems(sprayTableElement);
|
||||
|
||||
sprayDrops(sprayTableElement, itemStacks, deadBossHolder);
|
||||
} else if(dropType.equalsIgnoreCase("GIVE")) {
|
||||
} else if (dropType.equalsIgnoreCase("GIVE")) {
|
||||
GiveTableElement giveTableElement = dropTable.getGiveTableData();
|
||||
|
||||
this.bossDropTableManager.handleGiveTable(giveTableElement, deadBossHolder);
|
||||
} else if(dropType.equalsIgnoreCase("DROP")) {
|
||||
} else if (dropType.equalsIgnoreCase("DROP")) {
|
||||
DropTableElement dropTableElement = dropTable.getDropTableData();
|
||||
List<ItemStack> itemStacks = this.bossDropTableManager.getDropItems(dropTableElement);
|
||||
|
||||
|
@ -411,7 +411,7 @@ public class BossEntityManager {
|
|||
private void sprayDrops(SprayTableElement sprayTableElement, List<ItemStack> rewards, DeadBossHolder deadBossHolder) {
|
||||
Integer maximumDistance = sprayTableElement.getSprayMaxDistance();
|
||||
|
||||
if(maximumDistance == null) maximumDistance = 10;
|
||||
if (maximumDistance == null) maximumDistance = 10;
|
||||
|
||||
Location deathLocation = deadBossHolder.getLocation();
|
||||
Integer finalMaximumDistance = maximumDistance;
|
||||
|
@ -423,8 +423,8 @@ public class BossEntityManager {
|
|||
int z = RandomUtils.get().getRandomNumber(finalMaximumDistance + 1);
|
||||
int currentZ = destinationLocation.getBlockZ();
|
||||
|
||||
if(RandomUtils.get().preformRandomAction()) x = -x;
|
||||
if(RandomUtils.get().preformRandomAction()) z = -z;
|
||||
if (RandomUtils.get().preformRandomAction()) x = -x;
|
||||
if (RandomUtils.get().preformRandomAction()) z = -z;
|
||||
|
||||
destinationLocation.setX(currentX + x);
|
||||
destinationLocation.setZ(currentZ + z);
|
||||
|
|
|
@ -13,8 +13,6 @@ import utils.factions.FactionsOne;
|
|||
import utils.factions.FactionsUUID;
|
||||
import utils.factions.LegacyFactions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
|
@ -22,14 +20,12 @@ import java.util.List;
|
|||
*/
|
||||
public class BossHookManager {
|
||||
|
||||
private final EpicBosses plugin;
|
||||
private boolean askyblockEnabled, factionsEnabled;
|
||||
private boolean askyblockOwnIsland, factionWarzone;
|
||||
|
||||
private IASkyblockHelper aSkyblockHelper;
|
||||
private IFactionHelper factionHelper;
|
||||
|
||||
private final EpicBosses plugin;
|
||||
|
||||
public BossHookManager(EpicBosses epicBosses) {
|
||||
this.plugin = epicBosses;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BossListenerManager implements ILoadable {
|
|||
|
||||
@Override
|
||||
public void load() {
|
||||
if(this.hasBeenLoaded) {
|
||||
if (this.hasBeenLoaded) {
|
||||
Debug.FAILED_TO_LOAD_BOSSLISTENERMANAGER.debug();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,10 @@ import java.util.List;
|
|||
*/
|
||||
public class BossLocationManager implements IReloadable {
|
||||
|
||||
private boolean useBlockedWorlds;
|
||||
private List<String> blockedWorlds;
|
||||
|
||||
private final BossHookManager bossHookManager;
|
||||
private final EpicBosses plugin;
|
||||
private boolean useBlockedWorlds;
|
||||
private List<String> blockedWorlds;
|
||||
|
||||
public BossLocationManager(EpicBosses epicBosses) {
|
||||
this.bossHookManager = epicBosses.getBossHookManager();
|
||||
|
|
|
@ -19,8 +19,8 @@ import java.util.Queue;
|
|||
*/
|
||||
public class BossMechanicManager implements IMechanicManager<BossEntity, ActiveBossHolder, IBossMechanic> {
|
||||
|
||||
private Queue<IBossMechanic> mechanics;
|
||||
private final EpicBosses epicBosses;
|
||||
private Queue<IBossMechanic> mechanics;
|
||||
|
||||
public BossMechanicManager(EpicBosses epicBosses) {
|
||||
this.epicBosses = epicBosses;
|
||||
|
@ -46,22 +46,22 @@ public class BossMechanicManager implements IMechanicManager<BossEntity, ActiveB
|
|||
|
||||
@Override
|
||||
public void handleMechanicApplication(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
|
||||
if(bossEntity != null && activeBossHolder != null) {
|
||||
if(bossEntity.isEditing()) {
|
||||
if (bossEntity != null && activeBossHolder != null) {
|
||||
if (bossEntity.isEditing()) {
|
||||
Debug.ATTEMPTED_TO_SPAWN_WHILE_DISABLED.debug();
|
||||
return;
|
||||
}
|
||||
|
||||
Queue<IBossMechanic> queue = new LinkedList<>(this.mechanics);
|
||||
|
||||
while(!queue.isEmpty()) {
|
||||
while (!queue.isEmpty()) {
|
||||
IBossMechanic mechanic = queue.poll();
|
||||
|
||||
if(mechanic == null) continue;
|
||||
if (mechanic == null) continue;
|
||||
|
||||
ServerUtils.get().logDebug("Applying " + mechanic.getClass().getSimpleName());
|
||||
|
||||
if(didMechanicApplicationFail(mechanic, bossEntity, activeBossHolder)) {
|
||||
if (didMechanicApplicationFail(mechanic, bossEntity, activeBossHolder)) {
|
||||
Debug.FAILED_TO_APPLY_MECHANIC.debug(mechanic.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ public class BossMechanicManager implements IMechanicManager<BossEntity, ActiveB
|
|||
}
|
||||
|
||||
private boolean didMechanicApplicationFail(IBossMechanic mechanic, BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
|
||||
if(mechanic == null) return true;
|
||||
if (mechanic == null) return true;
|
||||
|
||||
if(!mechanic.applyMechanic(bossEntity, activeBossHolder)) {
|
||||
if (!mechanic.applyMechanic(bossEntity, activeBossHolder)) {
|
||||
Debug.MECHANIC_APPLICATION_FAILED.debug(mechanic.getClass().getSimpleName());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -95,10 +95,9 @@ public class BossPanelManager implements ILoadable {
|
|||
|
||||
private static final String HELMET_EDITOR_PATH = "HelmetEditorPanel", CHESTPLATE_EDITOR_PATH = "ChestplateEditorPanel", LEGGINGS_EDITOR_PATH = "LeggingsEditorPanel",
|
||||
BOOTS_EDITOR_PATH = "BootsEditorPanel", MAIN_HAND_EDITOR_PATH = "MainHandEditorPanel", OFF_HAND_EDITOR_PATH = "OffHandEditorPanel";
|
||||
|
||||
private final EpicBosses epicBosses;
|
||||
private IPanelHandler mainMenu, customItems, bosses, autoSpawns, dropTables, customSkills, shopPanel;
|
||||
private IPanelHandler customItemAddItemsMenu;
|
||||
|
||||
private ISubVariablePanelHandler<BossEntity, EntityStatsElement> equipmentEditMenu, helmetEditorMenu, chestplateEditorMenu, leggingsEditorMenu, bootsEditorMenu;
|
||||
private ISubVariablePanelHandler<BossEntity, EntityStatsElement> weaponEditMenu, offHandEditorMenu, mainHandEditorMenu;
|
||||
private ISubVariablePanelHandler<BossEntity, EntityStatsElement> statisticMainEditMenu, entityTypeEditMenu;
|
||||
|
@ -106,19 +105,15 @@ public class BossPanelManager implements ILoadable {
|
|||
onDeathCommandEditMenu, mainDropsEditMenu, mainTextEditMenu, mainTauntEditMenu, onSpawnTextEditMenu, onSpawnSubTextEditMenu, onDeathTextEditMenu, onDeathSubTextEditMenu, onDeathPositionTextEditMenu,
|
||||
onTauntTextEditMenu, spawnItemEditMenu, bossShopEditMenu, bossSkillMasterMessageTextEditMenu;
|
||||
private BossListEditorPanel equipmentListEditMenu, weaponListEditMenu, statisticListEditMenu;
|
||||
|
||||
private IVariablePanelHandler<Skill> mainSkillEditMenu, customMessageEditMenu, skillTypeEditMenu, potionSkillEditorPanel, commandSkillEditorPanel, groupSkillEditorPanel, customSkillEditorPanel;
|
||||
private ISubVariablePanelHandler<Skill, PotionEffectHolder> createPotionEffectMenu, potionEffectTypeEditMenu;
|
||||
private ISubVariablePanelHandler<Skill, SubCommandSkillElement> modifyCommandEditMenu, commandListSkillEditMenu;
|
||||
private ISubVariablePanelHandler<Skill, CustomSkillElement> customSkillTypeEditorMenu, specialSettingsEditorMenu, minionSelectEditorMenu;
|
||||
|
||||
private IVariablePanelHandler<DropTable> mainDropTableEditMenu, dropTableTypeEditMenu;
|
||||
|
||||
private ISubVariablePanelHandler<DropTable, SprayTableElement> sprayDropTableMainEditMenu;
|
||||
private DropTableRewardMainEditorPanel<SprayTableElement> sprayDropRewardMainEditPanel;
|
||||
private DropTableNewRewardEditorPanel<SprayTableElement> sprayDropNewRewardEditPanel;
|
||||
private DropTableRewardsListEditorPanel<SprayTableElement> sprayDropRewardListPanel;
|
||||
|
||||
private ISubVariablePanelHandler<DropTable, GiveRewardEditHandler> giveRewardMainEditMenu, giveCommandRewardListPanel, giveCommandNewRewardPanel;
|
||||
private ISubSubVariablePanelHandler<DropTable, GiveRewardEditHandler, String> giveCommandRewardMainEditMenu;
|
||||
private ISubSubVariablePanelHandler<DropTable, GiveTableElement, String> giveRewardRewardsListMenu;
|
||||
|
@ -126,17 +121,13 @@ public class BossPanelManager implements ILoadable {
|
|||
private DropTableRewardMainEditorPanel<GiveRewardEditHandler> giveDropRewardMainEditPanel;
|
||||
private DropTableNewRewardEditorPanel<GiveRewardEditHandler> giveDropNewRewardEditPanel;
|
||||
private DropTableRewardsListEditorPanel<GiveRewardEditHandler> giveDropRewardListPanel;
|
||||
|
||||
private ISubVariablePanelHandler<DropTable, DropTableElement> dropDropTableMainEditMenu;
|
||||
private DropTableRewardMainEditorPanel<DropTableElement> dropDropRewardMainEditPanel;
|
||||
private DropTableNewRewardEditorPanel<DropTableElement> dropDropNewRewardEditPanel;
|
||||
private DropTableRewardsListEditorPanel<DropTableElement> dropDropRewardListPanel;
|
||||
|
||||
private IVariablePanelHandler<AutoSpawn> mainAutoSpawnEditPanel, autoSpawnEntitiesEditPanel, autoSpawnSpecialSettingsEditorPanel, autoSpawnTypeEditorPanel, autoSpawnCustomSettingsEditorPanel,
|
||||
autoSpawnMessageEditorPanel;
|
||||
|
||||
private PanelBuilder addItemsBuilder;
|
||||
private final EpicBosses epicBosses;
|
||||
|
||||
public BossPanelManager(EpicBosses epicBosses) {
|
||||
this.epicBosses = epicBosses;
|
||||
|
@ -203,8 +194,8 @@ public class BossPanelManager implements ILoadable {
|
|||
Collection<BossEntity> values = this.epicBosses.getBossEntityContainer().getData().values();
|
||||
int timesUsed = 0;
|
||||
|
||||
for(BossEntity bossEntity : values) {
|
||||
if(bossEntity != null) {
|
||||
for (BossEntity bossEntity : values) {
|
||||
if (bossEntity != null) {
|
||||
if (bossEntity.getSpawnItem() != null) {
|
||||
if (bossEntity.getSpawnItem().equalsIgnoreCase(name)) timesUsed += 1;
|
||||
}
|
||||
|
@ -546,7 +537,7 @@ public class BossPanelManager implements ILoadable {
|
|||
public void updateMessage(BossEntity bossEntity, String modifiedValue) {
|
||||
List<String> current = getCurrent(bossEntity);
|
||||
|
||||
if(current.contains(modifiedValue)) {
|
||||
if (current.contains(modifiedValue)) {
|
||||
current.remove(modifiedValue);
|
||||
} else {
|
||||
current.add(modifiedValue);
|
||||
|
|
|
@ -38,6 +38,10 @@ public class BossSkillManager implements ILoadable {
|
|||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public static ICustomSettingAction createCustomSkillAction(String name, String current, ItemStack displayStack, ClickAction clickAction) {
|
||||
return new CustomSkillActionCreator(name, current, displayStack, clickAction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
registerCustomSkill(new Cage(this.plugin));
|
||||
|
@ -53,7 +57,7 @@ public class BossSkillManager implements ILoadable {
|
|||
}
|
||||
|
||||
public void handleSkill(List<String> masterMessage, Skill skill, List<LivingEntity> targetedEntities, ActiveBossHolder activeBossHolder, boolean message, boolean subSkill) {
|
||||
if(skill == null) {
|
||||
if (skill == null) {
|
||||
Debug.SKILL_NOT_FOUND.debug();
|
||||
return;
|
||||
}
|
||||
|
@ -62,24 +66,24 @@ public class BossSkillManager implements ILoadable {
|
|||
String bossDisplayName = activeBossHolder.getName();
|
||||
String skillDisplayName = skill.getDisplayName();
|
||||
|
||||
if(skill.getType().equalsIgnoreCase("POTION")) {
|
||||
if (skill.getType().equalsIgnoreCase("POTION")) {
|
||||
PotionSkillElement potionSkillElement = getPotionSkillElement(skill);
|
||||
|
||||
potionSkillElement.castSkill(skill, potionSkillElement, activeBossHolder, targetedEntities);
|
||||
skillHandler = potionSkillElement;
|
||||
} else if(skill.getType().equalsIgnoreCase("COMMAND")) {
|
||||
} else if (skill.getType().equalsIgnoreCase("COMMAND")) {
|
||||
CommandSkillElement commandSkillElement = getCommandSkillElement(skill);
|
||||
|
||||
commandSkillElement.castSkill(skill, commandSkillElement, activeBossHolder, targetedEntities);
|
||||
skillHandler = commandSkillElement;
|
||||
} else if(skill.getType().equalsIgnoreCase("GROUP")) {
|
||||
if(subSkill) return;
|
||||
} else if (skill.getType().equalsIgnoreCase("GROUP")) {
|
||||
if (subSkill) return;
|
||||
|
||||
GroupSkillElement groupSkillElement = getGroupSkillElement(skill);
|
||||
|
||||
groupSkillElement.castSkill(skill, groupSkillElement, activeBossHolder, targetedEntities);
|
||||
skillHandler = groupSkillElement;
|
||||
} else if(skill.getType().equalsIgnoreCase("CUSTOM")) {
|
||||
} else if (skill.getType().equalsIgnoreCase("CUSTOM")) {
|
||||
CustomSkillElement customSkillElement = getCustomSkillElement(skill);
|
||||
|
||||
skillHandler = handleCustomSkillCasting(skill, customSkillElement, activeBossHolder, targetedEntities);
|
||||
|
@ -87,7 +91,7 @@ public class BossSkillManager implements ILoadable {
|
|||
return;
|
||||
}
|
||||
|
||||
if(message && masterMessage != null) {
|
||||
if (message && masterMessage != null) {
|
||||
masterMessage.replaceAll(s -> s.replace("{boss}", bossDisplayName).replace("{skill}", skillDisplayName));
|
||||
targetedEntities.forEach(livingEntity -> MessageUtils.get().sendMessage(livingEntity, masterMessage));
|
||||
}
|
||||
|
@ -97,7 +101,7 @@ public class BossSkillManager implements ILoadable {
|
|||
}
|
||||
|
||||
public PotionSkillElement getPotionSkillElement(Skill skill) {
|
||||
if(skill.getType().equalsIgnoreCase("POTION")) {
|
||||
if (skill.getType().equalsIgnoreCase("POTION")) {
|
||||
return BossesGson.get().fromJson(skill.getCustomData(), PotionSkillElement.class);
|
||||
}
|
||||
|
||||
|
@ -105,7 +109,7 @@ public class BossSkillManager implements ILoadable {
|
|||
}
|
||||
|
||||
public CommandSkillElement getCommandSkillElement(Skill skill) {
|
||||
if(skill.getType().equalsIgnoreCase("COMMAND")) {
|
||||
if (skill.getType().equalsIgnoreCase("COMMAND")) {
|
||||
return BossesGson.get().fromJson(skill.getCustomData(), CommandSkillElement.class);
|
||||
}
|
||||
|
||||
|
@ -113,7 +117,7 @@ public class BossSkillManager implements ILoadable {
|
|||
}
|
||||
|
||||
public GroupSkillElement getGroupSkillElement(Skill skill) {
|
||||
if(skill.getType().equalsIgnoreCase("GROUP")) {
|
||||
if (skill.getType().equalsIgnoreCase("GROUP")) {
|
||||
return BossesGson.get().fromJson(skill.getCustomData(), GroupSkillElement.class);
|
||||
}
|
||||
|
||||
|
@ -121,7 +125,7 @@ public class BossSkillManager implements ILoadable {
|
|||
}
|
||||
|
||||
public CustomSkillElement getCustomSkillElement(Skill skill) {
|
||||
if(skill.getType().equalsIgnoreCase("CUSTOM")) {
|
||||
if (skill.getType().equalsIgnoreCase("CUSTOM")) {
|
||||
return BossesGson.get().fromJson(skill.getCustomData(), CustomSkillElement.class);
|
||||
}
|
||||
|
||||
|
@ -133,16 +137,16 @@ public class BossSkillManager implements ILoadable {
|
|||
}
|
||||
|
||||
public boolean registerCustomSkill(CustomSkillHandler customSkillHandler) {
|
||||
if(SKILLS.contains(customSkillHandler)) return false;
|
||||
if(customSkillHandler == null) return false;
|
||||
if (SKILLS.contains(customSkillHandler)) return false;
|
||||
if (customSkillHandler == null) return false;
|
||||
|
||||
SKILLS.add(customSkillHandler);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void removeCustomSkill(CustomSkillHandler customSkillHandler) {
|
||||
if(!SKILLS.contains(customSkillHandler)) return;
|
||||
if(customSkillHandler == null) return;
|
||||
if (!SKILLS.contains(customSkillHandler)) return;
|
||||
if (customSkillHandler == null) return;
|
||||
|
||||
SKILLS.remove(customSkillHandler);
|
||||
}
|
||||
|
@ -152,23 +156,23 @@ public class BossSkillManager implements ILoadable {
|
|||
List<LivingEntity> targetedList = new ArrayList<>();
|
||||
String mode = skill.getMode();
|
||||
|
||||
if(mode.equalsIgnoreCase("ONE")) {
|
||||
if (mode.equalsIgnoreCase("ONE")) {
|
||||
return Arrays.asList(damager);
|
||||
} else if(mode.equalsIgnoreCase("BOSS")) {
|
||||
} else if (mode.equalsIgnoreCase("BOSS")) {
|
||||
for (UUID uuid : activeBossHolder.getLivingEntityMap().values()) {
|
||||
LivingEntity livingEntity = (LivingEntity) ServerUtils.get().getEntity(uuid);
|
||||
if (livingEntity != null)
|
||||
targetedList.add(livingEntity);
|
||||
}
|
||||
} else {
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!player.getWorld().equals(center.getWorld())) continue;
|
||||
if(center.distanceSquared(player.getLocation()) > radiusSqr) continue;
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!player.getWorld().equals(center.getWorld())) continue;
|
||||
if (center.distanceSquared(player.getLocation()) > radiusSqr) continue;
|
||||
|
||||
if(mode.equalsIgnoreCase("ALL")) {
|
||||
if (mode.equalsIgnoreCase("ALL")) {
|
||||
targetedList.add(player);
|
||||
} else if(mode.equalsIgnoreCase("RANDOM")) {
|
||||
if(RandomUtils.get().preformRandomAction()) {
|
||||
} else if (mode.equalsIgnoreCase("RANDOM")) {
|
||||
if (RandomUtils.get().preformRandomAction()) {
|
||||
targetedList.add(player);
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +186,7 @@ public class BossSkillManager implements ILoadable {
|
|||
String type = customSkillElement.getCustom().getType();
|
||||
CustomSkillHandler customSkillHandler = getCustomSkillHandler(type);
|
||||
|
||||
if(customSkillHandler == null) {
|
||||
if (customSkillHandler == null) {
|
||||
Debug.FAILED_TO_OBTAIN_THE_SKILL_HANDLER.debug(type);
|
||||
return null;
|
||||
}
|
||||
|
@ -192,19 +196,15 @@ public class BossSkillManager implements ILoadable {
|
|||
}
|
||||
|
||||
private CustomSkillHandler getCustomSkillHandler(String name) {
|
||||
for(CustomSkillHandler customSkillHandler : new HashSet<>(SKILLS)) {
|
||||
for (CustomSkillHandler customSkillHandler : new HashSet<>(SKILLS)) {
|
||||
String skillName = customSkillHandler.getSkillName();
|
||||
|
||||
if(skillName.equalsIgnoreCase(name)) return customSkillHandler;
|
||||
if (skillName.equalsIgnoreCase(name)) return customSkillHandler;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ICustomSettingAction createCustomSkillAction(String name, String current, ItemStack displayStack, ClickAction clickAction) {
|
||||
return new CustomSkillActionCreator(name, current, displayStack, clickAction);
|
||||
}
|
||||
|
||||
public List<String> getValidSkillTypes() {
|
||||
return this.validSkillTypes;
|
||||
}
|
||||
|
|
|
@ -34,11 +34,11 @@ public class BossTargetManager {
|
|||
String targeting = bossEntity.getTargeting();
|
||||
TargetHandler<ActiveBossHolder> targetHandler;
|
||||
|
||||
if(targeting.equalsIgnoreCase("RandomNearby")) {
|
||||
targetHandler = getRandomNearbyTargetHandler(activeBossHolder);
|
||||
} else if(targeting.equalsIgnoreCase("TopDamager")) {
|
||||
if (targeting.equalsIgnoreCase("RandomNearby")) {
|
||||
targetHandler = getRandomNearbyTargetHandler(activeBossHolder);
|
||||
} else if (targeting.equalsIgnoreCase("TopDamager")) {
|
||||
targetHandler = getTopDamagerTargetHandler(activeBossHolder);
|
||||
} else if(targeting.equalsIgnoreCase("NotDamagedNearby")) {
|
||||
} else if (targeting.equalsIgnoreCase("NotDamagedNearby")) {
|
||||
targetHandler = getNotDamagedNearbyTargetHandler(activeBossHolder);
|
||||
} else {
|
||||
targetHandler = getClosestTargetHandler(activeBossHolder);
|
||||
|
@ -52,11 +52,11 @@ public class BossTargetManager {
|
|||
String targeting = minionEntity.getTargeting();
|
||||
TargetHandler<ActiveMinionHolder> targetHandler;
|
||||
|
||||
if(targeting.equalsIgnoreCase("RandomNearby")) {
|
||||
if (targeting.equalsIgnoreCase("RandomNearby")) {
|
||||
targetHandler = getRandomNearbyTargetHandler(activeMinionHolder);
|
||||
} else if(targeting.equalsIgnoreCase("TopDamager")) {
|
||||
} else if (targeting.equalsIgnoreCase("TopDamager")) {
|
||||
targetHandler = getTopDamagerTargetHandler(activeMinionHolder);
|
||||
} else if(targeting.equalsIgnoreCase("NotDamagedNearby")) {
|
||||
} else if (targeting.equalsIgnoreCase("NotDamagedNearby")) {
|
||||
targetHandler = getNotDamagedNearbyTargetHandler(activeMinionHolder);
|
||||
} else {
|
||||
targetHandler = getClosestTargetHandler(activeMinionHolder);
|
||||
|
|
|
@ -29,19 +29,19 @@ public class BossTauntManager {
|
|||
public void handleTauntSystem(ActiveBossHolder activeBossHolder) {
|
||||
BossEntity bossEntity = activeBossHolder.getBossEntity();
|
||||
|
||||
if(bossEntity.getMessages() == null) return;
|
||||
if(bossEntity.getMessages().getTaunts() == null) return;
|
||||
if (bossEntity.getMessages() == null) return;
|
||||
if (bossEntity.getMessages().getTaunts() == null) return;
|
||||
|
||||
TauntElement tauntElement = bossEntity.getMessages().getTaunts();
|
||||
Integer delay = tauntElement.getDelay();
|
||||
Integer radius = tauntElement.getRadius();
|
||||
List<String> taunts = tauntElement.getTaunts();
|
||||
|
||||
if(delay == null) delay = 60;
|
||||
if(radius == null) radius = 100;
|
||||
if (delay == null) delay = 60;
|
||||
if (radius == null) radius = 100;
|
||||
|
||||
if(taunts != null) {
|
||||
if(taunts.isEmpty()) return;
|
||||
if (taunts != null) {
|
||||
if (taunts.isEmpty()) return;
|
||||
|
||||
createRunnable(taunts, activeBossHolder, NumberUtils.get().getSquared(radius), delay);
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ public class BossTauntManager {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
if(activeBossHolder.isDead() || BossTauntManager.this.plugin.getBossEntityManager().isAllEntitiesDead(activeBossHolder)) {
|
||||
if (activeBossHolder.isDead() || BossTauntManager.this.plugin.getBossEntityManager().isAllEntitiesDead(activeBossHolder)) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.queue.isEmpty()) this.queue = new LinkedList<>(taunts);
|
||||
if (this.queue.isEmpty()) this.queue = new LinkedList<>(taunts);
|
||||
|
||||
List<String> messages = BossAPI.getStoredMessages(this.queue.poll());
|
||||
|
||||
|
@ -66,6 +66,6 @@ public class BossTauntManager {
|
|||
MessageUtils.get().sendMessage(activeBossHolder.getLocation(), radius, messages);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(this.plugin, delay*20, delay*20);
|
||||
}.runTaskTimer(this.plugin, delay * 20, delay * 20);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ import java.util.Queue;
|
|||
*/
|
||||
public class MinionMechanicManager implements IMechanicManager<MinionEntity, ActiveMinionHolder, IMinionMechanic> {
|
||||
|
||||
private Queue<IMinionMechanic> mechanics;
|
||||
private final EpicBosses epicBosses;
|
||||
private Queue<IMinionMechanic> mechanics;
|
||||
|
||||
public MinionMechanicManager(EpicBosses epicBosses) {
|
||||
this.epicBosses = epicBosses;
|
||||
|
@ -46,22 +46,22 @@ public class MinionMechanicManager implements IMechanicManager<MinionEntity, Act
|
|||
|
||||
@Override
|
||||
public void handleMechanicApplication(MinionEntity minionEntity, ActiveMinionHolder activeMinionHolder) {
|
||||
if(minionEntity != null && activeMinionHolder != null) {
|
||||
if(minionEntity.isEditing()) {
|
||||
if (minionEntity != null && activeMinionHolder != null) {
|
||||
if (minionEntity.isEditing()) {
|
||||
Debug.ATTEMPTED_TO_SPAWN_WHILE_DISABLED.debug();
|
||||
return;
|
||||
}
|
||||
|
||||
Queue<IMinionMechanic> queue = new LinkedList<>(this.mechanics);
|
||||
|
||||
while(!queue.isEmpty()) {
|
||||
while (!queue.isEmpty()) {
|
||||
IMinionMechanic mechanic = queue.poll();
|
||||
|
||||
if(mechanic == null) continue;
|
||||
if (mechanic == null) continue;
|
||||
|
||||
ServerUtils.get().logDebug("Applying " + mechanic.getClass().getSimpleName());
|
||||
|
||||
if(didMechanicApplicationFail(mechanic, minionEntity, activeMinionHolder)) {
|
||||
if (didMechanicApplicationFail(mechanic, minionEntity, activeMinionHolder)) {
|
||||
Debug.FAILED_TO_APPLY_MECHANIC.debug(mechanic.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ public class MinionMechanicManager implements IMechanicManager<MinionEntity, Act
|
|||
}
|
||||
|
||||
private boolean didMechanicApplicationFail(IMinionMechanic mechanic, MinionEntity minionEntity, ActiveMinionHolder activeBossHolder) {
|
||||
if(mechanic == null) return true;
|
||||
if (mechanic == null) return true;
|
||||
|
||||
if(!mechanic.applyMechanic(minionEntity, activeBossHolder)) {
|
||||
if (!mechanic.applyMechanic(minionEntity, activeBossHolder)) {
|
||||
Debug.MECHANIC_APPLICATION_FAILED.debug(mechanic.getClass().getSimpleName());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class AutoSpawnFileManager implements ILoadable, ISavable, IReloadable {
|
|||
}
|
||||
|
||||
public void saveAutoSpawn(String name, AutoSpawn autoSpawn) {
|
||||
if(this.autoSpawnMap.containsKey(name)) return;
|
||||
if (this.autoSpawnMap.containsKey(name)) return;
|
||||
|
||||
this.autoSpawnMap.put(name, autoSpawn);
|
||||
save();
|
||||
|
|
|
@ -48,7 +48,7 @@ public class BossesFileManager implements ILoadable, ISavable, IReloadable {
|
|||
}
|
||||
|
||||
public void saveBossEntity(String name, BossEntity bossEntity) {
|
||||
if(this.bossEntityContainer.exists(name)) return;
|
||||
if (this.bossEntityContainer.exists(name)) return;
|
||||
|
||||
this.bossEntityContainer.saveData(name, bossEntity);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class CommandsFileManager implements ILoadable, ISavable, IReloadable {
|
|||
}
|
||||
|
||||
public boolean addNewCommand(String id, List<String> commands) {
|
||||
if(this.commandsMap.containsKey(id)) return false;
|
||||
if (this.commandsMap.containsKey(id)) return false;
|
||||
|
||||
commandsMap.put(id, commands);
|
||||
return true;
|
||||
|
|
|
@ -43,7 +43,7 @@ public class DropTableFileManager implements ILoadable, ISavable, IReloadable {
|
|||
}
|
||||
|
||||
public void saveDropTable(String name, DropTable dropTable) {
|
||||
if(this.dropTableMap.containsKey(name)) return;
|
||||
if (this.dropTableMap.containsKey(name)) return;
|
||||
|
||||
this.dropTableMap.put(name, dropTable);
|
||||
save();
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MessagesFileManager implements ILoadable, ISavable {
|
|||
}
|
||||
|
||||
public boolean addNewMessage(String id, List<String> message) {
|
||||
if(this.messagesMap.containsKey(id)) return false;
|
||||
if (this.messagesMap.containsKey(id)) return false;
|
||||
|
||||
messagesMap.put(id, message);
|
||||
return true;
|
||||
|
|
|
@ -19,7 +19,7 @@ public class EntityTypeMechanic implements IBossMechanic {
|
|||
|
||||
@Override
|
||||
public boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
|
||||
for(EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
|
||||
String bossEntityType = mainStatsElement.getEntityType();
|
||||
|
@ -27,20 +27,20 @@ public class EntityTypeMechanic implements IBossMechanic {
|
|||
EntityFinder entityFinder = EntityFinder.get(input);
|
||||
Integer position = mainStatsElement.getPosition();
|
||||
|
||||
if(position == null) position = 1;
|
||||
if(entityFinder == null) return false;
|
||||
if (position == null) position = 1;
|
||||
if (entityFinder == null) return false;
|
||||
|
||||
LivingEntity livingEntity = entityFinder.spawnNewLivingEntity(bossEntityType, activeBossHolder.getLocation());
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
activeBossHolder.setLivingEntity(position, livingEntity);
|
||||
|
||||
if(position > 1) {
|
||||
if (position > 1) {
|
||||
int lowerPosition = position - 1;
|
||||
LivingEntity lowerLivingEntity = activeBossHolder.getLivingEntity(lowerPosition);
|
||||
|
||||
if(lowerLivingEntity == null) {
|
||||
if (lowerLivingEntity == null) {
|
||||
Debug.FAILED_ATTEMPT_TO_STACK_BOSSES.debug(BossAPI.getBossEntityName(bossEntity));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@ public class EquipmentMechanic implements IBossMechanic {
|
|||
|
||||
@Override
|
||||
public boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
|
||||
if(activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
if (activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
|
||||
for(EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeBossHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
EquipmentElement equipmentElement = entityStatsElement.getEquipment();
|
||||
EntityEquipment entityEquipment = livingEntity.getEquipment();
|
||||
|
@ -42,40 +42,40 @@ public class EquipmentMechanic implements IBossMechanic {
|
|||
String leggings = equipmentElement.getLeggings();
|
||||
String boots = equipmentElement.getBoots();
|
||||
|
||||
if(helmet != null) {
|
||||
if (helmet != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(helmet);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setHelmet(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
if(chestplate != null) {
|
||||
if (chestplate != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(chestplate);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setChestplate(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
if(leggings != null) {
|
||||
if (leggings != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(leggings);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setLeggings(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
if(boots != null) {
|
||||
if (boots != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(boots);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setBoots(itemStack);
|
||||
|
|
|
@ -18,18 +18,18 @@ public class HealthMechanic implements IBossMechanic {
|
|||
|
||||
@Override
|
||||
public boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
|
||||
if(activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
if (activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
|
||||
double maxHealthSetting = (double) SpigotYmlReader.get().getObject("settings.attribute.maxHealth.max");
|
||||
|
||||
for(EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeBossHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
double maxHealth = mainStatsElement.getHealth();
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
if(maxHealth > maxHealthSetting) {
|
||||
if (maxHealth > maxHealthSetting) {
|
||||
Debug.MAX_HEALTH.debug(maxHealthSetting);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,16 +28,16 @@ public class PotionMechanic implements IBossMechanic {
|
|||
|
||||
@Override
|
||||
public boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
|
||||
if(activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
if (activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
|
||||
for(EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeBossHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
List<PotionEffectHolder> potionElements = entityStatsElement.getPotions();
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
if(potionElements != null && !potionElements.isEmpty()) {
|
||||
if (potionElements != null && !potionElements.isEmpty()) {
|
||||
potionElements.forEach(potionElement -> {
|
||||
PotionEffect potionEffect = this.potionEffectConverter.from(potionElement);
|
||||
if (potionEffect == null) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.songoda.epicbosses.mechanics.boss;
|
||||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.entity.BossEntity;
|
||||
import com.songoda.epicbosses.entity.elements.EntityStatsElement;
|
||||
import com.songoda.epicbosses.entity.elements.MainStatsElement;
|
||||
import com.songoda.epicbosses.holder.ActiveBossHolder;
|
||||
import com.songoda.epicbosses.mechanics.IBossMechanic;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
|
||||
|
@ -16,21 +16,15 @@ import org.bukkit.inventory.EntityEquipment;
|
|||
*/
|
||||
public class SettingsMechanic implements IBossMechanic {
|
||||
|
||||
private VersionHandler versionHandler;
|
||||
|
||||
public SettingsMechanic() {
|
||||
this.versionHandler = new VersionHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
|
||||
if(activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
if (activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
|
||||
for(EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeBossHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
EntityEquipment entityEquipment = livingEntity.getEquipment();
|
||||
|
||||
|
@ -41,7 +35,7 @@ public class SettingsMechanic implements IBossMechanic {
|
|||
entityEquipment.setLeggingsDropChance(0.0F);
|
||||
entityEquipment.setBootsDropChance(0.0F);
|
||||
|
||||
if(this.versionHandler.canUseOffHand()) {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
entityEquipment.setItemInMainHandDropChance(0.0F);
|
||||
entityEquipment.setItemInOffHandDropChance(0.0F);
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.songoda.epicbosses.mechanics.boss;
|
||||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.entity.BossEntity;
|
||||
import com.songoda.epicbosses.entity.elements.EntityStatsElement;
|
||||
import com.songoda.epicbosses.entity.elements.HandsElement;
|
||||
|
@ -8,7 +9,6 @@ import com.songoda.epicbosses.holder.ActiveBossHolder;
|
|||
import com.songoda.epicbosses.managers.files.ItemsFileManager;
|
||||
import com.songoda.epicbosses.mechanics.IBossMechanic;
|
||||
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -21,46 +21,40 @@ import org.bukkit.inventory.ItemStack;
|
|||
public class WeaponMechanic implements IBossMechanic {
|
||||
|
||||
private ItemsFileManager itemStackManager;
|
||||
private VersionHandler versionHandler;
|
||||
|
||||
public WeaponMechanic(ItemsFileManager itemStackManager) {
|
||||
this.itemStackManager = itemStackManager;
|
||||
this.versionHandler = new VersionHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
|
||||
if(activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
if (activeBossHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
|
||||
for(EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : bossEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeBossHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
EntityEquipment entityEquipment = livingEntity.getEquipment();
|
||||
HandsElement handsElement = entityStatsElement.getHands();
|
||||
String mainHand = handsElement.getMainHand();
|
||||
String offHand = handsElement.getOffHand();
|
||||
|
||||
if(mainHand != null) {
|
||||
if (mainHand != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(mainHand);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
if(this.versionHandler.canUseOffHand()) {
|
||||
entityEquipment.setItemInMainHand(itemStack);
|
||||
} else {
|
||||
entityEquipment.setItemInHand(itemStack);
|
||||
}
|
||||
entityEquipment.setItemInHand(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
if(offHand != null && this.versionHandler.canUseOffHand()) {
|
||||
if (offHand != null && ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(offHand);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setItemInOffHand(itemStack);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class EntityTypeMechanic implements IMinionMechanic {
|
|||
|
||||
@Override
|
||||
public boolean applyMechanic(MinionEntity minionEntity, ActiveMinionHolder activeMinionHolder) {
|
||||
for(EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
|
||||
String bossEntityType = mainStatsElement.getEntityType();
|
||||
|
@ -27,21 +27,21 @@ public class EntityTypeMechanic implements IMinionMechanic {
|
|||
EntityFinder entityFinder = EntityFinder.get(input);
|
||||
Integer position = mainStatsElement.getPosition();
|
||||
|
||||
if(position == null) position = 1;
|
||||
if(entityFinder == null) return false;
|
||||
if (position == null) position = 1;
|
||||
if (entityFinder == null) return false;
|
||||
|
||||
LivingEntity livingEntity = entityFinder.spawnNewLivingEntity(bossEntityType, activeMinionHolder.getLocation());
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if(!activeMinionHolder.getLivingEntityMap().isEmpty()) activeMinionHolder.killAll();
|
||||
if (livingEntity == null) return false;
|
||||
if (!activeMinionHolder.getLivingEntityMap().isEmpty()) activeMinionHolder.killAll();
|
||||
|
||||
activeMinionHolder.getLivingEntityMap().put(position, livingEntity.getUniqueId());
|
||||
|
||||
if(position > 1) {
|
||||
if (position > 1) {
|
||||
int lowerPosition = position - 1;
|
||||
LivingEntity lowerLivingEntity = activeMinionHolder.getLivingEntity(lowerPosition);
|
||||
|
||||
if(lowerLivingEntity == null) {
|
||||
if (lowerLivingEntity == null) {
|
||||
Debug.FAILED_ATTEMPT_TO_STACK_BOSSES.debug(BossAPI.getMinionEntityName(minionEntity));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,13 +27,14 @@ public class EquipmentMechanic implements IMinionMechanic {
|
|||
|
||||
@Override
|
||||
public boolean applyMechanic(MinionEntity minionEntity, ActiveMinionHolder activeBossHolder) {
|
||||
if(activeBossHolder.getLivingEntityMap() == null || activeBossHolder.getLivingEntityMap().isEmpty()) return false;
|
||||
if (activeBossHolder.getLivingEntityMap() == null || activeBossHolder.getLivingEntityMap().isEmpty())
|
||||
return false;
|
||||
|
||||
for(EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeBossHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
EquipmentElement equipmentElement = entityStatsElement.getEquipment();
|
||||
EntityEquipment entityEquipment = livingEntity.getEquipment();
|
||||
|
@ -42,40 +43,40 @@ public class EquipmentMechanic implements IMinionMechanic {
|
|||
String leggings = equipmentElement.getLeggings();
|
||||
String boots = equipmentElement.getBoots();
|
||||
|
||||
if(helmet != null) {
|
||||
if (helmet != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(helmet);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setHelmet(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
if(chestplate != null) {
|
||||
if (chestplate != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(chestplate);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setChestplate(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
if(leggings != null) {
|
||||
if (leggings != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(leggings);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setLeggings(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
if(boots != null) {
|
||||
if (boots != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(boots);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setBoots(itemStack);
|
||||
|
|
|
@ -18,18 +18,19 @@ public class HealthMechanic implements IMinionMechanic {
|
|||
|
||||
@Override
|
||||
public boolean applyMechanic(MinionEntity minionEntity, ActiveMinionHolder activeMinionHolder) {
|
||||
if(activeMinionHolder.getLivingEntityMap() == null || activeMinionHolder.getLivingEntityMap().isEmpty()) return false;
|
||||
if (activeMinionHolder.getLivingEntityMap() == null || activeMinionHolder.getLivingEntityMap().isEmpty())
|
||||
return false;
|
||||
|
||||
double maxHealthSetting = (double) SpigotYmlReader.get().getObject("settings.attribute.maxHealth.max");
|
||||
|
||||
for(EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeMinionHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
double maxHealth = mainStatsElement.getHealth();
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
if(maxHealth > maxHealthSetting) {
|
||||
if (maxHealth > maxHealthSetting) {
|
||||
Debug.MAX_HEALTH.debug(maxHealthSetting);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -26,16 +26,16 @@ public class PotionMechanic implements IMinionMechanic {
|
|||
|
||||
@Override
|
||||
public boolean applyMechanic(MinionEntity minionEntity, ActiveMinionHolder activeMinionHolder) {
|
||||
if(activeMinionHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
if (activeMinionHolder.getLivingEntityMap().getOrDefault(1, null) == null) return false;
|
||||
|
||||
for(EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeMinionHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
List<PotionEffectHolder> potionElements = entityStatsElement.getPotions();
|
||||
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.songoda.epicbosses.mechanics.minions;
|
||||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.entity.MinionEntity;
|
||||
import com.songoda.epicbosses.entity.elements.EntityStatsElement;
|
||||
import com.songoda.epicbosses.entity.elements.MainStatsElement;
|
||||
import com.songoda.epicbosses.holder.ActiveMinionHolder;
|
||||
import com.songoda.epicbosses.mechanics.IMinionMechanic;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
|
||||
|
@ -16,21 +16,16 @@ import org.bukkit.inventory.EntityEquipment;
|
|||
*/
|
||||
public class SettingsMechanic implements IMinionMechanic {
|
||||
|
||||
private VersionHandler versionHandler;
|
||||
|
||||
public SettingsMechanic() {
|
||||
this.versionHandler = new VersionHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyMechanic(MinionEntity minionEntity, ActiveMinionHolder activeMinionHolder) {
|
||||
if(activeMinionHolder.getLivingEntityMap() == null || activeMinionHolder.getLivingEntityMap().isEmpty()) return false;
|
||||
if (activeMinionHolder.getLivingEntityMap() == null || activeMinionHolder.getLivingEntityMap().isEmpty())
|
||||
return false;
|
||||
|
||||
for(EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeMinionHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
EntityEquipment entityEquipment = livingEntity.getEquipment();
|
||||
|
||||
|
@ -41,7 +36,7 @@ public class SettingsMechanic implements IMinionMechanic {
|
|||
entityEquipment.setLeggingsDropChance(0.0F);
|
||||
entityEquipment.setBootsDropChance(0.0F);
|
||||
|
||||
if(this.versionHandler.canUseOffHand()) {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
entityEquipment.setItemInMainHandDropChance(0.0F);
|
||||
entityEquipment.setItemInOffHandDropChance(0.0F);
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.songoda.epicbosses.mechanics.minions;
|
||||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.entity.MinionEntity;
|
||||
import com.songoda.epicbosses.entity.elements.EntityStatsElement;
|
||||
import com.songoda.epicbosses.entity.elements.HandsElement;
|
||||
|
@ -8,7 +9,6 @@ import com.songoda.epicbosses.holder.ActiveMinionHolder;
|
|||
import com.songoda.epicbosses.managers.files.ItemsFileManager;
|
||||
import com.songoda.epicbosses.mechanics.IMinionMechanic;
|
||||
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -21,35 +21,34 @@ import org.bukkit.inventory.ItemStack;
|
|||
public class WeaponMechanic implements IMinionMechanic {
|
||||
|
||||
private ItemsFileManager itemStackManager;
|
||||
private VersionHandler versionHandler;
|
||||
|
||||
public WeaponMechanic(ItemsFileManager itemStackManager) {
|
||||
this.itemStackManager = itemStackManager;
|
||||
this.versionHandler = new VersionHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyMechanic(MinionEntity minionEntity, ActiveMinionHolder activeMinionHolder) {
|
||||
if(activeMinionHolder.getLivingEntityMap() == null || activeMinionHolder.getLivingEntityMap().isEmpty()) return false;
|
||||
if (activeMinionHolder.getLivingEntityMap() == null || activeMinionHolder.getLivingEntityMap().isEmpty())
|
||||
return false;
|
||||
|
||||
for(EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
for (EntityStatsElement entityStatsElement : minionEntity.getEntityStats()) {
|
||||
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
|
||||
LivingEntity livingEntity = activeMinionHolder.getLivingEntity(mainStatsElement.getPosition());
|
||||
|
||||
if(livingEntity == null) return false;
|
||||
if (livingEntity == null) return false;
|
||||
|
||||
EntityEquipment entityEquipment = livingEntity.getEquipment();
|
||||
HandsElement handsElement = entityStatsElement.getHands();
|
||||
String mainHand = handsElement.getMainHand();
|
||||
String offHand = handsElement.getOffHand();
|
||||
|
||||
if(mainHand != null) {
|
||||
if (mainHand != null) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(mainHand);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
if(this.versionHandler.canUseOffHand()) {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
entityEquipment.setItemInMainHand(itemStack);
|
||||
} else {
|
||||
entityEquipment.setItemInHand(itemStack);
|
||||
|
@ -57,10 +56,10 @@ public class WeaponMechanic implements IMinionMechanic {
|
|||
}
|
||||
}
|
||||
|
||||
if(offHand != null && this.versionHandler.canUseOffHand()) {
|
||||
if (offHand != null && ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
ItemStackHolder itemStackHolder = this.itemStackManager.getItemStackHolder(offHand);
|
||||
|
||||
if(itemStackHolder != null) {
|
||||
if (itemStackHolder != null) {
|
||||
ItemStack itemStack = this.itemStackManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
entityEquipment.setItemInOffHand(itemStack);
|
||||
|
|
|
@ -25,7 +25,6 @@ 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 com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -47,7 +46,6 @@ import java.util.*;
|
|||
public class Cage extends CustomSkillHandler {
|
||||
|
||||
private static final MaterialConverter MATERIAL_CONVERTER = new MaterialConverter();
|
||||
private static final VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
private static final Map<Location, CageLocationData> cageLocationDataMap = new HashMap<>();
|
||||
private static final List<UUID> playersInCage = new ArrayList<>();
|
||||
|
|
|
@ -52,8 +52,8 @@ public class Disarm extends CustomSkillHandler {
|
|||
if (livingEntity instanceof HumanEntity) {
|
||||
HumanEntity humanEntity = (HumanEntity) livingEntity;
|
||||
|
||||
itemStack = EpicBosses.getInstance().getVersionHandler().getItemInHand(humanEntity);
|
||||
EpicBosses.getInstance().getVersionHandler().setItemInHand(humanEntity, replacementItemStack);
|
||||
itemStack = humanEntity.getItemInHand();
|
||||
humanEntity.setItemInHand(replacementItemStack);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
|
|
|
@ -32,14 +32,14 @@ public abstract class TargetHandler<Holder extends IActiveHolder> implements ITa
|
|||
ServerUtils.get().runLaterAsync(10L, () -> {
|
||||
updateTarget();
|
||||
|
||||
if(!getHolder().isDead()) runTargetCycle();
|
||||
if (!getHolder().isDead()) runTargetCycle();
|
||||
});
|
||||
}
|
||||
|
||||
protected LivingEntity getBossEntity() {
|
||||
for(UUID uuid : getHolder().getLivingEntityMap().values()) {
|
||||
for (UUID uuid : getHolder().getLivingEntityMap().values()) {
|
||||
LivingEntity livingEntity = (LivingEntity) ServerUtils.get().getEntity(uuid);
|
||||
if(livingEntity != null && !livingEntity.isDead()) return livingEntity;
|
||||
if (livingEntity != null && !livingEntity.isDead()) return livingEntity;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -49,22 +49,22 @@ public abstract class TargetHandler<Holder extends IActiveHolder> implements ITa
|
|||
LivingEntity boss = getBossEntity();
|
||||
double radius = this.bossTargetManager.getTargetRadius();
|
||||
|
||||
if(boss == null) return;
|
||||
if (boss == null) return;
|
||||
|
||||
List<LivingEntity> nearbyEntities = new ArrayList<>();
|
||||
List<Entity> nearbyBossEntities = boss.getNearbyEntities(radius, radius, radius);
|
||||
|
||||
if(nearbyBossEntities == null) return;
|
||||
if (nearbyBossEntities == null) return;
|
||||
|
||||
for(Entity entity : nearbyBossEntities) {
|
||||
if(!(entity instanceof Player)) continue;
|
||||
for (Entity entity : nearbyBossEntities) {
|
||||
if (!(entity instanceof Player)) continue;
|
||||
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
|
||||
if(livingEntity instanceof Player) {
|
||||
if (livingEntity instanceof Player) {
|
||||
Player player = (Player) livingEntity;
|
||||
|
||||
if(player.getGameMode() == GameMode.SPECTATOR || player.getGameMode() == GameMode.CREATIVE) continue;
|
||||
if (player.getGameMode() == GameMode.SPECTATOR || player.getGameMode() == GameMode.CREATIVE) continue;
|
||||
}
|
||||
|
||||
nearbyEntities.add(livingEntity);
|
||||
|
@ -76,7 +76,7 @@ public abstract class TargetHandler<Holder extends IActiveHolder> implements ITa
|
|||
private void updateBoss(LivingEntity newTarget) {
|
||||
getHolder().getLivingEntityMap().values().forEach(uuid -> {
|
||||
LivingEntity livingEntity = (LivingEntity) ServerUtils.get().getEntity(uuid);
|
||||
if(livingEntity != null && !livingEntity.isDead()) {
|
||||
if (livingEntity != null && !livingEntity.isDead()) {
|
||||
((Creature) livingEntity).setTarget(newTarget);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,8 +25,8 @@ public class ClosestTargetHandler<T extends IActiveHolder> extends TargetHandler
|
|||
double closestDistance = (radius * radius);
|
||||
LivingEntity nearestTarget = null;
|
||||
|
||||
for(LivingEntity livingEntity : nearbyEntities) {
|
||||
if(livingEntity.getLocation().distanceSquared(boss.getLocation()) > closestDistance) continue;
|
||||
for (LivingEntity livingEntity : nearbyEntities) {
|
||||
if (livingEntity.getLocation().distanceSquared(boss.getLocation()) > closestDistance) continue;
|
||||
|
||||
closestDistance = livingEntity.getLocation().distanceSquared(boss.getLocation());
|
||||
nearestTarget = livingEntity;
|
||||
|
|
|
@ -21,13 +21,13 @@ public class NotDamagedNearbyTargetHandler<T extends IActiveHolder> extends Targ
|
|||
|
||||
@Override
|
||||
public LivingEntity selectTarget(List<LivingEntity> nearbyEntities) {
|
||||
for(LivingEntity livingEntity : nearbyEntities) {
|
||||
if(getHolder().hasAttacked(livingEntity.getUniqueId())) continue;
|
||||
for (LivingEntity livingEntity : nearbyEntities) {
|
||||
if (getHolder().hasAttacked(livingEntity.getUniqueId())) continue;
|
||||
|
||||
return livingEntity;
|
||||
}
|
||||
|
||||
if(!nearbyEntities.isEmpty()) {
|
||||
if (!nearbyEntities.isEmpty()) {
|
||||
Collections.shuffle(nearbyEntities);
|
||||
|
||||
return nearbyEntities.stream().findFirst().orElse(null);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TopDamagerTargetHandler<T extends IActiveHolder> extends TargetHand
|
|||
nearbyEntities.forEach(livingEntity -> {
|
||||
UUID uuid = livingEntity.getUniqueId();
|
||||
|
||||
if(mapOfDamages.containsKey(uuid)) {
|
||||
if (mapOfDamages.containsKey(uuid)) {
|
||||
nearbyDamages.put(livingEntity, mapOfDamages.get(uuid));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2,15 +2,12 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class DolphinHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) {
|
||||
|
|
|
@ -2,15 +2,12 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class DrownedHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -14,8 +13,6 @@ import org.bukkit.entity.LivingEntity;
|
|||
*/
|
||||
public class ElderGuardianHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_8))
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -14,8 +13,6 @@ import org.bukkit.entity.LivingEntity;
|
|||
*/
|
||||
public class EndermiteHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_8))
|
||||
|
|
|
@ -2,15 +2,12 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class FishHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13))
|
||||
|
|
|
@ -2,15 +2,12 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class FoxHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_14))
|
||||
|
|
|
@ -2,15 +2,12 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class PandaHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_14))
|
||||
|
|
|
@ -2,15 +2,12 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class PillagerHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_14))
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -14,8 +13,6 @@ import org.bukkit.entity.LivingEntity;
|
|||
*/
|
||||
public class ShulkerHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_9)) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.songoda.epicbosses.utils.entity.handlers;
|
|||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.epicbosses.utils.entity.ICustomEntityHandler;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -15,8 +14,6 @@ import org.bukkit.entity.Skeleton;
|
|||
*/
|
||||
public class WitherSkeletonHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.songoda.epicbosses.utils.ServerUtils;
|
|||
import com.songoda.epicbosses.utils.StringUtils;
|
||||
import com.songoda.epicbosses.utils.itemstack.enchants.GlowEnchant;
|
||||
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
||||
import com.songoda.epicbosses.utils.version.VersionHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
@ -26,7 +25,6 @@ import java.util.*;
|
|||
*/
|
||||
public class ItemStackUtils {
|
||||
|
||||
private static final VersionHandler versionHandler = new VersionHandler();
|
||||
private static final Map<EntityType, Material> spawnableEntityMaterials;
|
||||
private static final Map<EntityType, Short> spawnableEntityIds;
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
package com.songoda.epicbosses.utils.version;
|
||||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 27-Jun-18
|
||||
*/
|
||||
public class VersionHandler {
|
||||
|
||||
public boolean canUseOffHand() {
|
||||
return ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9);
|
||||
}
|
||||
|
||||
public ItemStack getItemInHand(HumanEntity humanEntity) {
|
||||
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_8)) {
|
||||
return humanEntity.getItemInHand();
|
||||
} else {
|
||||
return humanEntity.getInventory().getItemInMainHand();
|
||||
}
|
||||
}
|
||||
|
||||
public void setItemInHand(HumanEntity humanEntity, ItemStack itemStack) {
|
||||
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_8)) {
|
||||
humanEntity.setItemInHand(itemStack);
|
||||
} else {
|
||||
humanEntity.getInventory().setItemInMainHand(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue