Jump to content

Recommended Posts

Posted

Hey everyone,

 

I saw Fanky's code which isn't working and I coded this code from scratch.

 

Description : Every X minutes (seconds in config) an announcement appears which says how many players are online.

### Eclipse Workspace Patch 1.0
#P Coding Time!
Index: java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java	(working copy)
@@ -0,0 +1,52 @@
+/*
+ * 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.model.entity;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.model.L2World;
+
+/**
+ * 
+ * @author Debian
+ *
+ */
+
+public class AnnounceOnlinePlayers
+{
+    public static void getInstance()
+    {
+        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
+        {
+            @Override
+            @SuppressWarnings("synthetic-access")
+            public void run()
+            {
+                Announce();
+            }
+        }, 0,Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000);
+     }
+    @SuppressWarnings("static-access")
+    private static void Announce()
+    {
+        int NumberofPlayers = L2World.getInstance().getAllPlayersCount();
+
+        if (NumberofPlayers == 1)
+            Announcements.getInstance().announceToAll(NumberofPlayers + " player is online.");
+        else
+            Announcements.getInstance().announceToAll(NumberofPlayers + " players are online.");
+    }
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 270)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -89,6 +89,7 @@
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.PartyMatchRoomList;
import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
+import net.sf.l2j.gameserver.model.entity.AnnounceOnlinePlayers;
import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.Hero;
import net.sf.l2j.gameserver.model.olympiad.Olympiad;
@@ -273,6 +274,9 @@
		if (Config.ALLOW_WEDDING)
			CoupleManager.getInstance();

+		if (Config.ALLOW_ANNOUNCE_ONLINE_PLAYERS)
+		    AnnounceOnlinePlayers.getInstance();
+		
		Util.printSection("System");
		TaskManager.getInstance();

Index: config/events.properties
===================================================================
--- config/events.properties	(revision 270)
+++ config/events.properties	(working copy)
@@ -229,4 +229,13 @@
AltLottery3NumberRate = 0.2

# How much adena receive characters who pick two or less of the winning number
-AltLottery2and1NumberPrize = 200
\ No newline at end of file
+AltLottery2and1NumberPrize = 200
+
+#=============================================================
+#                  Announce Online Players
+#=============================================================
+# Enable this feature.
+AllowAnnounceOnlinePlayers = True
+
+# Announcement Delay (in seconds)
+AnnounceOnlinePlayersDelay = 300
\ No newline at end of file
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 270)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -262,6 +262,10 @@
	public static float ALT_LOTTERY_3_NUMBER_RATE;
	public static int ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;

+	/** Announce Online Players */
+	public static boolean ALLOW_ANNOUNCE_ONLINE_PLAYERS;
+	public static int ANNOUNCE_ONLINE_PLAYERS_DELAY;
+	
	// --------------------------------------------------
	// HexID
	// --------------------------------------------------
@@ -994,6 +998,8 @@
				ALT_LOTTERY_4_NUMBER_RATE = Float.parseFloat(events.getProperty("AltLottery4NumberRate", "0.2"));
				ALT_LOTTERY_3_NUMBER_RATE = Float.parseFloat(events.getProperty("AltLottery3NumberRate", "0.2"));
				ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = Integer.parseInt(events.getProperty("AltLottery2and1NumberPrize", "200"));
+				ALLOW_ANNOUNCE_ONLINE_PLAYERS = Boolean.parseBoolean(events.getProperty("AllowAnnounceOnlinePlayers", "True"));
+				ANNOUNCE_ONLINE_PLAYERS_DELAY = Integer.parseInt(events.getProperty("AnnounceOnlinePlayersDelay", "300"));
			}
			catch (Exception e)
			{

 

For any problems, pm me!

 

Kind regards,

 

Debian

Posted

Hey everyone,

 

I saw Fanky's code which isn't working and I coded this code from scratch.

 

Description : Every X minutes (seconds in config) an announcement appears which says how many players are online.

### Eclipse Workspace Patch 1.0
#P Coding Time!
Index: java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java	(working copy)
@@ -0,0 +1,52 @@
+/*
+ * 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.model.entity;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.model.L2World;
+
+/**
+ * 
+ * @author Debian
+ *
+ */
+
+public class AnnounceOnlinePlayers
+{
+    public static void getInstance()
+    {
+        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
+        {
+            @Override
+            @SuppressWarnings("synthetic-access")
+            public void run()
+            {
+                Announce();
+            }
+        }, 0,Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000);
+     }
+    @SuppressWarnings("static-access")
+    private static void Announce()
+    {
+        int NumberofPlayers = L2World.getInstance().getAllPlayersCount();
+
+        if (NumberofPlayers == 1)
+            Announcements.getInstance().announceToAll(NumberofPlayers + " player is online.");
+        else
+            Announcements.getInstance().announceToAll(NumberofPlayers + " players are online.");
+    }
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 270)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -89,6 +89,7 @@
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.PartyMatchRoomList;
import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
+import net.sf.l2j.gameserver.model.entity.AnnounceOnlinePlayers;
import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.Hero;
import net.sf.l2j.gameserver.model.olympiad.Olympiad;
@@ -273,6 +274,9 @@
		if (Config.ALLOW_WEDDING)
			CoupleManager.getInstance();

+		if (Config.ALLOW_ANNOUNCE_ONLINE_PLAYERS)
+		    AnnounceOnlinePlayers.getInstance();
+		
		Util.printSection("System");
		TaskManager.getInstance();

Index: config/events.properties
===================================================================
--- config/events.properties	(revision 270)
+++ config/events.properties	(working copy)
@@ -229,4 +229,13 @@
AltLottery3NumberRate = 0.2

# How much adena receive characters who pick two or less of the winning number
-AltLottery2and1NumberPrize = 200
\ No newline at end of file
+AltLottery2and1NumberPrize = 200
+
+#=============================================================
+#                  Announce Online Players
+#=============================================================
+# Enable this feature.
+AllowAnnounceOnlinePlayers = True
+
+# Announcement Delay (in seconds)
+AnnounceOnlinePlayersDelay = 300
\ No newline at end of file
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 270)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -262,6 +262,10 @@
	public static float ALT_LOTTERY_3_NUMBER_RATE;
	public static int ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;

+	/** Announce Online Players */
+	public static boolean ALLOW_ANNOUNCE_ONLINE_PLAYERS;
+	public static int ANNOUNCE_ONLINE_PLAYERS_DELAY;
+	
	// --------------------------------------------------
	// HexID
	// --------------------------------------------------
@@ -994,6 +998,8 @@
				ALT_LOTTERY_4_NUMBER_RATE = Float.parseFloat(events.getProperty("AltLottery4NumberRate", "0.2"));
				ALT_LOTTERY_3_NUMBER_RATE = Float.parseFloat(events.getProperty("AltLottery3NumberRate", "0.2"));
				ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = Integer.parseInt(events.getProperty("AltLottery2and1NumberPrize", "200"));
+				ALLOW_ANNOUNCE_ONLINE_PLAYERS = Boolean.parseBoolean(events.getProperty("AllowAnnounceOnlinePlayers", "True"));
+				ANNOUNCE_ONLINE_PLAYERS_DELAY = Integer.parseInt(events.getProperty("AnnounceOnlinePlayersDelay", "300"));
			}
			catch (Exception e)
			{

 

For any problems, pm me!

 

Kind regards,

 

Debian

Φοβερο +1 απο μενα :)

  • 5 weeks later...
  • 1 month later...
  • 5 weeks later...
Posted

Hey everyone,

 

I saw Fanky's code which isn't working and I coded this code from scratch.

 

Description : Every X minutes (seconds in config) an announcement appears which says how many players are online.

### Eclipse Workspace Patch 1.0
#P Coding Time!
Index: java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/entity/AnnounceOnlinePlayers.java	(working copy)
@@ -0,0 +1,52 @@
+/*
+ * 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.model.entity;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.model.L2World;
+
+/**
+ * 
+ * @author Debian
+ *
+ */
+
+public class AnnounceOnlinePlayers
+{
+    public static void getInstance()
+    {
+        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
+        {
+            @Override
+            @SuppressWarnings("synthetic-access")
+            public void run()
+            {
+                Announce();
+            }
+        }, 0,Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000);
+     }
+    @SuppressWarnings("static-access")
+    private static void Announce()
+    {
+        int NumberofPlayers = L2World.getInstance().getAllPlayersCount();
+
+        if (NumberofPlayers == 1)
+            Announcements.getInstance().announceToAll(NumberofPlayers + " player is online.");
+        else
+            Announcements.getInstance().announceToAll(NumberofPlayers + " players are online.");
+    }
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 270)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -89,6 +89,7 @@
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.PartyMatchRoomList;
import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
+import net.sf.l2j.gameserver.model.entity.AnnounceOnlinePlayers;
import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.Hero;
import net.sf.l2j.gameserver.model.olympiad.Olympiad;
@@ -273,6 +274,9 @@
		if (Config.ALLOW_WEDDING)
			CoupleManager.getInstance();

+		if (Config.ALLOW_ANNOUNCE_ONLINE_PLAYERS)
+		    AnnounceOnlinePlayers.getInstance();
+		
		Util.printSection("System");
		TaskManager.getInstance();

Index: config/events.properties
===================================================================
--- config/events.properties	(revision 270)
+++ config/events.properties	(working copy)
@@ -229,4 +229,13 @@
AltLottery3NumberRate = 0.2

# How much adena receive characters who pick two or less of the winning number
-AltLottery2and1NumberPrize = 200
\ No newline at end of file
+AltLottery2and1NumberPrize = 200
+
+#=============================================================
+#                  Announce Online Players
+#=============================================================
+# Enable this feature.
+AllowAnnounceOnlinePlayers = True
+
+# Announcement Delay (in seconds)
+AnnounceOnlinePlayersDelay = 300
\ No newline at end of file
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 270)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -262,6 +262,10 @@
	public static float ALT_LOTTERY_3_NUMBER_RATE;
	public static int ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;

+	/** Announce Online Players */
+	public static boolean ALLOW_ANNOUNCE_ONLINE_PLAYERS;
+	public static int ANNOUNCE_ONLINE_PLAYERS_DELAY;
+	
	// --------------------------------------------------
	// HexID
	// --------------------------------------------------
@@ -994,6 +998,8 @@
				ALT_LOTTERY_4_NUMBER_RATE = Float.parseFloat(events.getProperty("AltLottery4NumberRate", "0.2"));
				ALT_LOTTERY_3_NUMBER_RATE = Float.parseFloat(events.getProperty("AltLottery3NumberRate", "0.2"));
				ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = Integer.parseInt(events.getProperty("AltLottery2and1NumberPrize", "200"));
+				ALLOW_ANNOUNCE_ONLINE_PLAYERS = Boolean.parseBoolean(events.getProperty("AllowAnnounceOnlinePlayers", "True"));
+				ANNOUNCE_ONLINE_PLAYERS_DELAY = Integer.parseInt(events.getProperty("AnnounceOnlinePlayersDelay", "300"));
			}
			catch (Exception e)
			{

 

For any problems, pm me!

 

Kind regards,

 

Debian

 

where to add this code to make it works :D ? :poker face:

  • 2 months later...

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

    • What a deductive skills. What is it, 2012? And would You ask for unban with false accusations? I don't have to prove YOU anything. Have fun.
    • Released new security update for Faceit anti-cheat and Gamers Club. Cheat is available again! We also added a few more slots for 1 month subscription and 6 months.
    • This post originally appeared on zupyak.   If you're diving into MLB The Show 25, you know how essential stubs are for building a powerhouse team. Whether you're aiming to snag elite players, upgrade your roster, or stock up on packs, stubs are the key to success. The good news? You don't need to spend real money to earn them. With a little strategy and effort, you can rake in stubs and dominate the diamond.  Here are the top five strategies to maximize your MLB The Show stub earnings and create the ultimate team without breaking the bank.    1. Earning Stubs with Diamond Quest Diamond Quest is a goldmine for stubs. By completing challenges in this mode, you can earn Diamond cards, which often have high sell values. Once you've earned these cards, sell them in the in-game Marketplace for a quick influx of stubs. Additionally, the packs you earn from Diamond Quest can be opened for more cards to sell or use in collections.   2. Completing Conquest Maps Conquest Maps are another excellent way to rack up stubs. Focus on capturing territories and completing map-specific goals. Many maps offer hidden rewards, including packs and stubs, which can significantly boost your earnings. You don't always need to conquer Strongholds—simply taking over territories can yield great rewards.   3. Flipping Cards in the Marketplace The Marketplace is your playground for flipping cards. Look for cards with a significant gap between their "Buy Now" and "Sell Now" prices. Place a Buy Order slightly above the current "Sell Now" price, then list the card for a "Sell Order" just below the "Buy Now" price. After the 10% Marketplace tax, you'll still make a profit. This strategy works best with high-value cards but requires patience and consistency.     4. Leveraging Player Exchanges Player Exchanges are an underrated method for earning stubs. Purchase cheap Silver cards near their quick-sell value, then exchange them for Gold players. These Gold players can either be used in your lineup or sold for a profit. This method is especially effective early in the game when Gold cards hold higher value.   5. Selling Things You Don't Need Don't let unused items clutter your inventory. Regularly check for duplicate cards, equipment, or other items you don't need. Sell these through the Marketplace to free up space and earn extra stubs. Even Bronze and Silver cards can add up over time, so don't overlook them. With these strategies, you'll be well on your way to building a dream team without spending real money. Let me know if you'd like to dive deeper into any of these methods!   Final Thoughts Building your dream team in MLB The Show 25 doesn't have to cost real money. With these five strategies—earning rewards through Diamond Quest, conquering Conquest Maps, flipping cards in the Marketplace, leveraging Player Exchanges, and selling unused items—you'll be well on your way to amassing stubs and creating a roster that rivals even the best in the game. Remember, consistency is key! Whether you're grinding through challenges or flipping cards daily, every little bit adds up over time. Stick with these methods, and soon enough, you'll have the stubs you need to dominate the diamond. Let us know which strategy works best for you—or if you've discovered any additional tips that deserve a spot on this list! Happy grinding!   
    • I don't see that ur account got unbanned https://maxcheaters.com/profile/80641-∽ave∽/  
  • Topics

×
×
  • Create New...