This is my code
public final class CustomEntityDrops extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
@EventHandler
public void onEntityDeath(EntityDeathEvent e) {
// this.Object getConfig = new CustomEntityDrops().onEntityDeath(getConfig());
double chance = CustomEntityDrops.getConfig().getDouble("dropChance", 50) / 100;
if (e.getEntity() instanceof Player && nextDouble() <= chance) {
//clear drops
e.getDrops().clear();
// Code for player deaths
//item
ItemStack blueShard = new ItemStack(Material.LIGHT_BLUE_DYE); //blueShard is the variable and after that we define the item
ItemStack ametistFragment = new ItemStack(Material.PURPLE_DYE); //ametistFragment is the variable and after that we define the item
//meta
ItemMeta blueShardItemMeta = blueShard.getItemMeta(); //We set a meta for it
ItemMeta ametistFragmentItemMeta = ametistFragment.getItemMeta(); //We set a meta for it
//name
blueShardItemMeta.setDisplayName(ChatColor.DARK_AQUA + "It's baked"); // The name of the item
ametistFragmentItemMeta.setDisplayName(ChatColor.DARK_AQUA + "It's baked"); // The name of the item
//set the meta
blueShard.setItemMeta(blueShardItemMeta);
ametistFragment.setItemMeta(ametistFragmentItemMeta);
//item drop
e.getEntity().getWorld().dropItem(e.getEntity().getLocation(), blueShard); // Drop the item on the ground
e.getEntity().getWorld().dropItem(e.getEntity().getLocation(), ametistFragment); // Drop the item on the ground
}
}
}
That's the main class and the error says non-static getconfig() cannot be referenced from a static context. I would highly appreciate any kind of help (mostly held with code).