mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-07 19:19:32 +01:00
add spawn reason filter for stacking
This commit is contained in:
parent
7854f01496
commit
12798edaca
@ -90,12 +90,18 @@ public class StackingTask extends BukkitRunnable {
|
||||
// Make sure the entity is not in love.
|
||||
|| entity.hasMetadata("inLove")
|
||||
// Or in breeding cooldown.
|
||||
|| entity.hasMetadata("breedCooldown")
|
||||
|| entity.hasMetadata("breedCooldown"))
|
||||
return false;
|
||||
|
||||
// If only stack from spawners is enabled make sure the entity spawned from a spawner.
|
||||
|| Setting.ONLY_STACK_FROM_SPAWNERS.getBoolean()
|
||||
&& !(entity.hasMetadata("US_REASON")
|
||||
&& entity.getMetadata("US_REASON").get(0).asString().equals("SPAWNER")))
|
||||
// Allow spawn if stackreasons are set and match, or if from a spawner
|
||||
final String spawnReason = entity.hasMetadata("US_REASON") ? entity.getMetadata("US_REASON").get(0).asString() : null;
|
||||
List<String> stackReasons;
|
||||
if (Setting.ONLY_STACK_FROM_SPAWNERS.getBoolean()) {
|
||||
// If only stack from spawners is enabled, make sure the entity spawned from a spawner.
|
||||
if (!"SPAWNER".equals(spawnReason))
|
||||
return false;
|
||||
} else if (!(stackReasons = Setting.STACK_REASONS.getStringList()).isEmpty() && !stackReasons.contains(spawnReason))
|
||||
// Only stack if on the list of events to stack
|
||||
return false;
|
||||
|
||||
// Cast our entity to living entity.
|
||||
|
@ -113,6 +113,17 @@ public enum Setting {
|
||||
"if the entity originated from a spawner or not is wiped on",
|
||||
"server restart."),
|
||||
|
||||
STACK_REASONS("Entities.Stack Reasons", Arrays.asList(),
|
||||
"This will limit mob stacking to mobs who spawned via the listed reasons.",
|
||||
"This list is ignored if Only Stack From Spawners = true.",
|
||||
"The following reasons can be added to the list:",
|
||||
"NATURAL, JOCKEY, CHUNK_GEN, SPAWNER, EGG, SPAWNER_EGG, LIGHTNING, BUILD_SNOWMAN, ",
|
||||
"BUILD_IRONGOLEM, BUILD_WITHER, VILLAGE_DEFENSE, VILLAGE_INVASION, BREEDING,",
|
||||
"SLIME_SPLIT, REINFORCEMENTS, NETHER_PORTAL, DISPENSE_EGG, INFECTION,",
|
||||
"CURED, OCELOT_BABY, SILVERFISH_BLOCK, MOUNT, TRAP, ENDER_PEARL, ",
|
||||
"SHOULDER_ENTITY, DROWNED, SHEARED, EXPLOSION"
|
||||
),
|
||||
|
||||
CARRY_OVER_METADATA_ON_DEATH("Entities.Carry Over Metadata On Death", true,
|
||||
"With this enabled any metadata assigned from supported plugins such",
|
||||
"as EpicSpawners and mcMMO will be preserved when the entity is killed."),
|
||||
|
Loading…
Reference in New Issue
Block a user