mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-23 11:06:14 +01:00
Implement boss drops.
This commit is contained in:
parent
7766260154
commit
d6c1f97415
@ -6,6 +6,7 @@ import com.garbagemule.MobArena.events.ArenaKillEvent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -529,11 +530,6 @@ public class ArenaListener
|
||||
}
|
||||
callKillEvent(p, damagee);
|
||||
}
|
||||
|
||||
MABoss boss = monsters.removeBoss(damagee);
|
||||
if (boss != null) {
|
||||
boss.setDead(true);
|
||||
}
|
||||
|
||||
if (!monsterExp) {
|
||||
event.setDroppedExp(0);
|
||||
@ -541,6 +537,15 @@ public class ArenaListener
|
||||
|
||||
event.getDrops().clear();
|
||||
|
||||
MABoss boss = monsters.removeBoss(damagee);
|
||||
if (boss != null) {
|
||||
List<ItemStack> drops = boss.getDrops();
|
||||
if (drops != null && !drops.isEmpty()) {
|
||||
event.getDrops().addAll(drops);
|
||||
}
|
||||
boss.setDead(true);
|
||||
}
|
||||
|
||||
List<ItemStack> loot = monsters.getLoot(damagee);
|
||||
if (loot != null && !loot.isEmpty()) {
|
||||
event.getDrops().add(getRandomItem(loot));
|
||||
|
@ -180,6 +180,7 @@ public class MASpawnThread implements Runnable
|
||||
double maxHealth = bw.getMaxHealth(playerCount);
|
||||
MABoss boss = monsterManager.addBoss(e, maxHealth);
|
||||
boss.setReward(bw.getReward());
|
||||
boss.setDrops(bw.getDrops());
|
||||
bw.addMABoss(boss);
|
||||
bw.activateAbilities(arena);
|
||||
if (bw.getBossName() != null) {
|
||||
|
@ -3,11 +3,14 @@ package com.garbagemule.MobArena.waves;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MABoss
|
||||
{
|
||||
private LivingEntity entity;
|
||||
private boolean dead;
|
||||
private ItemStack reward;
|
||||
private List<ItemStack> drops;
|
||||
|
||||
/**
|
||||
* Create an MABoss from the given entity with the given max health.
|
||||
@ -71,4 +74,12 @@ public class MABoss
|
||||
public ItemStack getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public void setDrops(List<ItemStack> drops) {
|
||||
this.drops = drops;
|
||||
}
|
||||
|
||||
public List<ItemStack> getDrops() {
|
||||
return drops;
|
||||
}
|
||||
}
|
||||
|
@ -291,6 +291,11 @@ public class WaveParser
|
||||
ItemStack item = ItemParser.parseItem(rew);
|
||||
if (item != null) result.setReward(item);
|
||||
}
|
||||
|
||||
// Drops!
|
||||
String drp = config.getString("drops");
|
||||
List<ItemStack> drops = ItemParser.parseItems(drp);
|
||||
result.setDrops(drops);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class BossWave extends AbstractWave
|
||||
private int abilityInterval;
|
||||
|
||||
private ItemStack reward;
|
||||
private List<ItemStack> drops;
|
||||
|
||||
public BossWave(MACreature monster) {
|
||||
this.monster = monster;
|
||||
@ -120,6 +121,14 @@ public class BossWave extends AbstractWave
|
||||
public void setReward(ItemStack reward) {
|
||||
this.reward = reward;
|
||||
}
|
||||
|
||||
public List<ItemStack> getDrops() {
|
||||
return drops;
|
||||
}
|
||||
|
||||
public void setDrops(List<ItemStack> drops) {
|
||||
this.drops = drops;
|
||||
}
|
||||
|
||||
public void activateAbilities(Arena arena) {
|
||||
if (activated) {
|
||||
@ -149,6 +158,7 @@ public class BossWave extends AbstractWave
|
||||
result.healthMultiplier = this.healthMultiplier;
|
||||
result.flatHealth = this.flatHealth;
|
||||
result.reward = this.reward;
|
||||
result.drops = this.drops;
|
||||
result.bossName = this.bossName;
|
||||
|
||||
// From AbstractWave
|
||||
|
Loading…
Reference in New Issue
Block a user