Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean isUserexists(UUID uuid) {
- try{
- PreparedStatement ps = MySQL.getConnection.prepareStatement("SELECT gadgets FROM lobby WHERE UUID = ?");
- ps.getString(1, uuid.toString());
- ResultSet rs = ps.executeQuery();
- return rs.next();
- } catch (SQLException e){
- e.printStackTrace();
- }
- return false;
- }
- public static void updateEnder(UUID uuid, int statusneu){
- if(isUserexists(uuid)) {
- int status = getStatusEnder(uuid);
- status=statusneu;
- }else {
- try {
- PreparedStatement ps = MySQL.getConnection.prepareStatement("INSERT INTO lobby (UUID,STATUS) VALUES (?,?");
- ps.setString(1, uuid.toString());
- ps.setInt(2, 0);
- ps.executeUpdate();
- } catch (SQLException e){
- e.printStackTrace();
- }
- public static void updateEnterhaken(UUID uuid, int statusneu){
- if(isUserexists(uuid)) {
- try {
- int status = getStatusEnterhaken(uuid);
- status=statusneu;
- PreparedStatement ps = MySQL.getConnection.prepareStatement("UPDATE lobby SET Enterhaken = ? WHERE UUID = ?);
- ps.setString(1, uuid.toString());
- ps.setInt(2, status);
- ps.executeUpdate();
- } catch (SQLException e){
- e.printStackTrace();
- }
- }else {
- try {
- PreparedStatement ps = MySQL.getConnection.prepareStatement("INSERT INTO lobby (UUID,STATUS) VALUES (?,?");
- ps.setString(1, uuid.toString());
- ps.setInt(2, 0);
- ps.executeUpdate();
- } catch (SQLException e){
- e.printStackTrace();
- }
- public static Integer getStatusEnder(UUID uuid) {
- try{
- PreparedStatement ps = MySQL.getConnection.prepareStatement("SELECT gadgets FROM lobby WHERE UUID = ?");
- ps.getString(1, uuid.toString());
- ResultSet rs = ps.executeQuery();
- while(rs.next()) {
- return rs.getInt("ENDERPERLE");
- }
- } catch (SQLException e){
- e.printStackTrace();
- }
- return -1;
- }
- public static Integer getStatusEnterhaken(UUID uuid) {
- try{
- PreparedStatement ps = MySQL.getConnection.prepareStatement("SELECT gadgets FROM lobby WHERE UUID = ?");
- ps.getString(1, uuid.toString());
- ResultSet rs = ps.executeQuery();
- while(rs.next()) {
- return rs.getInt("Enterhaken");
- }
- } catch (SQLException e){
- e.printStackTrace();
- }
- return -1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement