Advertisement
Guest User

Untitled

a guest
May 9th, 2020
1,077
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. package handlers.voicedcommandhandlers;
  2.  
  3. import org.l2jmobius.Config;
  4. import org.l2jmobius.gameserver.handler.IVoicedCommandHandler;
  5. import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  6. import org.l2jmobius.gameserver.votesystem.VoteManager;
  7. import org.l2jmobius.gameserver.votesystem.VoteSitesEnum;
  8.  
  9. public class VoteSystem implements IVoicedCommandHandler{
  10.  
  11. @Override
  12. public boolean useVoicedCommand(String command, PlayerInstance activeChar, String params) {
  13. if (command.equalsIgnoreCase(Config.VOTING_COMMAND))
  14. {
  15. if(!Config.ENABLE_VOTE_SYSTEM) {
  16. activeChar.sendMessage("The rewards system has been disabled by your administrator");
  17. return false;
  18. }
  19. if(!Config.ENABLE_INDIVIDUAL_VOTE) {
  20. activeChar.sendMessage("The individual reward system is disabled");
  21. return false;
  22. }
  23. if(!Config.ENABLE_VOTING_COMMAND) {
  24. activeChar.sendMessage("Voting command reward is disabled");
  25. return false;
  26. }
  27. if(activeChar.isJailed()) {
  28. activeChar.sendMessage("You can't use that function while incarcerated");
  29. return false;
  30. }
  31.  
  32. for(VoteSitesEnum vs : VoteSitesEnum.values()) {
  33. new Thread(()->{
  34. VoteManager.getInatance().getReward(activeChar, vs.ordinal());
  35. }).start();
  36. }
  37.  
  38. }
  39. return true;
  40. }
  41.  
  42. @Override
  43. public String[] getVoicedCommandList() {
  44. return new String[]{
  45. Config.VOTING_COMMAND,
  46. };
  47. }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement