warc222

.color

Dec 23rd, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Color.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Color.java (revision 0)
  6. +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Color.java (working copy)
  7. @@ -0,0 +1,78 @@
  8. +/* This program is free software; you can redistribute it and/or modify
  9. + * it under the terms of the GNU General Public License as published by
  10. + * the Free Software Foundation; either version 2, or (at your option)
  11. + * any later version.
  12. + *
  13. + * This program is distributed in the hope that it will be useful,
  14. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. + * GNU General Public License for more details.
  17. + *
  18. + * You should have received a copy of the GNU General Public License
  19. + * along with this program; if not, write to the Free Software
  20. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  21. + * 02111-1307, USA.
  22. + *
  23. + * http://www.gnu.org/copyleft/gpl.html
  24. + */
  25. +
  26. +/*
  27. + * - Color's ID -
  28. + *
  29. + * Black = 000000
  30. + * Red = FF0000
  31. + * Green = 00FF00
  32. + * Blue = 0000FF
  33. + * Yellow = FFFF00
  34. + *
  35. + */
  36. +
  37. +/**
  38. + * @author Crystalia
  39. + */
  40. +
  41. +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
  42. +
  43. +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  44. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  45. +
  46. +public class Color implements IVoicedCommandHandler
  47. +{
  48. + private static final String[] VOICED_COMMANDS = { "color", "clean" };
  49. +
  50. + @Override
  51. + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  52. + {
  53. +
  54. + if (command.startsWith("color"))
  55. + {
  56. + try
  57. + {
  58. +
  59. + String val = command.substring(15);
  60. +
  61. + activeChar.getAppearance().setNameColor(Integer.decode("0x" + val));
  62. + activeChar.sendMessage("Congratulations, your name's color changed successfully!");
  63. + activeChar.broadcastUserInfo();
  64. + }
  65. + catch (Exception e)
  66. + {
  67. + activeChar.sendMessage("You need to specify a valid new color.");
  68. + }
  69. + }
  70. +
  71. + else if (command.startsWith("clean"))
  72. + {
  73. + activeChar.getAppearance().setNameColor(255, 255, 255);
  74. + activeChar.sendMessage("Your name's color cleaned.");
  75. + activeChar.broadcastUserInfo();
  76. + }
  77. +
  78. + return false;
  79. + }
  80. +
  81. + @Override
  82. + public String[] getVoicedCommandList()
  83. + {
  84. + return VOICED_COMMANDS;
  85. + }
  86. +
  87. +}
  88. \ No newline at end of file
  89. Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
  90. ===================================================================
  91. --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java (revision 21)
  92. +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java (working copy)
  93. @@ -23,6 +23,7 @@
  94.  
  95. import javolution.util.FastMap;
  96. import net.sf.l2j.Config;
  97. +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Color;
  98.  
  99. @@ -55,6 +56,8 @@
  100. }
  101.  
  102. + registerVoicedCommandHandler(new Color());
  103. +
  104. }
  105.  
  106. public void registerVoicedCommandHandler(IVoicedCommandHandler handler)
Advertisement
Add Comment
Please, Sign In to add comment