All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.energy.EnergyRegistry Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.energy;

import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Map;

public final class EnergyRegistry {
    public static final Map registeredEnergyTypes = new HashMap<>();

    /**
     * Register a new energy type.
     * @param energyType The energy type to register.
     * @return If the energy type was registered successfully.
     */
    public static boolean registerEnergyType(@NotNull EnergyType energyType) {
        if (!registeredEnergyTypes.containsKey(energyType.getName())) {
            registeredEnergyTypes.put(energyType.getName(), energyType);
            return true;
        }
        return false;
    }

    public static EnergyType getEnergyType(String name) {
        return registeredEnergyTypes.get(name);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy