use of net.dzikoysk.funnyguilds.feature.tablist.IndividualPlayerList in project FunnyGuilds by FunnyGuilds.
the class FunnyGuilds method handleReload.
private void handleReload() {
for (Player player : this.getServer().getOnlinePlayers()) {
final FunnyGuildsChannelHandler channelHandler = nmsAccessor.getPacketAccessor().getOrInstallChannelHandler(player);
Option<User> userOption = userManager.findByPlayer(player);
if (userOption.isEmpty()) {
continue;
}
User user = userOption.get();
channelHandler.getPacketCallbacksRegistry().registerPacketCallback(new WarPacketCallbacks(user));
UserCache cache = user.getCache();
cache.updateScoreboardIfNull(player);
cache.getDummy();
if (!this.tablistConfiguration.playerListEnable) {
continue;
}
IndividualPlayerList individualPlayerList = new IndividualPlayerList(user, this.getNmsAccessor().getPlayerListAccessor(), this.tablistConfiguration.playerList, this.tablistConfiguration.playerListHeader, this.tablistConfiguration.playerListFooter, this.tablistConfiguration.pages, this.tablistConfiguration.playerListPing, this.tablistConfiguration.playerListFillCells, this.pluginConfiguration.top.enableLegacyPlaceholders);
cache.setPlayerList(individualPlayerList);
}
for (Guild guild : this.guildManager.getGuilds()) {
if (this.pluginConfiguration.heart.createEntityType != null) {
GuildEntityHelper.spawnGuildHeart(guild);
}
}
}
use of net.dzikoysk.funnyguilds.feature.tablist.IndividualPlayerList 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 + ")");
}
use of net.dzikoysk.funnyguilds.feature.tablist.IndividualPlayerList in project FunnyGuilds by FunnyGuilds.
the class PlayerJoin method onJoin.
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
User user = this.userManager.findByPlayer(player).orElseGet(() -> userManager.create(player));
String playerName = player.getName();
if (!user.getName().equals(playerName)) {
this.userManager.updateUsername(user, playerName);
}
user.updateReference(player);
UserCache cache = user.getCache();
IndividualPlayerList individualPlayerList = new IndividualPlayerList(user, plugin.getNmsAccessor().getPlayerListAccessor(), tablistConfig.playerList, tablistConfig.playerListHeader, tablistConfig.playerListFooter, tablistConfig.pages, tablistConfig.playerListPing, tablistConfig.playerListFillCells, config.top.enableLegacyPlaceholders);
individualPlayerList.send();
cache.setPlayerList(individualPlayerList);
cache.updateScoreboardIfNull(player);
if (cache.getIndividualPrefix() == null && config.guildTagEnabled) {
IndividualPrefix prefix = new IndividualPrefix(user);
prefix.initialize();
cache.setIndividualPrefix(prefix);
}
this.concurrencyManager.postRequests(new PrefixGlobalUpdatePlayer(player), new DummyGlobalUpdateUserRequest(user));
final FunnyGuildsChannelHandler channelHandler = this.plugin.getNmsAccessor().getPacketAccessor().getOrInstallChannelHandler(player);
channelHandler.getPacketCallbacksRegistry().registerPacketCallback(new WarPacketCallbacks(user));
this.plugin.getServer().getScheduler().runTaskLaterAsynchronously(this.plugin, () -> {
this.plugin.getVersion().isNewAvailable(player, false);
if (config.heart.createEntityType != null) {
this.regionManager.findRegionAtLocation(player.getLocation()).map(Region::getGuild).peek(guild -> GuildEntityHelper.spawnGuildHeart(guild, player));
}
}, 30L);
}
Aggregations