Add world blacklist, refactor config.yml

This commit is contained in:
Minecon724 2024-09-20 17:47:19 +02:00
parent aa151f6c9a
commit 022f9754e7
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
3 changed files with 24 additions and 13 deletions

View file

@ -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(":");

View file

@ -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);

View file

@ -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,16 +18,24 @@ 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"
@ -37,11 +45,7 @@ effects:
# 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