hello, such! I have taken the trouble to adapt its code for c4 l2jlisvus.
I have had problems in the methods "public boolean isVoted (String ip)" and "public int getTotalVotes ()" of the class "public class TopZoneVoteHandler". Could I ask for your help?
package net.sf.l2j.gameserver.vote.handler;
import org.codehaus.jackson.map.ObjectMapper;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.vote.AbstractVoteManager;
import net.sf.l2j.gameserver.vote.model.json.TopZoneGlobalResponse;
import net.sf.l2j.gameserver.vote.model.json.TopZonePersonalResponse;
public class TopZoneVoteHandler extends AbstractVoteManager implements IVoteHandler {
@Override
public boolean isVoted(String ip) {
String url = getApiUrlTemplatePersonal(ip);
String response = getResponse(url, "L2TopZone");
TopZonePersonalResponse resp = null;
boolean voted = false;
try {
resp = new ObjectMapper().readValue(response, TopZonePersonalResponse.class);
if (resp != null) {
voted = resp.getResult().isVoted();
}
} catch (Exception e) {
if (Config.VOTE_LOG_ERROR) {
e.printStackTrace();
}
_log.warning("Failed to check personal vote status for topzone");
}
return voted;
}
@Override
public int getTotalVotes() {
String url = getApiUrlTemplateTotal();
String response = getResponse(url, "L2TopZone");
int votes = -1;
TopZoneGlobalResponse jsonResponse = null;
try {
jsonResponse = new ObjectMapper().readValue(response, TopZoneGlobalResponse.class);
if (jsonResponse != null) {
votes = jsonResponse.getResult().getTotalVotes();
}
} catch (Exception e) {
if (Config.VOTE_LOG_ERROR) {
e.printStackTrace();
}
_log.warning("Failed to read total votes for topzone");
}
return votes;
}
private String getApiUrlTemplatePersonal(String ip) {
return String.format("%svote?token=%s&ip=%s", Config.VOTE_TOPZONE_API_URL, Config.VOTE_TOP_ZONE_TOKEN, ip);
}
private String getApiUrlTemplateTotal() {
return String.format("%sserver_%s/getServerData", Config.VOTE_TOPZONE_API_URL, Config.VOTE_TOP_ZONE_TOKEN);
}
}
error by console
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
at net.sf.l2j.gameserver.vote.handler.TopZoneVoteHandler.getTotalVotes(TopZoneVoteHandler.java:42)
at net.sf.l2j.gameserver.vote.handler.VoteHandler.<init>(VoteHandler.java:42)
at net.sf.l2j.gameserver.vote.handler.VoteHandler$SingletonHolder.<clinit>(VoteHandler.java:292)
at net.sf.l2j.gameserver.vote.handler.VoteHandler.getInstance(VoteHandler.java:296)
at net.sf.l2j.gameserver.GameServer.main(GameServer.java:790)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
error with method "getTotalVotes ()" bounded and returning constant
Client: [Character: Gm-Mauro[268475126] - Account: mauro - IP: 25.8.35.95] - Failed running: [C] 38 Say2 - L2J Server Version: ${l2j.revision} - DP Revision: Unsupported Custom Version. ; org/codehaus/jackson/map/ObjectMapper
java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
at net.sf.l2j.gameserver.vote.handler.TopZoneVoteHandler.isVoted(TopZoneVoteHandler.java:22)
at net.sf.l2j.gameserver.vote.handler.VoteHandler.handleVote(VoteHandler.java:120)
at net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoteCmd.useVoicedCommand(VoteCmd.java:23)
at net.sf.l2j.gameserver.network.clientpackets.Say2.runImpl(Say2.java:314)
at net.sf.l2j.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:97)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more