`iAndre Posted July 10, 2013 Posted July 10, 2013 Does it work on l2j frozen ? If u addapt it, ofc. Quote
fofas™ Posted July 10, 2013 Posted July 10, 2013 /* * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ package com.l2jfrozen.gameserver.model.entity; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.thread.ThreadPoolManager; /** * * @author Debian * */ public class AnnounceOnlinePlayers { public static void getInstance() { ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable() { @Override public void run() { Announce(); } }, 0,Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000); } public static void Announce() { int NumberofPlayers = L2World.getInstance().getAllPlayers().size(); if (NumberofPlayers == 1) Announcements.getInstance().announceToAll(NumberofPlayers + " player is online."); else Announcements.getInstance().announceToAll(NumberofPlayers + " players are online."); } } Code Fixed For L2JFrozen Quote
spartakos77 Posted July 10, 2013 Posted July 10, 2013 /* * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ package com.l2jfrozen.gameserver.model.entity; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.thread.ThreadPoolManager; /** * * @author Debian * */ public class AnnounceOnlinePlayers { public static void getInstance() { ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable() { @Override public void run() { Announce(); } }, 0,Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000); } public static void Announce() { int NumberofPlayers = L2World.getInstance().getAllPlayers().size(); if (NumberofPlayers == 1) Announcements.getInstance().announceToAll(NumberofPlayers + " player is online."); else Announcements.getInstance().announceToAll(NumberofPlayers + " players are online."); } } Code Fixed For L2JFrozen Thanks !!! :gusta: :gusta: :gusta: Quote
Detroitas Posted December 14, 2016 Posted December 14, 2016 AnnounceOnlinePlayers.java GameServer.java Quote
newChar.needHelp() Posted December 15, 2016 Posted December 15, 2016 AnnounceOnlinePlayers.java package net.sf.l2j.gameserver.model.entity; import net.sf.l2j.commons.concurrent.ThreadPool; import net.sf.l2j.Config; import net.sf.l2j.gameserver.model.World; import net.sf.l2j.gameserver.util.Broadcast; public class AnnounceOnlinePlayers { public static void getInstance() { ThreadPool.scheduleAtFixedRate(new Runnable() { @Override public void run() { Announce(); } }, 0, Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000); } protected static void Announce() { int NumberofPlayers = World.getInstance().getPlayers().size(); if (NumberofPlayers == 1) Broadcast.announceToOnlinePlayers(NumberofPlayers + " player is online."); else Broadcast.announceToOnlinePlayers(NumberofPlayers + " player are online."); } } Quote
AccessDenied Posted December 15, 2016 Posted December 15, 2016 Stop undig 3 years old topics.. god Quote
Detroitas Posted December 15, 2016 Posted December 15, 2016 Doesn't matter it's 3 years or it's 10 years if it fully working. Quote
Alex13xD Posted February 26, 2017 Posted February 26, 2017 tnx for the share man I'll use it for my server :good sir: Quote
Tryskell Posted February 26, 2017 Posted February 26, 2017 Can be shortcuted to: ThreadPool.scheduleAtFixedRate(() -> Broadcast.announceToOnlinePlayers(World.getInstance().getPlayers().size() + " online player(s)."), 0, Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.