use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by EssentialsX.
the class EssentialsSpawn 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;
}
spawns = new SpawnStorage(ess);
ess.addReloadListener(spawns);
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
final EventPriority respawnPriority = ess.getSettings().getRespawnPriority();
if (respawnPriority != null) {
pluginManager.registerEvent(PlayerRespawnEvent.class, playerListener, respawnPriority, (ll, event) -> ((EssentialsSpawnPlayerListener) ll).onPlayerRespawn((PlayerRespawnEvent) event), this);
}
final EventPriority joinPriority = ess.getSettings().getSpawnJoinPriority();
if (joinPriority != null) {
pluginManager.registerEvent(PlayerJoinEvent.class, playerListener, joinPriority, (ll, event) -> ((EssentialsSpawnPlayerListener) ll).onPlayerJoin((PlayerJoinEvent) event), this);
}
if (metrics == null) {
metrics = new MetricsWrapper(this, 3817, true);
}
}
use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by EssentialsX.
the class EssentialsXMPP method onEnable.
@Override
public void onEnable() {
instance = this;
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 EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
pluginManager.registerEvents(playerListener, this);
users = new UserManager(this.getDataFolder());
xmpp = new XMPPManager(this);
ess.addReloadListener(users);
ess.addReloadListener(xmpp);
if (metrics == null) {
metrics = new MetricsWrapper(this, 3818, true);
metrics.addCustomChart(new SimplePie("config-valid", () -> xmpp.isConfigValid() ? "yes" : "no"));
}
}
use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by EssentialsX.
the class EssentialsAntiBuild method onEnable.
@Override
public void onEnable() {
final PluginManager pm = this.getServer().getPluginManager();
final Plugin essPlugin = pm.getPlugin("Essentials");
if (essPlugin == null || !essPlugin.isEnabled()) {
return;
}
ess = new EssentialsConnect(essPlugin, this);
final EssentialsAntiBuildListener blockListener = new EssentialsAntiBuildListener(this);
pm.registerEvents(blockListener, this);
if (metrics == null) {
metrics = new MetricsWrapper(this, 3813, false);
}
}
use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by drtshock.
the class Essentials method onEnable.
@Override
public void onEnable() {
try {
if (LOGGER != this.getLogger()) {
LOGGER.setParent(this.getLogger());
}
execTimer = new ExecuteTimer();
execTimer.start();
i18n = new I18n(this);
i18n.onEnable();
execTimer.mark("I18n1");
Console.setInstance(this);
switch(VersionUtil.getServerSupportStatus()) {
case NMS_CLEANROOM:
getLogger().severe(tl("serverUnsupportedCleanroom"));
break;
case DANGEROUS_FORK:
getLogger().severe(tl("serverUnsupportedDangerous"));
break;
case UNSTABLE:
getLogger().severe(tl("serverUnsupportedMods"));
break;
case OUTDATED:
getLogger().severe(tl("serverUnsupported"));
break;
case LIMITED:
getLogger().info(tl("serverUnsupportedLimitedApi"));
break;
}
if (VersionUtil.getSupportStatusClass() != null) {
getLogger().info(tl("serverUnsupportedClass", VersionUtil.getSupportStatusClass()));
}
final PluginManager pm = getServer().getPluginManager();
for (final Plugin plugin : pm.getPlugins()) {
if (plugin.getDescription().getName().startsWith("Essentials") && !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()) && !plugin.getDescription().getName().equals("EssentialsAntiCheat")) {
getLogger().warning(tl("versionMismatch", plugin.getDescription().getName()));
}
}
final EssentialsUpgrade upgrade = new EssentialsUpgrade(this);
upgrade.beforeSettings();
execTimer.mark("Upgrade");
confList = new ArrayList<>();
settings = new Settings(this);
confList.add(settings);
execTimer.mark("Settings");
mail = new MailServiceImpl(this);
execTimer.mark("Init(Mail)");
userMap = new UserMap(this);
confList.add(userMap);
execTimer.mark("Init(Usermap)");
balanceTop = new BalanceTopImpl(this);
execTimer.mark("Init(BalanceTop)");
kits = new Kits(this);
confList.add(kits);
upgrade.convertKits();
execTimer.mark("Kits");
upgrade.afterSettings();
execTimer.mark("Upgrade2");
warps = new Warps(this.getDataFolder());
confList.add(warps);
execTimer.mark("Init(Warp)");
worth = new Worth(this.getDataFolder());
confList.add(worth);
execTimer.mark("Init(Worth)");
itemDb = getItemDbFromConfig();
confList.add(itemDb);
execTimer.mark("Init(ItemDB)");
randomTeleport = new RandomTeleport(this);
if (randomTeleport.getPreCache()) {
randomTeleport.cacheRandomLocations(randomTeleport.getCenter(), randomTeleport.getMinRange(), randomTeleport.getMaxRange());
}
confList.add(randomTeleport);
execTimer.mark("Init(RandomTeleport)");
customItemResolver = new CustomItemResolver(this);
try {
itemDb.registerResolver(this, "custom_items", customItemResolver);
confList.add(customItemResolver);
} catch (final Exception e) {
e.printStackTrace();
customItemResolver = null;
}
execTimer.mark("Init(CustomItemResolver)");
jails = new Jails(this);
confList.add(jails);
execTimer.mark("Init(Jails)");
EconomyLayers.onEnable(this);
// Spawner item provider only uses one but it's here for legacy...
spawnerItemProvider = new BlockMetaSpawnerItemProvider();
// Spawner block providers
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_12_0_R01)) {
spawnerBlockProvider = new ReflSpawnerBlockProvider();
} else {
spawnerBlockProvider = new BukkitSpawnerBlockProvider();
}
// Spawn Egg Providers
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_9_R01)) {
spawnEggProvider = new LegacySpawnEggProvider();
} else if (VersionUtil.getServerBukkitVersion().isLowerThanOrEqualTo(VersionUtil.v1_12_2_R01)) {
spawnEggProvider = new ReflSpawnEggProvider();
} else {
spawnEggProvider = new FlatSpawnEggProvider();
}
// Potion Meta Provider
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_9_R01)) {
potionMetaProvider = new LegacyPotionMetaProvider();
} else {
potionMetaProvider = new BasePotionDataProvider();
}
// Container Provider
if (PaperLib.isPaper() && VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_15_2_R01)) {
serverStateProvider = new PaperServerStateProvider();
containerProvider = new PaperContainerProvider();
serializationProvider = new PaperSerializationProvider();
} else {
serverStateProvider = new ReflServerStateProvider();
}
// Event Providers
if (PaperLib.isPaper()) {
try {
Class.forName("com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent");
recipeBookEventProvider = new PaperRecipeBookListener(event -> {
if (this.getUser(((PlayerEvent) event).getPlayer()).isRecipeSee()) {
((Cancellable) event).setCancelled(true);
}
});
} catch (final ClassNotFoundException ignored) {
}
}
// Known Commands Provider
if (PaperLib.isPaper() && VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_11_2_R01)) {
knownCommandsProvider = new PaperKnownCommandsProvider();
} else {
knownCommandsProvider = new ReflKnownCommandsProvider();
}
// Command aliases provider
formattedCommandAliasProvider = new ReflFormattedCommandAliasProvider(PaperLib.isPaper());
// Material Tag Providers
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_13_0_R01)) {
materialTagProvider = PaperLib.isPaper() ? new PaperMaterialTagProvider() : new BukkitMaterialTagProvider();
}
// Sync Commands Provider
syncCommandsProvider = new ReflSyncCommandsProvider();
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_14_4_R01)) {
persistentDataProvider = new ModernPersistentDataProvider(this);
} else {
persistentDataProvider = new ReflPersistentDataProvider(this);
}
onlineModeProvider = new ReflOnlineModeProvider();
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_11_2_R01)) {
unbreakableProvider = new ModernItemUnbreakableProvider();
} else {
unbreakableProvider = new LegacyItemUnbreakableProvider();
}
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_17_1_R01)) {
worldInfoProvider = new ModernDataWorldInfoProvider();
} else if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_5_R01)) {
worldInfoProvider = new ReflDataWorldInfoProvider();
} else {
worldInfoProvider = new FixedHeightWorldInfoProvider();
}
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_14_4_R01)) {
signDataProvider = new ModernSignDataProvider(this);
}
execTimer.mark("Init(Providers)");
reload();
// The item spawn blacklist is loaded with all other settings, before the item
// DB, but it depends on the item DB, so we need to reload it again here:
((Settings) settings)._lateLoadItemSpawnBlacklist();
backup = new Backup(this);
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
timer = new EssentialsTimer(this);
scheduleSyncRepeatingTask(timer, 1000, 50);
Economy.setEss(this);
execTimer.mark("RegHandler");
// Register /hat and /back default permissions
PermissionsDefaults.registerAllBackDefaults();
PermissionsDefaults.registerAllHatDefaults();
updateChecker = new UpdateChecker(this);
runTaskAsynchronously(() -> {
getLogger().log(Level.INFO, tl("versionFetching"));
for (String str : updateChecker.getVersionMessages(false, true)) {
getLogger().log(getSettings().isUpdateCheckEnabled() ? Level.WARNING : Level.INFO, str);
}
});
metrics = new MetricsWrapper(this, 858, true);
execTimer.mark("Init(External)");
final String timeroutput = execTimer.end();
if (getSettings().isDebug()) {
LOGGER.log(Level.INFO, "Essentials load {0}", timeroutput);
}
} catch (final NumberFormatException ex) {
handleCrash(ex);
} catch (final Error ex) {
handleCrash(ex);
throw ex;
}
getBackup().setPendingShutdown(false);
}
use of com.earth2me.essentials.metrics.MetricsWrapper in project Essentials by drtshock.
the class EssentialsXMPP method onEnable.
@Override
public void onEnable() {
instance = this;
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 EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
pluginManager.registerEvents(playerListener, this);
users = new UserManager(this.getDataFolder());
xmpp = new XMPPManager(this);
ess.addReloadListener(users);
ess.addReloadListener(xmpp);
if (metrics == null) {
metrics = new MetricsWrapper(this, 3818, true);
metrics.addCustomChart(new SimplePie("config-valid", () -> xmpp.isConfigValid() ? "yes" : "no"));
}
}
Aggregations