Kill whole stack.

This commit is contained in:
Brianna 2019-08-08 20:52:41 -04:00
parent 34b1b503fa
commit e3f6131bfd
6 changed files with 13 additions and 5 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "UltimateStacker"
path: "/builds/$CI_PROJECT_PATH"
version: "1.8.15"
version: "1.8.16"
build:
stage: build

View File

@ -104,6 +104,7 @@ public class UltimateStacker extends JavaPlugin {
mobFile.getConfig().addDefault("Mobs." + value.name() + ".Enabled", true);
mobFile.getConfig().addDefault("Mobs." + value.name() + ".Display Name", Methods.formatText(value.name().toLowerCase().replace("_", " "), true));
mobFile.getConfig().addDefault("Mobs." + value.name() + ".Max Stack Size", -1);
mobFile.getConfig().addDefault("Mobs." + value.name() + ".Kill Whole Stack", false);
}
}
mobFile.getConfig().options().copyDefaults(true);

View File

@ -94,8 +94,8 @@ public class DataManager {
try (Statement statement = connection.createStatement()) {
ResultSet result = statement.executeQuery(selectSpawners);
while (result.next()) {
int spawnerId = result.getInt("id");
System.out.println(result.getRow());
int amount = result.getInt("amount");
@ -109,6 +109,9 @@ public class DataManager {
spawnerStack.setId(spawnerId);
spawners.put(location, spawnerStack);
}
System.out.println("loaded " + spawners.size());
} catch (Exception e) {
e.printStackTrace();
}
this.sync(() -> callback.accept(spawners));

View File

@ -168,7 +168,10 @@ public class EntityStack {
killed.setCustomNameVisible(true);
killed.setCustomName(Methods.formatText("&7"));
if (Setting.KILL_WHOLE_STACK_ON_DEATH.getBoolean() && getAmount() != 1) {
boolean killWholeStack = Setting.KILL_WHOLE_STACK_ON_DEATH.getBoolean()
|| plugin.getMobFile().getConfig().getBoolean("Mobs." + killed.getType().name() + ".Kill Whole Stack");
if (killWholeStack && getAmount() != 1) {
handleWholeStackDeath(killed, drops, custom, droppedExp);
} else if (getAmount() != 1) {
List<String> reasons = Setting.INSTANT_KILL.getStringList();

View File

@ -104,7 +104,7 @@ public class StackingTask extends BukkitRunnable {
// If only stack on surface is enabled make sure the entity is on a surface then entity is stackable.
return !Setting.ONLY_STACK_ON_SURFACE.getBoolean()
|| Methods.canFly(livingEntity)
|| entity.getType() == EntityType.SHULKER
|| entity.getType().name().equals("SHULKER")
|| (livingEntity.isOnGround() || location.getBlock().isLiquid());
}

View File

@ -52,7 +52,8 @@ public enum Setting {
KILL_WHOLE_STACK_ON_DEATH("Entities.Kill Whole Stack On Death", false,
"Should killing a stack of entities kill the whole stack or",
"just one out of the stack?"),
"just one out of the stack? If you want only certain entities to be",
"effected by this you can configure it in the entities.yml"),
CLEAR_LAG("Entities.Clear Lag", false,
"When enabled, the plugin will hook into ClearLag and extend the",