use of dev.frankheijden.insights.api.concurrent.storage.AddonStorage in project Insights by InsightsPlugin.
the class Insights method onEnable.
@Override
public void onEnable() {
super.onEnable();
this.audiences = BukkitAudiences.create(this);
this.listenerManager = new ListenerManager(this);
reloadConfigs();
addonManager = new AddonManager(this, getDataFolder().toPath().resolve("addons"));
try {
addonManager.createAddonsFolder();
} catch (IOException ex) {
ex.printStackTrace();
}
getServer().getScheduler().runTaskLater(this, () -> {
try {
addonManager.loadAddons();
} catch (IOException ex) {
ex.printStackTrace();
}
}, 1);
playerList = new PlayerList(Bukkit.getOnlinePlayers());
worldStorage = new WorldStorage();
addonStorage = new AddonStorage();
worldChunkScanTracker = new WorldChunkScanTracker();
addonScanTracker = new AddonScanTracker();
executor = ContainerExecutorService.newExecutor(settings.SCANS_CONCURRENT_THREADS);
chunkContainerExecutor = new ChunkContainerExecutor(executor, worldStorage, worldChunkScanTracker);
metricsManager = new MetricsManager(this);
scanHistory = new ScanHistory();
redstoneUpdateCount = new RedstoneUpdateCount(this);
redstoneUpdateCount.start();
chunkTeleport = new ChunkTeleport(this);
loadCommands();
if (!PaperLib.isPaper()) {
entityTrackerTask = new EntityTrackerTask(this);
var interval = settings.SPIGOT_ENTITY_TRACKER_INTERVAL_TICKS;
Bukkit.getScheduler().runTaskTimer(this, entityTrackerTask, 0, interval);
}
reload();
}
use of dev.frankheijden.insights.api.concurrent.storage.AddonStorage in project Insights by InsightsPlugin.
the class InsightsListener method handleAddonAddition.
private Optional<Storage> handleAddonAddition(Player player, Region region, Consumer<Storage> storageConsumer) {
String key = region.getKey();
AddonStorage addonStorage = plugin.getAddonStorage();
Optional<Storage> storageOptional = addonStorage.get(key);
if (storageOptional.isEmpty()) {
// Notify the user scan started
if (plugin.getSettings().canReceiveAreaScanNotifications(player)) {
plugin.getMessages().getMessage(Messages.Key.AREA_SCAN_STARTED).addTemplates(Messages.tagOf("area", plugin.getAddonManager().getAddon(region.getAddon()).getAreaName())).sendTo(player);
}
scanRegion(player, region, storageConsumer);
return Optional.empty();
}
return storageOptional;
}
Aggregations