Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onHeldItem(PlayerItemHeldEvent event) {
- Player player = event.getPlayer();
- String uuid = player.getUniqueId().toString();
- ResultSet invswitch = MySQL.onQuery("SELECT player FROM invswitchsound WHERE player = '" + uuid + "'");
- try {
- if(!invswitch.next()) {
- MySQL.onUpdate("INSERT INTO invswitchsound(player, state) VALUES('" + uuid + "', '1')");
- } else {
- ResultSet invswitch1 = MySQL.onQuery("SELECT * FROM invswitchsound WHERE player = '" + uuid + "' AND state = '1'");
- if(invswitch1.next()) {
- player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_HAT, 3, 2);
- }
- }
- } catch(SQLException ex) {
- ex.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement