1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-08 08:23:11 +00:00

Chat logging implementation and chat service improvements

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-07-30 19:30:49 -03:00
parent 373ea43f3e
commit 9b25d29192
28 changed files with 863 additions and 77 deletions

View File

@@ -0,0 +1,39 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.id;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.server.ChatMessage;
/**
* Each {@link ChatMessage} log entry is identified by an {@link ID}.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class ChatMessageID extends ID<Integer> {
/**
* Creates a new instance
*
* @param id
* the id
*/
@Inject
public ChatMessageID(@Assisted int id) {
super(id);
}
}

View File

@@ -0,0 +1,28 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.id.provider;
import com.l2jserver.model.id.ChatMessageID;
/**
* Creates a new {@link ChatMessageID}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface ChatMessageIDProvider extends
IDProvider<Integer, ChatMessageID> {
}

View File

@@ -0,0 +1,155 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.server;
import java.util.Date;
import com.l2jserver.model.AbstractModel;
import com.l2jserver.model.Model;
import com.l2jserver.model.id.ChatMessageID;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.service.game.chat.ChatMessageType;
/**
* This is an chat message stored in the database for logging purposes. It can,
* however, be used as a form of flood-checking.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class ChatMessage extends AbstractModel<ChatMessageID> implements
Model<ChatMessageID> {
/**
* The chat message type.
* <p>
* If {@link ChatMessageType#SHOUT} <tt>target</tt> will be set and
* <tt>channelID</tt> will be <tt>null</tt>.<br>
* Otherwise, <tt>target</tt> is <tt>null</tt> and <tt>channelID</tt> will
* be set.
*/
private ChatMessageType type;
/**
* The channel numeric ID
*/
private int channelID;
/**
* The message target ID, if any.
*/
private CharacterID target;
/**
* The sender ID, if any.
*/
private CharacterID sender;
/**
* The message log date
*/
private Date date;
/**
* The message content
*/
private String message;
/**
* @return the type
*/
public ChatMessageType getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(ChatMessageType type) {
this.type = type;
}
/**
* @return the channelID
*/
public int getChannelID() {
return channelID;
}
/**
* @param channelID
* the channelID to set
*/
public void setChannelID(int channelID) {
this.channelID = channelID;
}
/**
* @return the target
*/
public CharacterID getTarget() {
return target;
}
/**
* @param target
* the target to set
*/
public void setTarget(CharacterID target) {
this.target = target;
}
/**
* @return the sender
*/
public CharacterID getSender() {
return sender;
}
/**
* @param sender
* the sender to set
*/
public void setSender(CharacterID sender) {
this.sender = sender;
}
/**
* @return the date
*/
public Date getDate() {
return date;
}
/**
* @param date
* the date to set
*/
public void setDate(Date date) {
this.date = date;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message
* the message to set
*/
public void setMessage(String message) {
this.message = message;
}
}