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