mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-27 12:35:17 +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.
|
// Make sure the entity is not in love.
|
||||||
|| entity.hasMetadata("inLove")
|
|| entity.hasMetadata("inLove")
|
||||||
// Or in breeding cooldown.
|
// 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.
|
// Allow spawn if stackreasons are set and match, or if from a spawner
|
||||||
|| Setting.ONLY_STACK_FROM_SPAWNERS.getBoolean()
|
final String spawnReason = entity.hasMetadata("US_REASON") ? entity.getMetadata("US_REASON").get(0).asString() : null;
|
||||||
&& !(entity.hasMetadata("US_REASON")
|
List<String> stackReasons;
|
||||||
&& entity.getMetadata("US_REASON").get(0).asString().equals("SPAWNER")))
|
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;
|
return false;
|
||||||
|
|
||||||
// Cast our entity to living entity.
|
// 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",
|
"if the entity originated from a spawner or not is wiped on",
|
||||||
"server restart."),
|
"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,
|
CARRY_OVER_METADATA_ON_DEATH("Entities.Carry Over Metadata On Death", true,
|
||||||
"With this enabled any metadata assigned from supported plugins such",
|
"With this enabled any metadata assigned from supported plugins such",
|
||||||
"as EpicSpawners and mcMMO will be preserved when the entity is killed."),
|
"as EpicSpawners and mcMMO will be preserved when the entity is killed."),
|
||||||
|
Loading…
Reference in New Issue
Block a user