Files
src
build.gradle
pom.xml
Code
10 960
src/main/java/com/advancedmining/AdvancedMining.java
package com.advancedmining;
import com.advancedmining.listener.MiningListener;
import com.advancedmining.util.OreSelector;
import org.bukkit.plugin.java.JavaPlugin;
public final class AdvancedMining extends JavaPlugin {
private OreSelector oreSelector;
private String enabledWorld;
private int minYLevel;
private int veinDepth;
private int veinWidth;
private int sameOreChance;
private int blockChangeInterval;
@Override
public void onEnable() {
saveDefaultConfig();
loadConfiguration();
getServer().getPluginManager().registerEvents(new MiningListener(this), this);
getLogger().info("AdvancedMining has been enabled!");
}
@Override
public void onDisable() {
getLogger().info("AdvancedMining has been disabled!");
}
private void loadConfiguration() {
this.enabledWorld = getConfig().getString("enabled-world", "world");
this.minYLevel = getConfig().getInt("min-y-level", 50);
this.blockChangeInterval = getConfig().getInt("block-change-interval", 3);
this.veinDepth = getConfig().getInt("vein-generation.depth", 2);
this.veinWidth = getConfig().getInt("vein-generation.width", 2);
this.sameOreChance = getConfig().getInt("vein-generation.same-ore-chance", 60);
this.oreSelector = new OreSelector(
getConfig().getInt("block-chances.stone", 35),
getConfig().getInt("block-chances.deepslate", 20),
getConfig().getInt("block-chances.coal_ore", 18),
getConfig().getInt("block-chances.iron_ore", 12),
getConfig().getInt("block-chances.copper_ore", 7),
getConfig().getInt("block-chances.gold_ore", 3),
getConfig().getInt("block-chances.redstone_ore", 2),
getConfig().getInt("block-chances.lapis_ore", 1),
getConfig().getInt("block-chances.diamond_ore", 1),
getConfig().getInt("block-chances.emerald_ore", 1)
);
getLogger().info("Configuration loaded:");
getLogger().info("- Enabled world: " + this.enabledWorld);
getLogger().info("- Min Y level: " + this.minYLevel);
getLogger().info("- Block change interval: " + this.blockChangeInterval + " ticks");
getLogger().info("- Vein depth: " + this.veinDepth);
getLogger().info("- Vein width: " + this.veinWidth);
getLogger().info("- Same ore chance: " + this.sameOreChance + "%");
getLogger().info("- Total block weight: " + this.oreSelector.getTotalWeight());
}
public OreSelector getOreSelector() {
return this.oreSelector;
}
public String getEnabledWorld() {
return this.enabledWorld;
}
public int getMinYLevel() {
return this.minYLevel;
}
public int getVeinDepth() {
return this.veinDepth;
}
public int getVeinWidth() {
return this.veinWidth;
}
public int getSameOreChance() {
return this.sameOreChance;
}
public int getBlockChangeInterval() {
return this.blockChangeInterval;
}
}