|
|

Since all this talk of "correct conventions" is starting to annoy me.
banAssistant should BanAssistant, if you knew the conventions and not just been swept up in the hype.

Very nice, thanks
Can anyone create Ban command with Uername Case_id Start_date End_date inserting into database?
or just make for me correct insert lines:
My lines:
Code:Statement stmt = MySQL.conn.createStatement(); stmt.execute("INSERT INTO `banned_users` (`Username`, `Case_Id`, `Start_date`, `End_date`) VALUES ('"+p.username+"','"+player+"', '"+today+"', '"+expireDate+"')");

You missed a convention i guess, and a one which you should never forget: Capitalize the first letter of a class (and other first letter if you got more words)
Other then that you might execute your queries in a threadpool, but it looks fine

My ban code:
Just need to edit inserting into db.Code:package server.players.Commands; import java.sql.Statement; import server.*; import server.players.*; import server.players.MiscHandlers.*; public class BanUser implements Command { @Override public void execute(client client, String command) { if (client.playerRights >= 2) { try { String otherPName = command.substring(8); int otherPIndex = PlayerHandler.getPlayerID(otherPName); if (otherPIndex != -1) { client p = (client) server.playerHandler.players[otherPIndex]; Statement stmt = MySQL.conn.createStatement(); stmt.execute("INSERT INTO `banned_users` (`Username`, `Case_Id`, `Start_date`, `End_date`) VALUES ('"+p.username+"', '"+player+"', '"+today+"', '"+expireDate+"')"); p.disconnected = true; client.CAM().sendMessage("You have banned "+p.username+"!"); } else { client.CAM().sendMessage("The name doesn't exist."); } } catch (Exception e) { client.CAM().sendMessage("Try entering a name you want to ban.."); } } } }

Couldn't You Just Do somthing like this for the time instead of all the date gregorian stuffs
Code:public long banRelease; private static long Day_1 = (1000 * 3600 * 24);Code:private void addBan(int daysBanned){ banRelease = System.currentTimeMillis() + (Day_1 * daysBanned) }Code:private void liftBans(String Player){ if(banRelease <= System.currentTimeMillis()) }
How i can make to show player show how much time left until mute end?
thanks so much dude , this looks crazy
| « Basic Coding Tutorials | Stopping staff trading and loosing items on death ( Building an ecomony ) » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |