Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //If first argument is "unvote"
- }else if(args[0].equalsIgnoreCase("unvote")){
- try {
- //Establish database connection and generate statement
- Statement st = SQLConnect.sqlConnection();
- //Retrieve specified users database info
- ResultSet rs = st.executeQuery("Select playername,voted,lastvote,groups FROM users WHERE playername='"+args[1]+"';");
- //Get the users group count
- int groups = rs.getInt("groups");
- //Remove VIP or sub VIP rank from player depending on group size
- if(groups == 1){
- plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), "manudel " + args[1]);
- }else{
- plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), "manudelsub "+args[1]+" VIP");
- }
- //Delete user from db
- rs.rowDeleted();
- //Close ResultSet and statement
- rs.close();
- st.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- //If first argument is "check"
- }else if(args[0].equalsIgnoreCase("check")){
- try {
- //Establish database connection and generate statement
- Statement st = SQLConnect.sqlConnection();
- //Retrieve specified users database info
- ResultSet rs = st.executeQuery("Select * FROM users WHERE playername='"+args[1]+"' AND voted='false';");
- //Display result
- if(rs.getBoolean("voted")){
- sender.sendMessage("This player has voted within the past 24 hours");
- }else{
- sender.sendMessage("This player has not voted within the past 24 hours");
- }
- //Close ResultSet & Statement
- rs.close();
- st.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement