Vinetos

CoinsAPI (Main)

Sep 20th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import org.bukkit.entity.Player;
  2. import org.bukkit.event.EventHandler;
  3. import org.bukkit.event.Listener;
  4. import org.bukkit.event.player.PlayerJoinEvent;
  5. import org.bukkit.plugin.java.JavaPlugin;
  6.  
  7. /**
  8. * @author VINETOS on 20/09/2015.
  9. */
  10. public class Main extends JavaPlugin implements Listener {
  11.  
  12. private API api;
  13.  
  14. @Override
  15. public void onEnable() {
  16. getServer().getPluginManager().registerEvents(this, this);
  17. api = new API("jdbc:mysql://", "bdd.monserveur.fr", "nomDeMaBase", "username", "passeword", "Table");
  18. }
  19.  
  20. @EventHandler
  21. public void onJoin(PlayerJoinEvent e){
  22. Player p = e.getPlayer();
  23. api.createPlayerIfNotExist(p);
  24. api.addCoins(p, 50);//Ajout des coins (+50)
  25. api.removeCoins(p, 10);//Suppression de coins (-10)
  26. int coins = api.getPoints(p);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment