Advertisement
Reynald0

L2jFrozen 1.5 Command .servertime

Jun 24th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.44 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_GameServer
  3. Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ServerTimeCmd.java
  4. ===================================================================
  5. --- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ServerTimeCmd.java  (nonexistent)
  6. +++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ServerTimeCmd.java  (working copy)
  7. @@ -0,0 +1,33 @@
  8. +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
  9. +
  10. +import java.text.SimpleDateFormat;
  11. +import java.util.Date;
  12. +
  13. +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
  14. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  15. +
  16. +public class ServerTimeCmd implements IVoicedCommandHandler
  17. +{
  18. +   private final SimpleDateFormat fmt = new SimpleDateFormat("d MMM H:mm"); // 4 Jul 21:15
  19. +  
  20. +   private static final String[] VOICED_COMMANDS =
  21. +   {
  22. +       "servertime",
  23. +   };
  24. +
  25. +   @Override
  26. +   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  27. +   {
  28. +       if(activeChar == null)
  29. +           return false;
  30. +      
  31. +       activeChar.sendMessage("Server time: " + fmt.format(new Date(System.currentTimeMillis())));
  32. +       return true;
  33. +   }
  34. +
  35. +   @Override
  36. +   public String[] getVoicedCommandList()
  37. +   {
  38. +       return VOICED_COMMANDS;
  39. +   }
  40. +}
  41. Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
  42. ===================================================================
  43. --- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 1011)
  44. +++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy)
  45. @@ -34,6 +34,7 @@
  46.  import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.FarmPvpCmd;
  47.  import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.OfflineShop;
  48.  import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online;
  49. +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.ServerTimeCmd;
  50.  import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.StatsCmd;
  51.  import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.TvTCmd;
  52.  import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.WeddingCmd;
  53. @@ -86,6 +87,8 @@
  54.         if (Config.OFFLINE_TRADE_ENABLE && Config.OFFLINE_COMMAND2)
  55.             registerVoicedCommandHandler(new OfflineShop());
  56.        
  57. +       registerVoicedCommandHandler(new ServerTimeCmd());
  58. +      
  59.         LOGGER.info("VoicedCommandHandler: Loaded " + voicedCommands.size() + " handlers.");
  60.        
  61.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement