I am trying to make my server a vote rewards plugin to bump up the votes, but for some reason this doesn't seem to work?? Vote Event Code:java @EventHandler public void onPlayerVote(VotifierEvent e) { Vote v = e.getVote(); Random object = new Random(); int voting; for(int counter =1; counter<=1;counter++) { voting = 1+object.nextInt(2); if(voting == 1) { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "vote1 " + v.getUsername()); } else if(voting == 2) { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "vote2 " + v.getUsername()); } } } Vote1 command Code:java if(cmd.getName().equalsIgnoreCase("vote1")) { if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Please specify a player!"); return true; } final Player target = Bukkit.getServer().getPlayer(args[0]); if (target == null) { sender.sendMessage(ChatColor.RED + "Could not find player " + args[0] + "."); return true; } Random object = new Random(); int voting; for(int counter =1; counter<=1;counter++) { voting = 1+object.nextInt(2); if(voting == 1) { Bukkit.broadcastMessage("test 1" ); } else if(voting == 2) { Bukkit.broadcastMessage("Test 2"); } } Vote2 command Code:java if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Please specify a player!"); return true; } final Player target = Bukkit.getServer().getPlayer(args[0]); if (target == null) { sender.sendMessage(ChatColor.RED + "Could not find player " + args[0] + "."); return true; } Random object = new Random(); int voting; for(int counter =1; counter<=1;counter++) { voting = 1+object.nextInt(2); if(voting == 1) { Bukkit.broadcastMessage("test2 1" ); } else if(voting == 2) { Bukkit.broadcastMessage("Test2 2"); } }
Maybe you have a problem with the votifier port. Have you checked your settings on the plugin and the vote-page?
Joshuak52 So the VotifierEvent is fired? Please remove this line.. It has no effect.. Code: for(int counter =1; counter<=1;counter++) {
Joshuak52 If the votifier-event is not fired, there must be something wrong with your settings.. If you use Code: @EventHandler public void onPlayerVote(VotifierEvent e) { Bukkit.broadcastMessage("vote"); } and the msg doesn't appera, you either didn't register your EventHandler or your votifier-settings are wrong or the website has a problem on their votifier-vote handling
@Slikey Ok the event is fired, so why is my code not working? All votifier settings is done with websites and I know that for a fact
Have you checked if Bukkit finds a player by name? I think that Bukkit deprecated the getPlayer(String) method for a reason of UUID.. Maybe this method always return null now.. I am not sure.. and have you removed this line? "for(int counter =1; counter<=1;counter++){" EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Joshuak52 Slikey Try using getPlayerExact() It is, too, deprecated to raise awareness of UUIDs but it should be gone in 1.8 if not already.
Gater12 I am on 1.7.2 so there isn't any UDIDs right? @Slikey Yeah Don't know if to early but bump EDIT by Moderator: merged posts, please use the edit button instead of double posting.
bump, someone please help bump EDIT by Moderator: merged posts, please use the edit button instead of double posting.