Advertisement
Guest User

erreur scheduler

a guest
Nov 28th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. public class Main extends JavaPlugin implements CommandExecutor, Listener{
  2.  
  3. public static Main i;
  4. private String mdp;
  5. private String mdpconfirm;
  6.  
  7. @Override
  8. public void onEnable() {
  9. i = this;
  10. mdpSql sql = new mdpSql("jdbc:mysql://", "213.32.103.252", "wng_clashofcraft", "cocv1", "dydu5y3y9", "coc_oldplayer");
  11. sql.connection();
  12. Bukkit.getPluginManager().registerEvents(this, this);
  13. super.onEnable();
  14. }
  15.  
  16. @SuppressWarnings("deprecation")
  17. @EventHandler(priority = EventPriority.HIGHEST)
  18. public void onJoin(PlayerJoinEvent e){
  19. Player p = e.getPlayer();
  20. int temps = 60;
  21. p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 9999, 10));
  22. final int tache = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
  23.  
  24. @Override
  25. public void run() {
  26. if (temps == 0){
  27. p.kickPlayer("vous n'avez pas taper la commande voulue");
  28. Bukkit.getServer().getScheduler().cancelTask(tache);
  29. }
  30. if (temps == 30 || temps == 15 || temps == 10 || temps <=9){
  31. p.sendMessage("Il vous reste "+temps+" secondes pour effectuer la commande /mdp <mdp authme> <mdp authme>");
  32. }
  33. }
  34. }, 20L, 20L);
  35. }
  36.  
  37. @Override
  38. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  39. if (sender instanceof Player)return false;
  40. if (label.equalsIgnoreCase("mdp")){
  41. if (args.length < 2)return false;
  42. Player p = (Player) sender;
  43. this.mdp = args[0].toString();
  44. this.mdpconfirm = args[1].toString();
  45. if (mdp == mdpconfirm){
  46. mdpSql.savePassword(p, mdp);
  47. } else{
  48. p.sendMessage("&eKEVIN EST UN CONNARD");
  49. }
  50. }
  51. return true;
  52. }
  53.  
  54. public String getMdp(){
  55. return mdp;
  56. }
  57.  
  58. public String getMdpConfirm(){
  59. return mdpconfirm;
  60. }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement