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();
}
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations