Hello, i create plugin "ban" and i need code with temban, but my plugin connect with mysql, and how tempban with mysql? Thanks for help and sorry for my bad english
Slow Difficult to program around Requires extra skills (database design and SQL) Relies on outside software to ensure your server stays up Artificially limits your plugin to servers that have access to MySQL Should I keep going?
Just use the same exact method you would use in storing that sort of information in a config, except do it in the MySQL tables. For example, if you wanted to test if the player is banned, just add an isBanned boolean in the table. You could store the time in which the player gets unbanned / allowed to join using varchars, and then just convert them back to dates in Bukkit. Then you can test if the unban date is before the current date whenever a player joins. That's how I did it, sorry if that isn't exactly what you were asking in your question.
What method would you recommend for him to use then? In this instance and this situation, (at least in my judgement) a database seems the most reasonable way to store data...
Once you have a table in your database with the appropriate columns, e.g (VARCHAR(255) and INTEGER(255)). //Creating statement to grab current time PreparedStatement state = connection.prepareStatement("SELECT time FROM `" + table + "` WHERE uuid=?;"); state.setString(1, uuid.toString()); ResultSet set = state.executeQuery(); set.next(); int oldTime = set.getInt("time"); //Create statement to update the time, ^ subtract from the current time. PreparedStatement state1 = connection.prepareStatement("UPDATE `" + table + "` SET time=? WHERE uuid=?;"); state1.setLong(1, oldTime - [AMOUNT TO TAKE AWAY]); state1.setString(2, uuid.toString()); state1.executeUpdate(); //Close statements state.close(); set.close(); state1.close(); A bit messy.. or you could use something like DELETE FROM table WHERE date <'year:month:date time';
hello, i need mysql, for, i have 5 servers "bungeecord" and if i ban on server 3, player cant join on server 1,2,3,4,5 xD And mysql is to much easy because have all in database, xD not in config "server file" thanks for help. and sorry for my bad english :b now i use MaxBans, but this plugin have much bugs, i unban player and if reload plugin player returns to be ban, and this is to much bad now i have on my plugin ban,unban,mute,unmute, need tempban, but, need to mysql , for connect all svs xD thanks for help :b