Welcome to MaxCheaters.com

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

[Share]Show Server Time + Some announcements


Recommended Posts

Hello,since today i stay at home i decided to do 2 simple codes.

I took the idea from www.l2seraph.eu

This will announce to all instead of admin only,if any account got banned and if any player jailed

### Eclipse Workspace Patch 1.0
#P L2_GameServer_It
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminBan.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminBan.java	(revision 57)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminBan.java	(working copy)
@@ -25,6 +25,7 @@
import java.util.StringTokenizer;

import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.LoginServerThread;
import net.sf.l2j.gameserver.communitybbs.Manager.RegionBBSManager;
@@ -88,7 +89,8 @@
				account_name = plyr.getAccountName();
				RegionBBSManager.getInstance().changeCommunityBoard();
				plyr.logout();
-				activeChar.sendMessage("Account "+account_name+" banned.");
+				Announcements.getInstance().announceToAll("Account "+account_name+" banned");
+				
			}
		}
		else if (command.startsWith("admin_unban"))
@@ -125,7 +127,7 @@
				if (playerObj != null)
				{
					playerObj.setInJail(true, delay);
-					activeChar.sendMessage("Character "+player+" jailed for "+(delay>0 ? delay+" minutes." : "ever!"));
+					Announcements.getInstance().announceToAll("Character "+player+" jailed for "+(delay>0 ? delay+" minutes." : "ever!"));
				}
				else
					jailOfflinePlayer(activeChar, player, delay);

and this one(i guess you will find it more impressive)

will show the server time(I mean,the day,the month,the time) when char logged in.

### Eclipse Workspace Patch 1.0
#P L2_GameServer_It
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 80)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -1005,6 +1005,9 @@
    public static boolean NOBLESSE_ITEM_LEVEL_RESTRICTION;
    public static boolean NOBLESSE_ITEM_SUBCLASS_RESTRICTION;
    public static boolean NOBLESSE_ITEM_ENABLED;
+    
+    /** Server time*/
+    public static boolean SHOW_SERVER_TIME;
       
    /** Custom Tittle When new char Login */
    public static boolean CHAR_TITLE;
@@ -2124,6 +2127,10 @@
                /** hero weaps enchant */
                ENCHANT_HERO_WEAPONS                                = Boolean.parseBoolean(L2JModSettings.getProperty("EnchantHeroWeapons", "False")); 
                
+                /** Server time */
+                
+                SHOW_SERVER_TIME                                    = Boolean.parseBoolean(L2JModSettings.getProperty("ShowServerTime", "True"));
+                
                /** Noblesse Custom Item */
                NOBLESSE_ITEM_ID						= Integer.parseInt(L2JModSettings.getProperty("NoblesseItemId", "6673"));
                NOBLESSE_ITEM_LEVEL_RESTRICTION			= Boolean.parseBoolean(L2JModSettings.getProperty("NoblesseItemLvlRestriction", "True"));
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 84)
+++ java/config/l2jmods.properties	(working copy)
@@ -387,4 +387,7 @@
# Alternative damage for dagger skills.
DaggerVSHeavy = 2.50
DaggerVSRobe = 1.80
-DaggerVSLight = 2.00
\ No newline at end of file
+DaggerVSLight = 2.00
+
+#Show Server Time when char logged in?
+ShowServerTime = True
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java	(revision 84)
+++ java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java	(working copy)
@@ -22,10 +22,12 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Logger;
+import java.util.Date;

import net.sf.l2j.Base64;
import net.sf.l2j.Config;
import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.GameTimeController;
import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.GmListTable;
import net.sf.l2j.gameserver.LoginServerThread;
@@ -256,6 +258,18 @@
                        activeChar.sendPacket(ni);
                           }
                
+                     if (Config.SHOW_SERVER_TIME)
+                     {
+                        int t = GameTimeController.getInstance().getGameTime();
+                		String h = "" + (t / 60) % 24;
+                		String m;
+                		if (t % 60 < 10)
+                			m = "0" + t % 60;
+                		else
+                			m = "" + t % 60;
+                        activeChar.sendMessage("SVR time is " + (new Date(System.currentTimeMillis())));		
+                     }
+                        
        if (Config.ANNOUNCE_HERO_LOGIN)
        {
        	if (activeChar.isHero())

 

Hope you like it all,

>.>

Share this post


Link to post
Share on other sites

Well nice mods, thanks.The second one is cool. I think the first one will be better if you can do it kinda different, I mean with a config too. nvm I will try it.

Aprreciate!

Yes ok i know its better with configs(for 1th i mean)but ok

thanks

Thanks for share man.

thanks

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.