Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package handlers.voicedcommandhandlers;
- import org.l2jmobius.Config;
- import org.l2jmobius.gameserver.handler.IVoicedCommandHandler;
- import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- import org.l2jmobius.gameserver.votesystem.VoteManager;
- import org.l2jmobius.gameserver.votesystem.VoteSitesEnum;
- public class VoteSystem implements IVoicedCommandHandler{
- @Override
- public boolean useVoicedCommand(String command, PlayerInstance activeChar, String params) {
- if (command.equalsIgnoreCase(Config.VOTING_COMMAND))
- {
- if(!Config.ENABLE_VOTE_SYSTEM) {
- activeChar.sendMessage("The rewards system has been disabled by your administrator");
- return false;
- }
- if(!Config.ENABLE_INDIVIDUAL_VOTE) {
- activeChar.sendMessage("The individual reward system is disabled");
- return false;
- }
- if(!Config.ENABLE_VOTING_COMMAND) {
- activeChar.sendMessage("Voting command reward is disabled");
- return false;
- }
- if(activeChar.isJailed()) {
- activeChar.sendMessage("You can't use that function while incarcerated");
- return false;
- }
- for(VoteSitesEnum vs : VoteSitesEnum.values()) {
- new Thread(()->{
- VoteManager.getInatance().getReward(activeChar, vs.ordinal());
- }).start();
- }
- }
- return true;
- }
- @Override
- public String[] getVoicedCommandList() {
- return new String[]{
- Config.VOTING_COMMAND,
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement