Jump to content

[Share]Announcement online players every X seconds(configurable)


Recommended Posts

Posted

So,crystalia pm'ed me today and asked me if I could do that,and i did it.

 

so,here you're

 

 

### Eclipse Workspace Patch 1.0
#P L2_GameServer_It
Index: java/net/sf/l2j/gameserver/PlayersOnlineAnnouncement.java
===================================================================
--- java/net/sf/l2j/gameserver/PlayersOnlineAnnouncement.java	(revision 0)
+++ java/net/sf/l2j/gameserver/PlayersOnlineAnnouncement.java	(revision 0)
@@ -0,0 +1,44 @@
+/*
+ * 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 net.sf.l2j.gameserver;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.model.L2World;
+
+/**
+ * @author fanky
+ *
+ */
+public class PlayersOnlineAnnouncement implements Runnable
+{
+
+	@Override
+	public void run()
+	{
+		Announcements.getInstance().announceToAll("There are "+L2World.getInstance().getAllPlayersCount()+" players online");
+		ThreadPoolManager.getInstance().scheduleGeneral(new PlayersOnlineAnnouncement(), Config.ANNOUNCE_ONLINE_PLAYER_EVERY * 1000);
+		
+	}
+	public static PlayersOnlineAnnouncement getInstance()
+	 {
+	      return SingletonHolder._instance;
+	  }
+	
+	  @SuppressWarnings("synthetic-access")
+	  private static class SingletonHolder
+	  {
+	      protected static final PlayersOnlineAnnouncement _instance = new PlayersOnlineAnnouncement();
+	  }
+}
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 5585)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -350,6 +350,9 @@
		CharTemplateTable.getInstance();
		NobleSkillTable.getInstance();
		HeroSkillTable.getInstance();
+		
+		if (Config.ALLOW_ANNOUNCE_ONLINE_PLAYERS)
+		PlayersOnlineAnnouncement.getInstance();

         //Call to load caches
         HtmCache.getInstance();
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 5585)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -882,6 +882,10 @@
     public static boolean L2JMOD_WEDDING_SAMESEX;
     public static boolean L2JMOD_WEDDING_FORMALWEAR;
     public static int L2JMOD_WEDDING_DIVORCE_COSTS;
+    
+    // auto announcement online players
+    public static int ANNOUNCE_ONLINE_PLAYER_EVERY;
+    public static boolean ALLOW_ANNOUNCE_ONLINE_PLAYERS;

     // Packet information
     /** Count the a-beep-t of packets per minute ? */
@@ -1859,7 +1863,8 @@
                 L2JMOD_WEDDING_SAMESEX                  = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False"));
                 L2JMOD_WEDDING_FORMALWEAR               = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
                 L2JMOD_WEDDING_DIVORCE_COSTS            = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));
-
+                ANNOUNCE_ONLINE_PLAYER_EVERY               = Integer.parseInt(L2JModSettings.getProperty("AnnounceOnlinePlayerEvery","60"));
+                ALLOW_ANNOUNCE_ONLINE_PLAYERS           = Boolean.parseBoolean(L2JModSettings.getProperty("AllowAnnounceOnlinePlayers","True"));
                 if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
                 {
                     TVT_EVENT_ENABLED = false;
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 5585)
+++ java/config/l2jmods.properties	(working copy)
@@ -132,3 +132,12 @@
# ex.: 1;2;3;4;5;6
# no ";" at the start or end
TvTEventDoorsCloseOpenOnStartEnd =
+
+#---------------------------------------------------------------
+# Auto Announcement Engine by fanky                    -
+#---------------------------------------------------------------
+# It 'll announce every x(seconds) online players
+# Enable this engine?
+AllowAnnounceOnlinePlayers = True
+# Announcement every ?(Seconds)
+AnnounceOnlinePlayerEvery = 60

 

I didn't actually test it,but it normally it should work.

if someone could test it and feedback me I would be pleased.

Guest Elfocrash
Posted

You wrong here : scheduleGeneral it should be ->scheduleGeneralAtFixedRate

read the code and then raise your hand and say i said the most stupid thing ever

Posted

read the code and then raise your hand and say i said the most stupid thing ever

read what i wrote: You wrong here : scheduleGeneral it should be ->scheduleGeneralAtFixedRate because scheduleGeneral execute tasks once and scheduleGeneralAtFixedRate execute tasks periodicaly

 

whos the stupid now?

Guest Elfocrash
Posted

read what i wrote: You wrong here : scheduleGeneral it should be ->scheduleGeneralAtFixedRate because scheduleGeneral execute tasks once and scheduleGeneralAtFixedRate execute tasks periodicaly

read the code and then raise your hand and say i said the most stupid thing ever

Posted

Elfocrash read the share [share]Announcement online players every X seconds(configurable) its a code that runs periodicaly... the scheduleGeneral its wrong. it should be scheduleGeneralAtFixedRate(periodicaly)

Guest Elfocrash
Posted

Elfocrash read the share [share]Announcement online players every X seconds(configurable) its a code that runs periodicaly... the scheduleGeneral its wrong. it should be scheduleGeneralAtFixedRate(periodicaly)

read the code and then raise your hand and say i said the most stupid thing ever

Posted

read what i wrote: You wrong here : scheduleGeneral it should be ->scheduleGeneralAtFixedRate because scheduleGeneral execute tasks once and scheduleGeneralAtFixedRate execute tasks periodicaly

 

whos the stupid now?

lolololo.

 

back to your cave dude,pls.

Posted

read what i wrote: You wrong here : scheduleGeneral it should be ->scheduleGeneralAtFixedRate because scheduleGeneral execute tasks once and scheduleGeneralAtFixedRate execute tasks periodicaly

 

whos the stupid now?

lolololo.

 

back to your cave dude,pls.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • sell adena l2rebon signature x1 - 1kk = 1 dollars l2reborn x10 - 500kk = 4.7 dollars E-Global x Lu4 - 1kk = 2.7 dollars BOHPTS - x20-x500 TOP PRICE DISCORD - GODDARDSHOP TELEGRAM - MMOPROMO
    • Hello send me on discord to receive the files source packages you order fron team, thanks you.
    • 亲爱的 SocNet 用户! 我们想向您介绍我们平台当前的促销和特惠活动列表: 1. 在 9 月使用优惠码 SEPTEMBER2025(9 折优惠)即可在我们的商店(网站、机器人)购物!您还可以在首次购买时使用优惠码:SOCNET(85 折优惠) 2. 获得 $1 商店余额或 10-20% 折扣,只需在我们网站注册后按照以下模板填写您的用户名: "SEND ME BONUS, MY USERNAME IS..." ——需要在我们的论坛主题帖中发布! 3. 获得 $1 用于首次试用 SMM 面板:只需在我们网站(支持中心)提交一个主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道和机器人中每周都会赠送 Telegram Stars! 当前链接: 数字商品商店(网站):前往 购买 Telegram Stars 的 Telegram 机器人:前往 SMM 面板:前往 – 推广您的社交媒体账号。 商店 Telegram 机器人:前往 新闻资源: Telegram 频道: https://t.me/accsforyou_shop WhatsApp 频道: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n Discord 服务器: https://discord.gg/y9AStFFsrh 我们正在积极寻找以下商品类别的供应商: — Snapchat 新旧账号 | 带积分 (snapscores) | 地区: 欧洲/美国 | 邮箱/手机号完全访问权限 — Reddit 老账号(暴力破解或被盗来源,自注册)| 帖子和评论业力值 100 至 100,000+ | 含邮箱完全访问权限 — LinkedIn 老账号 | 拥有真实连接 (connections) | 地区: 欧洲/美国 | 邮箱完全访问权限 + 活跃的 2FA 密码 — Instagram 老账号 (2010-2023 年) | 邮箱完全访问权限(可能包含活跃的 2FA 密码) — Facebook 老账号 (2010-2023 年) | 邮箱完全访问权限(可能包含活跃的 2FA 密码)| 有好友或无好友 | 地区: 欧洲/美国/亚洲 — Threads 账号 | 邮箱完全访问权限(可能包含活跃的 2FA 密码) — TikTok/Facebook/Google ADS 代理广告账号 请通过以下联系方式联系我们 —— 我们来讨论合作条件! 我们也随时欢迎其他合作机会。 联系方式和支持: Telegram: https://t.me/socnet_support WhatsApp: https://wa.me/79051904467 Discord: socnet_support 邮箱: solomonbog@socnet.store 通过这些联系方式您还可以: — 咨询批量采购 — 建立合作伙伴关系(现有合作伙伴: https://socnet.bgng.io/partners ) — 成为我们的供应商
    • 亲爱的 SocNet 用户! 我们想向您介绍我们平台当前的促销和特惠活动列表: 1. 在 9 月使用优惠码 SEPTEMBER2025(9 折优惠)即可在我们的商店(网站、机器人)购物!您还可以在首次购买时使用优惠码:SOCNET(85 折优惠) 2. 获得 $1 商店余额或 10-20% 折扣,只需在我们网站注册后按照以下模板填写您的用户名: "SEND ME BONUS, MY USERNAME IS..." ——需要在我们的论坛主题帖中发布! 3. 获得 $1 用于首次试用 SMM 面板:只需在我们网站(支持中心)提交一个主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道和机器人中每周都会赠送 Telegram Stars! 当前链接: 数字商品商店(网站):前往 购买 Telegram Stars 的 Telegram 机器人:前往 SMM 面板:前往 – 推广您的社交媒体账号。 商店 Telegram 机器人:前往 新闻资源: Telegram 频道: https://t.me/accsforyou_shop WhatsApp 频道: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n Discord 服务器: https://discord.gg/y9AStFFsrh 我们正在积极寻找以下商品类别的供应商: — Snapchat 新旧账号 | 带积分 (snapscores) | 地区: 欧洲/美国 | 邮箱/手机号完全访问权限 — Reddit 老账号(暴力破解或被盗来源,自注册)| 帖子和评论业力值 100 至 100,000+ | 含邮箱完全访问权限 — LinkedIn 老账号 | 拥有真实连接 (connections) | 地区: 欧洲/美国 | 邮箱完全访问权限 + 活跃的 2FA 密码 — Instagram 老账号 (2010-2023 年) | 邮箱完全访问权限(可能包含活跃的 2FA 密码) — Facebook 老账号 (2010-2023 年) | 邮箱完全访问权限(可能包含活跃的 2FA 密码)| 有好友或无好友 | 地区: 欧洲/美国/亚洲 — Threads 账号 | 邮箱完全访问权限(可能包含活跃的 2FA 密码) — TikTok/Facebook/Google ADS 代理广告账号 请通过以下联系方式联系我们 —— 我们来讨论合作条件! 我们也随时欢迎其他合作机会。 联系方式和支持: Telegram: https://t.me/socnet_support WhatsApp: https://wa.me/79051904467 Discord: socnet_support 邮箱: solomonbog@socnet.store 通过这些联系方式您还可以: — 咨询批量采购 — 建立合作伙伴关系(现有合作伙伴: https://socnet.bgng.io/partners ) — 成为我们的供应商
    • 亲爱的 SocNet 用户! 我们想向您介绍我们平台当前的促销和特惠活动列表: 1. 在 9 月使用优惠码 SEPTEMBER2025(9 折优惠)即可在我们的商店(网站、机器人)购物!您还可以在首次购买时使用优惠码:SOCNET(85 折优惠) 2. 获得 $1 商店余额或 10-20% 折扣,只需在我们网站注册后按照以下模板填写您的用户名: "SEND ME BONUS, MY USERNAME IS..." ——需要在我们的论坛主题帖中发布! 3. 获得 $1 用于首次试用 SMM 面板:只需在我们网站(支持中心)提交一个主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道和机器人中每周都会赠送 Telegram Stars! 当前链接: 数字商品商店(网站):前往 购买 Telegram Stars 的 Telegram 机器人:前往 SMM 面板:前往 – 推广您的社交媒体账号。 商店 Telegram 机器人:前往 新闻资源: Telegram 频道: https://t.me/accsforyou_shop WhatsApp 频道: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n Discord 服务器: https://discord.gg/y9AStFFsrh 我们正在积极寻找以下商品类别的供应商: — Snapchat 新旧账号 | 带积分 (snapscores) | 地区: 欧洲/美国 | 邮箱/手机号完全访问权限 — Reddit 老账号(暴力破解或被盗来源,自注册)| 帖子和评论业力值 100 至 100,000+ | 含邮箱完全访问权限 — LinkedIn 老账号 | 拥有真实连接 (connections) | 地区: 欧洲/美国 | 邮箱完全访问权限 + 活跃的 2FA 密码 — Instagram 老账号 (2010-2023 年) | 邮箱完全访问权限(可能包含活跃的 2FA 密码) — Facebook 老账号 (2010-2023 年) | 邮箱完全访问权限(可能包含活跃的 2FA 密码)| 有好友或无好友 | 地区: 欧洲/美国/亚洲 — Threads 账号 | 邮箱完全访问权限(可能包含活跃的 2FA 密码) — TikTok/Facebook/Google ADS 代理广告账号 请通过以下联系方式联系我们 —— 我们来讨论合作条件! 我们也随时欢迎其他合作机会。 联系方式和支持: Telegram: https://t.me/socnet_support WhatsApp: https://wa.me/79051904467 Discord: socnet_support 邮箱: solomonbog@socnet.store 通过这些联系方式您还可以: — 咨询批量采购 — 建立合作伙伴关系(现有合作伙伴: https://socnet.bgng.io/partners ) — 成为我们的供应商
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock