Search in sources :

Example 1 with MaterialAliases

use of me.botsko.prism.utils.MaterialAliases in project Prism-Bukkit by prism.

the class Prism method loadConfig.

/**
 * Load configuration and language files.
 */
public void loadConfig() {
    final PrismConfig mc = new PrismConfig(this);
    config = mc.getConfig();
    // Cache config arrays we check constantly
    illegalBlocks = getConfig().getStringList("prism.appliers.never-place-block").stream().map(Material::matchMaterial).filter(Objects::nonNull).collect(Collectors.toList());
    illegalEntities = getConfig().getStringList("prism.appliers.never-spawn-entity").stream().map(s -> {
        try {
            return EntityType.valueOf(s.toUpperCase());
        } catch (Exception e) {
            debug(e.getMessage());
        }
        return null;
    }).filter(Objects::nonNull).collect(Collectors.toList());
    final ConfigurationSection alertBlocks = getConfig().getConfigurationSection("prism.alerts.ores.blocks");
    alertedOres.clear();
    if (alertBlocks != null) {
        for (final String key : alertBlocks.getKeys(false)) {
            Material m = Material.matchMaterial(key.toUpperCase());
            String colorString = alertBlocks.getString(key);
            if (m == null || colorString == null) {
                Prism.log("Could not match alert block:" + key + " color:" + colorString);
                continue;
            }
            TextColor color = TypeUtils.from(colorString);
            alertedOres.put(m, color);
        }
    }
    items = new MaterialAliases();
}
Also used : InternalAffairs(me.botsko.prism.actionlibs.InternalAffairs) KeywordParameter(me.botsko.prism.parameters.KeywordParameter) SimpleFormatter(java.util.logging.SimpleFormatter) EntityParameter(me.botsko.prism.parameters.EntityParameter) PrismMiscEvents(me.botsko.prism.listeners.self.PrismMiscEvents) ActionsQuery(me.botsko.prism.actionlibs.ActionsQuery) PrismDatabaseFactory(me.botsko.prism.database.PrismDatabaseFactory) TimeTaken(me.botsko.prism.measurement.TimeTaken) Future(java.util.concurrent.Future) FileHandler(java.util.logging.FileHandler) PreviewSession(me.botsko.prism.appliers.PreviewSession) PlayerParameter(me.botsko.prism.parameters.PlayerParameter) Location(org.bukkit.Location) World(org.bukkit.World) Map(java.util.Map) EventHelper(me.botsko.prism.events.EventHelper) Material(org.bukkit.Material) CommandSender(org.bukkit.command.CommandSender) TextColor(net.kyori.adventure.text.format.TextColor) Ignore(me.botsko.prism.actionlibs.Ignore) PrismBlockEvents(me.botsko.prism.listeners.PrismBlockEvents) PrismPlayerEvents(me.botsko.prism.listeners.PrismPlayerEvents) NamedTextColor(net.kyori.adventure.text.format.NamedTextColor) PaperListeners(me.botsko.prism.listeners.PaperListeners) JavaPluginLoader(org.bukkit.plugin.java.JavaPluginLoader) QueueStats(me.botsko.prism.measurement.QueueStats) QueueDrain(me.botsko.prism.actionlibs.QueueDrain) PrismDataSource(me.botsko.prism.database.PrismDataSource) ArrayList(java.util.ArrayList) SQLException(java.sql.SQLException) Result(me.botsko.prism.api.Result) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) PurgeManager(me.botsko.prism.purge.PurgeManager) PrismInventoryMoveItemEvent(me.botsko.prism.listeners.PrismInventoryMoveItemEvent) PrismCommands(me.botsko.prism.commands.PrismCommands) FlagParameter(me.botsko.prism.parameters.FlagParameter) Identity(net.kyori.adventure.identity.Identity) IOException(java.io.IOException) QueryResult(me.botsko.prism.actionlibs.QueryResult) File(java.io.File) IdParameter(me.botsko.prism.parameters.IdParameter) RecordingTask(me.botsko.prism.actionlibs.RecordingTask) PrismVehicleEvents(me.botsko.prism.listeners.PrismVehicleEvents) PrismWorldEvents(me.botsko.prism.listeners.PrismWorldEvents) PluginDescriptionFile(org.bukkit.plugin.PluginDescriptionFile) BlockParameter(me.botsko.prism.parameters.BlockParameter) Connection(java.sql.Connection) Date(java.util.Date) ConfigurationSection(org.bukkit.configuration.ConfigurationSection) Player(org.bukkit.entity.Player) PaperLib(io.papermc.lib.PaperLib) PrismEntityEvents(me.botsko.prism.listeners.PrismEntityEvents) Block(org.bukkit.block.Block) QueryParameters(me.botsko.prism.actionlibs.QueryParameters) Bukkit(org.bukkit.Bukkit) OreMonitor(me.botsko.prism.monitors.OreMonitor) TextComponent(net.kyori.adventure.text.TextComponent) PrismPlayer(me.botsko.prism.players.PrismPlayer) ActionMeter(me.botsko.prism.actions.ActionMeter) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) TypeUtils(me.botsko.prism.utils.TypeUtils) Metrics(org.bstats.bukkit.Metrics) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) UUID(java.util.UUID) EntityType(org.bukkit.entity.EntityType) LogRecord(java.util.logging.LogRecord) Logger(java.util.logging.Logger) PrismApi(me.botsko.prism.api.PrismApi) MaterialAliases(me.botsko.prism.utils.MaterialAliases) PluginCommand(org.bukkit.command.PluginCommand) Collectors(java.util.stream.Collectors) WhatCommand(me.botsko.prism.commands.WhatCommand) ActionParameter(me.botsko.prism.parameters.ActionParameter) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) Objects(java.util.Objects) List(java.util.List) RadiusParameter(me.botsko.prism.parameters.RadiusParameter) BukkitTask(org.bukkit.scheduler.BukkitTask) Entry(java.util.Map.Entry) Handler(java.util.logging.Handler) BeforeParameter(me.botsko.prism.parameters.BeforeParameter) WorldParameter(me.botsko.prism.parameters.WorldParameter) PrismParameterHandler(me.botsko.prism.parameters.PrismParameterHandler) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) HandlerRegistry(me.botsko.prism.actionlibs.HandlerRegistry) Level(java.util.logging.Level) PrismParameters(me.botsko.prism.api.PrismParameters) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) PrismInventoryEvents(me.botsko.prism.listeners.PrismInventoryEvents) Component(net.kyori.adventure.text.Component) ActionRegistry(me.botsko.prism.actionlibs.ActionRegistry) SqlPlayerIdentificationHelper(me.botsko.prism.database.sql.SqlPlayerIdentificationHelper) BukkitAudiences(net.kyori.adventure.platform.bukkit.BukkitAudiences) UseMonitor(me.botsko.prism.monitors.UseMonitor) SinceParameter(me.botsko.prism.parameters.SinceParameter) Wand(me.botsko.prism.wands.Wand) TimeUnit(java.util.concurrent.TimeUnit) PrismCustomEvents(me.botsko.prism.listeners.PrismCustomEvents) MaterialAliases(me.botsko.prism.utils.MaterialAliases) Objects(java.util.Objects) Material(org.bukkit.Material) TextColor(net.kyori.adventure.text.format.TextColor) NamedTextColor(net.kyori.adventure.text.format.NamedTextColor) SQLException(java.sql.SQLException) IOException(java.io.IOException) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Aggregations

PaperLib (io.papermc.lib.PaperLib)1 File (java.io.File)1 IOException (java.io.IOException)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Objects (java.util.Objects)1 UUID (java.util.UUID)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Future (java.util.concurrent.Future)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 TimeUnit (java.util.concurrent.TimeUnit)1 FileHandler (java.util.logging.FileHandler)1