Merge branch 'development'

This commit is contained in:
Brianna 2020-08-05 16:06:23 -05:00
commit 05f6cdeb9e
4 changed files with 19 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>UltimateStacker</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>1.11.19</version>
<version>1.11.20</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>UltimateStacker-${project.version}</finalName>

View File

@ -42,6 +42,8 @@ public class SpawnerListeners implements Listener {
SpawnerStack spawnerStack = spawnerStackManager.getSpawner(event.getSpawner().getLocation());
spawnerStack.initialize();
EntityStack stack = plugin.getEntityStackManager().addStack(event.getEntity().getUniqueId(), spawnerStack.calculateSpawnCount());
plugin.getStackingTask().attemptSplit(stack, (LivingEntity) event.getEntity());

View File

@ -63,9 +63,9 @@ public class LootablesManager {
};
}
EntityType killer = null;
Entity killerEntity = null;
if (entity.getLastDamageCause() instanceof EntityDamageByEntityEvent) {
Entity killerEntity = ((EntityDamageByEntityEvent) entity.getLastDamageCause()).getDamager();
killer = killerEntity.getType();
killerEntity = ((EntityDamageByEntityEvent) entity.getLastDamageCause()).getDamager();
if (killerEntity instanceof Projectile) {
Projectile projectile = (Projectile) killerEntity;
if (projectile.getShooter() instanceof Entity) {
@ -75,7 +75,7 @@ public class LootablesManager {
}
return lootManager.runLoot(modify,
entity.getFireTicks() > 0,
entity instanceof Creeper && ((Creeper) entity).isPowered(),
killerEntity instanceof Creeper && ((Creeper) killerEntity).isPowered(),
entity.getKiller() != null ? entity.getKiller().getItemInHand() : null,
killer,
loot,

View File

@ -14,13 +14,14 @@ import java.util.Random;
public class SpawnerStack {
private int id;
private boolean initialized = false;
private final Location location;
private int amount = 1;
private int amount;
public SpawnerStack(Location location, int amount) {
this.location = location;
setAmount(amount);
this.amount = amount;
}
public int getAmount() {
@ -31,7 +32,10 @@ public class SpawnerStack {
UltimateStacker plugin = UltimateStacker.getInstance();
this.amount = amount;
plugin.getDataManager().updateSpawner(this);
}
public void updateAmount() {
UltimateStacker plugin = UltimateStacker.getInstance();
Bukkit.getScheduler().runTaskLater(plugin, () -> {
if (!(location.getBlock().getState() instanceof CreatureSpawner)) return;
int count = Settings.STACK_ENTITIES.getBoolean()
@ -85,6 +89,13 @@ public class SpawnerStack {
return location.getWorld();
}
public void initialize() {
if (!initialized) {
updateAmount();
this.initialized = true;
}
}
@Override
public String toString() {
return "SpawnerStack:{"