Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main extends JavaPlugin implements CommandExecutor, Listener{
- public static Main i;
- private String mdp;
- private String mdpconfirm;
- @Override
- public void onEnable() {
- i = this;
- mdpSql sql = new mdpSql("jdbc:mysql://", "213.32.103.252", "wng_clashofcraft", "cocv1", "dydu5y3y9", "coc_oldplayer");
- sql.connection();
- Bukkit.getPluginManager().registerEvents(this, this);
- super.onEnable();
- }
- @SuppressWarnings("deprecation")
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onJoin(PlayerJoinEvent e){
- Player p = e.getPlayer();
- int temps = 60;
- p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 9999, 10));
- final int tache = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- if (temps == 0){
- p.kickPlayer("vous n'avez pas taper la commande voulue");
- Bukkit.getServer().getScheduler().cancelTask(tache);
- }
- if (temps == 30 || temps == 15 || temps == 10 || temps <=9){
- p.sendMessage("Il vous reste "+temps+" secondes pour effectuer la commande /mdp <mdp authme> <mdp authme>");
- }
- }
- }, 20L, 20L);
- }
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (sender instanceof Player)return false;
- if (label.equalsIgnoreCase("mdp")){
- if (args.length < 2)return false;
- Player p = (Player) sender;
- this.mdp = args[0].toString();
- this.mdpconfirm = args[1].toString();
- if (mdp == mdpconfirm){
- mdpSql.savePassword(p, mdp);
- } else{
- p.sendMessage("&eKEVIN EST UN CONNARD");
- }
- }
- return true;
- }
- public String getMdp(){
- return mdp;
- }
- public String getMdpConfirm(){
- return mdpconfirm;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement