Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. @EventHandler
  2. public void onHeldItem(PlayerItemHeldEvent event) {
  3. Player player = event.getPlayer();
  4. String uuid = player.getUniqueId().toString();
  5. ResultSet invswitch = MySQL.onQuery("SELECT player FROM invswitchsound WHERE player = '" + uuid + "'");
  6. try {
  7. if(!invswitch.next()) {
  8. MySQL.onUpdate("INSERT INTO invswitchsound(player, state) VALUES('" + uuid + "', '1')");
  9. } else {
  10. ResultSet invswitch1 = MySQL.onQuery("SELECT * FROM invswitchsound WHERE player = '" + uuid + "' AND state = '1'");
  11. if(invswitch1.next()) {
  12. player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_HAT, 3, 2);
  13. }
  14. }
  15. } catch(SQLException ex) {
  16. ex.printStackTrace();
  17. }
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement