Add world blacklist, refactor config.yml
This commit is contained in:
parent
aa151f6c9a
commit
022f9754e7
3 changed files with 24 additions and 13 deletions
|
@ -10,6 +10,7 @@ import org.bukkit.util.Vector;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -26,6 +27,7 @@ public class Configuration {
|
|||
|
||||
Vector attackReach;
|
||||
|
||||
List<String> worldBlacklist;
|
||||
Set<PotionEffect> effects = new HashSet<>();
|
||||
Set<Drop> drops = new HashSet<>();
|
||||
|
||||
|
@ -48,6 +50,8 @@ public class Configuration {
|
|||
double _expandUp = config.getDouble("expandUp");
|
||||
attackReach = new Vector(_attackReach, _expandUp, _attackReach);
|
||||
|
||||
worldBlacklist = config.getStringList("blacklist");
|
||||
|
||||
for (String line : config.getStringList("effects")) {
|
||||
String[] parts = line.split(":");
|
||||
|
||||
|
|
|
@ -132,6 +132,9 @@ public class GiantProcessor implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void entitySpawn(EntitySpawnEvent e) {
|
||||
if (configuration.worldBlacklist.contains(e.getLocation().getWorld().getName()))
|
||||
return;
|
||||
|
||||
if (e.getEntityType() == EntityType.ZOMBIE) {
|
||||
if (configuration.chance > random.nextFloat()) {
|
||||
e.setCancelled(true);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Do as it says
|
||||
remove_this_line_after_editing: true
|
||||
# Notes:
|
||||
# To have no values in a list, remove every value below it and change to [] like `effects: []`
|
||||
|
||||
# If disabled, the giant won't move (but it will still attack)
|
||||
ai: true
|
||||
|
@ -18,30 +18,34 @@ attackDelay: 20
|
|||
# There's no wall check yet, so it will hit through walls
|
||||
attackReach: 2
|
||||
|
||||
# The value above does not modify vertical reach, this value extends it upwards
|
||||
expandUp: 0
|
||||
|
||||
###
|
||||
|
||||
# Chance of a zombie becoming a giant. This is per each zombie spawn, natural or not.
|
||||
chance: 0.02
|
||||
# 0 is 0% (no zombie becomes a giant), 1 is 100% (every zombie becomes a giant), so the default 0.005 is 0.5%
|
||||
chance: 0.005
|
||||
|
||||
# Which worlds not to spawn Giants in
|
||||
blacklist:
|
||||
- "world_nether"
|
||||
- "world_the_end"
|
||||
|
||||
# Potion effects applied to a giant
|
||||
# type:amplifier
|
||||
# types: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
|
||||
# amplifier: just like you know it, max 255
|
||||
# Set to [] to disable
|
||||
effects:
|
||||
- "JUMP:1"
|
||||
- "REGENERATION:2"
|
||||
- "HEALTH_BOOST:10"
|
||||
- "JUMP:1"
|
||||
- "REGENERATION:2"
|
||||
- "HEALTH_BOOST:10"
|
||||
|
||||
# Custom drops
|
||||
# material:min quantity:max quantity:chance
|
||||
# material: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
|
||||
# min and max are inclusive
|
||||
# chance is 0 - 100
|
||||
# unlike above, chance is an integer from 0 to 100
|
||||
# metadata can't be set yet
|
||||
# Set to [] to disable
|
||||
drops:
|
||||
- "APPLE:1:3:25" # 25% of the time, drop 1 to 3 apples
|
||||
|
||||
### Advanced
|
||||
expandUp: 0
|
||||
- "APPLE:1:3:25" # 25% of the time, drop 1 to 3 apples
|
||||
|
|
Loading…
Reference in a new issue