[Release]Player commands go into playerlog

Newbie Spellweaver
Joined
Jun 21, 2008
Messages
95
Reaction score
3
I don't know if this has been released before, but i'm gonna release it anyways :P

Remember to backup your files before doing this.

Run this query in MySQL:
Code:
DROP TABLE IF EXISTS `odinms`.`playerlog`;
CREATE TABLE  `odinms`.`playerlog` (
  `id` int(11) NOT NULL auto_increment,
  `cid` int(11) NOT NULL default '0',
  `command` tinytext NOT NULL,
  `when` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1562 DEFAULT CHARSET=latin1;

Go to CommandProcessor.java

Find:
Code:
private static List<Pair<MapleCharacter,String>> gmlog = new LinkedList<Pair<MapleCharacter,String>>();

Under it add
Code:
private static List<Pair<MapleCharacter,String>> playerlog = new LinkedList<Pair<MapleCharacter,String>>();

Find:
Code:
gmlog.clear();

Under it add
Code:
synchronized (playerlog) {
				Connection con = DatabaseConnection.getConnection();
				try {
					PreparedStatement ps = con.prepareStatement("INSERT INTO playerlog (cid, command) VALUES (?, ?)");
					for (Pair<MapleCharacter,String> logentry : playerlog) {
						ps.setInt(1, logentry.getLeft().getId());
						ps.setString(2, logentry.getRight());
						ps.executeUpdate();
					}
					ps.close();
				} catch (SQLException e) {
					log.error("error persisting cheatlog", e);
				}
				playerlog.clear();
			}

Now go to where it says
Code:
if (line.charAt(0) == '!' && isGM || line.charAt(0) =='@') {

Look for
Code:
synchronized (gmlog) {
				gmlog.add(new Pair<MapleCharacter, String>(player, line));
			}
Replace it with
Code:
if (line.charAt(0) == '!' && isGM) {
			synchronized (gmlog) {
				gmlog.add(new Pair<MapleCharacter, String>(player, line));
			}
			}

Now directly under it, add:
Code:
if (line.charAt(0) =='@') {
			synchronized (playerlog) {
				playerlog.add(new Pair<MapleCharacter, String>(player, line));
			}
			}

Recompile, and player commands such as @exp, @rebirth, @str, etc should be in playerlog instead of GM log! (hopefully, if you did it right)

Credits to myself and whoever coded this first if anyone did.

NOTE: I am not held responsible if this code is faulty or if you screw up. It works on my server. o_o
 
I'm not asking for a thanks. I searched for it and no one released it so I decided to release it. Some people aren't as godly with code as you Moogra :P
 
Umm, I really do not see the point in this....

The point in the GM Log is to basically see if a GM is abusing any commands or is screwing up things...

This would only work well if your player commands had commands that can benefit other players and could screw them up....
 
lol

topic : I don't get it...
gmlog make all the work for you..
you can add a column 'player' -> 1 = player, 0 = gm o.O
you don't need a new table for it..

Hahah woowww, that is so true.

Eh, I really find no use for this anyways.
 
Back