@@ -0,0 +1,1718 @@
+package com.elmakers.mine.bukkit.world.block.builtin;%0A%0Aimport java.util.Deque;%0Aimport java.util.Random;%0Aimport javax.annotation.Nonnull;%0A%0Aimport org.bukkit.Location;%0Aimport org.bukkit.block.Block;%0Aimport org.bukkit.configuration.ConfigurationSection;%0Aimport org.bukkit.entity.Player;%0A%0Aimport com.elmakers.mine.bukkit.api.automata.Automaton;%0Aimport com.elmakers.mine.bukkit.utility.RandomUtils;%0Aimport com.elmakers.mine.bukkit.utility.WeightedPair;%0Aimport com.elmakers.mine.bukkit.world.BlockResult;%0Aimport com.elmakers.mine.bukkit.world.block.BlockRule;%0A%0Apublic class AutomatonRule extends BlockRule %7B%0A    private Deque%3CWeightedPair%3CString%3E%3E automatonProbability;%0A    private ConfigurationSection parameters;%0A%0A    @Override%0A    public boolean onLoad(ConfigurationSection parameters) %7B%0A        RandomUtils.populateStringProbabilityMap(automatonProbability, parameters, %22automaton%22);%0A        this.parameters = parameters.getConfigurationSection(%22automaton_parameters%22);%0A        return !automatonProbability.isEmpty();%0A    %7D%0A%0A    @Override%0A    @Nonnull%0A    public BlockResult onHandle(Block block, Random random, Player cause) %7B%0A        String automatonKey = RandomUtils.weightedRandom(automatonProbability);%0A%0A        if (automatonKey.equalsIgnoreCase(%22none%22)) %7B%0A            return BlockResult.SKIP;%0A        %7D%0A        try %7B%0A            BlockResult result = BlockResult.valueOf(automatonKey.toUpperCase());%0A            return result;%0A        %7D catch (Exception ignore) %7B%0A        %7D%0A%0A        Location location = block.getLocation();%0A        Automaton automaton = controller.addAutomaton(location, automatonKey, null, null, parameters);%0A        return automaton == null ? BlockResult.SKIP : BlockResult.REMOVE_DROPS;%0A    %7D%0A%7D%0A

Add Automaton block replace rule