Search in sources :

Example 1 with WorldListener

use of io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener in project Slimefun4 by Slimefun.

the class SlimefunStartupTask method run.

@Override
public void run() {
    runnable.run();
    // Load all items
    PostSetup.loadItems();
    // Load all worlds
    Slimefun.getWorldSettingsService().load(Bukkit.getWorlds());
    for (World world : Bukkit.getWorlds()) {
        try {
            new BlockStorage(world);
        } catch (Exception x) {
            Slimefun.logger().log(Level.SEVERE, x, () -> "An Error occurred while trying to load World \"" + world.getName() + "\" for Slimefun v" + Slimefun.getVersion());
        }
    }
    // Load/Unload Worlds, only after all plugins have started up. Fixes #2862
    new WorldListener(this.plugin);
    // Only load this Listener if the corresponding items are enabled
    if (isEnabled("ELEVATOR_PLATE", "GPS_ACTIVATION_DEVICE_SHARED", "GPS_ACTIVATION_DEVICE_PERSONAL")) {
        new TeleporterListener(plugin);
    }
}
Also used : TeleporterListener(io.github.thebusybiscuit.slimefun4.implementation.listeners.TeleporterListener) BlockStorage(me.mrCookieSlime.Slimefun.api.BlockStorage) WorldListener(io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener) World(org.bukkit.World)

Example 2 with WorldListener

use of io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener in project GlobalWarming by poma123.

the class GlobalWarmingPlugin method onEnable.

@Override
public void onEnable() {
    instance = this;
    if (cfg.getBoolean("options.auto-update") && getDescription().getVersion().startsWith("DEV - ")) {
        new GitHubBuildsUpdater(this, getFile(), "poma123/GlobalWarming/master").start();
    }
    new Metrics(this, 9132);
    final File messagesFile = new File(getDataFolder(), "messages.yml");
    if (!messagesFile.exists()) {
        try {
            Files.copy(this.getClass().getResourceAsStream("/messages.yml"), messagesFile.toPath());
        } catch (IOException e) {
            getLogger().log(Level.SEVERE, "Failed to create default messages.yml file", e);
        }
    }
    messages = new Config(this, "messages.yml");
    File biomeMapDirectory = new File(getDataFolder(), "biome-maps");
    if (!biomeMapDirectory.exists()) {
        biomeMapDirectory.mkdirs();
    }
    // Create biome map files
    final File pre118BiomeMap = new File(biomeMapDirectory, "pre-1.18.json");
    if (!pre118BiomeMap.exists()) {
        try {
            Files.copy(this.getClass().getResourceAsStream("/biome-maps/pre-1.18.json"), pre118BiomeMap.toPath());
        } catch (IOException e) {
            getLogger().log(Level.SEVERE, "Failed to create default biome-maps/pre-1.18.json file", e);
        }
    }
    final File post118BiomeMap = new File(biomeMapDirectory, "post-1.18.json");
    if (!post118BiomeMap.exists()) {
        try {
            Files.copy(this.getClass().getResourceAsStream("/biome-maps/post-1.18.json"), post118BiomeMap.toPath());
        } catch (IOException e) {
            getLogger().log(Level.SEVERE, "Failed to create default biome-maps/post-1.18.json file", e);
        }
    }
    registerItems();
    registerResearches();
    registry.load(cfg, messages);
    scheduleTasks();
    command.register();
    Bukkit.getPluginManager().registerEvents(new PollutionListener(), this);
    Bukkit.getPluginManager().registerEvents(new WorldListener(), this);
}
Also used : Metrics(org.bstats.bukkit.Metrics) PollutionListener(me.poma123.globalwarming.listeners.PollutionListener) WorldListener(me.poma123.globalwarming.listeners.WorldListener) GitHubBuildsUpdater(io.github.thebusybiscuit.slimefun4.libraries.dough.updater.GitHubBuildsUpdater) Config(io.github.thebusybiscuit.slimefun4.libraries.dough.config.Config) IOException(java.io.IOException) File(java.io.File)

Aggregations

TeleporterListener (io.github.thebusybiscuit.slimefun4.implementation.listeners.TeleporterListener)1 WorldListener (io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener)1 Config (io.github.thebusybiscuit.slimefun4.libraries.dough.config.Config)1 GitHubBuildsUpdater (io.github.thebusybiscuit.slimefun4.libraries.dough.updater.GitHubBuildsUpdater)1 File (java.io.File)1 IOException (java.io.IOException)1 BlockStorage (me.mrCookieSlime.Slimefun.api.BlockStorage)1 PollutionListener (me.poma123.globalwarming.listeners.PollutionListener)1 WorldListener (me.poma123.globalwarming.listeners.WorldListener)1 Metrics (org.bstats.bukkit.Metrics)1 World (org.bukkit.World)1