Search in sources :

Example 1 with TablistConfiguration

use of net.dzikoysk.funnyguilds.config.tablist.TablistConfiguration in project FunnyGuilds by FunnyGuilds.

the class TablistBroadcastHandler method run.

@Override
public void run() {
    UserManager userManager = plugin.getUserManager();
    TablistConfiguration tablistConfig = plugin.getTablistConfiguration();
    if (!tablistConfig.playerListEnable) {
        return;
    }
    PandaStream.of(Bukkit.getOnlinePlayers()).flatMap(userManager::findByPlayer).flatMap(user -> user.getCache().getPlayerList()).forEach(IndividualPlayerList::send);
}
Also used : FunnyGuilds(net.dzikoysk.funnyguilds.FunnyGuilds) UserManager(net.dzikoysk.funnyguilds.user.UserManager) TablistConfiguration(net.dzikoysk.funnyguilds.config.tablist.TablistConfiguration) PandaStream(panda.std.stream.PandaStream) Bukkit(org.bukkit.Bukkit) TablistConfiguration(net.dzikoysk.funnyguilds.config.tablist.TablistConfiguration) UserManager(net.dzikoysk.funnyguilds.user.UserManager)

Example 2 with TablistConfiguration

use of net.dzikoysk.funnyguilds.config.tablist.TablistConfiguration in project FunnyGuilds by FunnyGuilds.

the class ReloadRequest method execute.

@Override
public void execute() throws Exception {
    this.plugin.reloadConfiguration();
    this.plugin.getDataPersistenceHandler().reloadHandler();
    this.plugin.getDynamicListenerManager().reloadAll();
    Bukkit.getScheduler().runTaskAsynchronously(plugin, new HologramUpdateLocationHandler(plugin));
    if (this.plugin.getTablistConfiguration().playerListEnable) {
        PluginConfiguration config = this.plugin.getPluginConfiguration();
        TablistConfiguration tablistConfig = this.plugin.getTablistConfiguration();
        UserManager userManager = this.plugin.getUserManager();
        DefaultTablistVariables.clearFunnyVariables();
        PandaStream.of(Bukkit.getOnlinePlayers()).flatMap(userManager::findByPlayer).forEach(user -> {
            IndividualPlayerList playerList = new IndividualPlayerList(user, plugin.getNmsAccessor().getPlayerListAccessor(), tablistConfig.playerList, tablistConfig.playerListHeader, tablistConfig.playerListFooter, tablistConfig.pages, tablistConfig.playerListPing, tablistConfig.playerListFillCells, config.top.enableLegacyPlaceholders);
            user.getCache().setPlayerList(playerList);
        });
    }
    long endTime = System.currentTimeMillis();
    String diff = String.format("%.2f", ((endTime - startTime) / 1000.0));
    sender.sendMessage(ChatColor.AQUA + "FunnyGuilds " + ChatColor.GRAY + "przeladowano! (" + ChatColor.AQUA + diff + "s" + ChatColor.GRAY + ")");
}
Also used : TablistConfiguration(net.dzikoysk.funnyguilds.config.tablist.TablistConfiguration) IndividualPlayerList(net.dzikoysk.funnyguilds.feature.tablist.IndividualPlayerList) UserManager(net.dzikoysk.funnyguilds.user.UserManager) PluginConfiguration(net.dzikoysk.funnyguilds.config.PluginConfiguration) HologramUpdateLocationHandler(net.dzikoysk.funnyguilds.feature.hologram.HologramUpdateLocationHandler)

Aggregations

TablistConfiguration (net.dzikoysk.funnyguilds.config.tablist.TablistConfiguration)2 UserManager (net.dzikoysk.funnyguilds.user.UserManager)2 FunnyGuilds (net.dzikoysk.funnyguilds.FunnyGuilds)1 PluginConfiguration (net.dzikoysk.funnyguilds.config.PluginConfiguration)1 HologramUpdateLocationHandler (net.dzikoysk.funnyguilds.feature.hologram.HologramUpdateLocationHandler)1 IndividualPlayerList (net.dzikoysk.funnyguilds.feature.tablist.IndividualPlayerList)1 Bukkit (org.bukkit.Bukkit)1 PandaStream (panda.std.stream.PandaStream)1