Search in sources :

Example 1 with MetricsWrapper

use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by EssentialsX.

the class EssentialsDiscord method onEnable.

@Override
public void onEnable() {
    ess = (IEssentials) getServer().getPluginManager().getPlugin("Essentials");
    if (ess == null || !ess.isEnabled()) {
        setEnabled(false);
        return;
    }
    if (!getDescription().getVersion().equals(ess.getDescription().getVersion())) {
        getLogger().log(Level.WARNING, tl("versionMismatchAll"));
    }
    // JDK-8274349 - Mitigation for a regression in Java 17 on 1 core systems which was fixed in 17.0.2
    final String[] javaVersion = System.getProperty("java.version").split("\\.");
    if (Runtime.getRuntime().availableProcessors() <= 1 && javaVersion[0].startsWith("17") && (javaVersion.length < 2 || (javaVersion[1].equals("0") && javaVersion[2].startsWith("1")))) {
        logger.log(Level.INFO, "Essentials is mitigating JDK-8274349");
        System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "1");
    }
    isPAPI = getServer().getPluginManager().getPlugin("PlaceholderAPI") != null;
    settings = new DiscordSettings(this);
    ess.addReloadListener(settings);
    if (metrics == null) {
        metrics = new MetricsWrapper(this, 9824, false);
    }
    if (jda == null) {
        jda = new JDADiscordService(this);
        try {
            jda.startup();
            ess.scheduleSyncDelayedTask(() -> ((InteractionControllerImpl) jda.getInteractionController()).processBatchRegistration());
        } catch (Exception e) {
            logger.log(Level.SEVERE, tl("discordErrorLogin", e.getMessage()));
            if (ess.getSettings().isDebug()) {
                e.printStackTrace();
            }
            jda.shutdown();
        }
    }
}
Also used : MetricsWrapper(com.earth2me.essentials.metrics.MetricsWrapper)

Example 2 with MetricsWrapper

use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by EssentialsX.

the class EssentialsProtect method onEnable.

@Override
public void onEnable() {
    final PluginManager pm = this.getServer().getPluginManager();
    final Plugin essPlugin = pm.getPlugin("Essentials");
    if (essPlugin == null || !essPlugin.isEnabled()) {
        enableEmergencyMode(pm);
        return;
    }
    initialize(pm, essPlugin);
    if (metrics == null) {
        metrics = new MetricsWrapper(this, 3816, false);
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) MetricsWrapper(com.earth2me.essentials.metrics.MetricsWrapper) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin)

Example 3 with MetricsWrapper

use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by EssentialsX.

the class EssentialsGeoIP method onEnable.

@Override
public void onEnable() {
    final PluginManager pm = getServer().getPluginManager();
    final IEssentials ess = (IEssentials) pm.getPlugin("Essentials");
    if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
        getLogger().log(Level.WARNING, tl("versionMismatchAll"));
    }
    if (!ess.isEnabled()) {
        this.setEnabled(false);
        return;
    }
    Logger.getLogger(com.fasterxml.jackson.databind.ext.Java7Support.class.getName()).setLevel(Level.SEVERE);
    final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
    pm.registerEvents(playerListener, this);
    getLogger().log(Level.INFO, "This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com/.");
    if (metrics == null) {
        metrics = new MetricsWrapper(this, 3815, false);
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) IEssentials(net.ess3.api.IEssentials) MetricsWrapper(com.earth2me.essentials.metrics.MetricsWrapper)

Example 4 with MetricsWrapper

use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by EssentialsX.

the class EssentialsChat method onEnable.

@Override
public void onEnable() {
    final PluginManager pluginManager = getServer().getPluginManager();
    ess = (IEssentials) pluginManager.getPlugin("Essentials");
    if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
        getLogger().log(Level.WARNING, tl("versionMismatchAll"));
    }
    if (!ess.isEnabled()) {
        this.setEnabled(false);
        return;
    }
    final Map<AsyncPlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<>());
    final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatStore);
    final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore);
    final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatStore);
    pluginManager.registerEvents(playerListenerLowest, this);
    pluginManager.registerEvents(playerListenerNormal, this);
    pluginManager.registerEvents(playerListenerHighest, this);
    if (metrics == null) {
        metrics = new MetricsWrapper(this, 3814, false);
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) AsyncPlayerChatEvent(org.bukkit.event.player.AsyncPlayerChatEvent) MetricsWrapper(com.earth2me.essentials.metrics.MetricsWrapper)

Example 5 with MetricsWrapper

use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by drtshock.

the class EssentialsGeoIP method onEnable.

@Override
public void onEnable() {
    final PluginManager pm = getServer().getPluginManager();
    final IEssentials ess = (IEssentials) pm.getPlugin("Essentials");
    if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
        getLogger().log(Level.WARNING, tl("versionMismatchAll"));
    }
    if (!ess.isEnabled()) {
        this.setEnabled(false);
        return;
    }
    Logger.getLogger(com.fasterxml.jackson.databind.ext.Java7Support.class.getName()).setLevel(Level.SEVERE);
    final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
    pm.registerEvents(playerListener, this);
    getLogger().log(Level.INFO, "This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com/.");
    if (metrics == null) {
        metrics = new MetricsWrapper(this, 3815, false);
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) IEssentials(net.ess3.api.IEssentials) MetricsWrapper(com.earth2me.essentials.metrics.MetricsWrapper)

Aggregations

MetricsWrapper (com.earth2me.essentials.metrics.MetricsWrapper)16 PluginManager (org.bukkit.plugin.PluginManager)14 Plugin (org.bukkit.plugin.Plugin)6 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)6 EventPriority (org.bukkit.event.EventPriority)4 PlayerJoinEvent (org.bukkit.event.player.PlayerJoinEvent)4 I18n.tl (com.earth2me.essentials.I18n.tl)2 EssentialsCommand (com.earth2me.essentials.commands.EssentialsCommand)2 IEssentialsCommand (com.earth2me.essentials.commands.IEssentialsCommand)2 NoChargeException (com.earth2me.essentials.commands.NoChargeException)2 NotEnoughArgumentsException (com.earth2me.essentials.commands.NotEnoughArgumentsException)2 PlayerNotFoundException (com.earth2me.essentials.commands.PlayerNotFoundException)2 QuietAbortException (com.earth2me.essentials.commands.QuietAbortException)2 EconomyLayers (com.earth2me.essentials.economy.EconomyLayers)2 VaultEconomyProvider (com.earth2me.essentials.economy.vault.VaultEconomyProvider)2 AbstractItemDb (com.earth2me.essentials.items.AbstractItemDb)2 CustomItemResolver (com.earth2me.essentials.items.CustomItemResolver)2 FlatItemDb (com.earth2me.essentials.items.FlatItemDb)2 LegacyItemDb (com.earth2me.essentials.items.LegacyItemDb)2 PermissionsDefaults (com.earth2me.essentials.perm.PermissionsDefaults)2