1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-06 07:32:46 +00:00

Fixed exception in chat logging and fixed issue that caused knowlist

not being updated
This commit is contained in:
2011-08-01 00:20:52 -03:00
parent 6b79db00c2
commit 30477571ef
6 changed files with 18 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS `log_chat` (
`type` enum('ALL','SHOUT','TELL','PARTY','CLAN','GM','PETITION_PLAYER','PETITION_GM','TRADE','ALLIANCE','ANNOUNCEMENT','BOAT','L2FRIEND','MSNCHAT','PARTYMATCH_ROOM','PARTYROOM_COMMANDER','PARTYROOM_ALL','HERO_VOICE','CRITICAL_ANNOUNCE','SCREEN_ANNOUNCE','BATTLEFIELD','MPCC_ROOM') NOT NULL,
`channel_id` int(12) NOT NULL,
`sender` int(12) NOT NULL,
`date` int(12) NOT NULL,
`date` TIMESTAMP NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`message_id`)
) ENGINE=MyISAM;

View File

@@ -36,7 +36,7 @@ import com.l2jserver.service.database.JDBCDatabaseService;
public abstract class AbstractJDBCDAO<T extends Model<?>, I extends ID<?>>
extends AbstractDAO<T, I> {
/**
* The MySQL Database Service
* The JDBC Database Service
*/
protected final JDBCDatabaseService database;

View File

@@ -86,6 +86,16 @@ public abstract class JDBCChatMessageDAO extends
}
};
/**
* The {@link Mapper} for {@link ChatMessageID} as a PRIMARY KEY
*/
private final Mapper<ChatMessageID> primaryKeyMapper = new Mapper<ChatMessageID>() {
@Override
public ChatMessageID map(ResultSet rs) throws SQLException {
return idFactory.resolveID(rs.getInt(1));
}
};
/**
* The {@link Mapper} for {@link ChatMessage}
*/
@@ -180,7 +190,7 @@ public abstract class JDBCChatMessageDAO extends
@Override
protected Mapper<ChatMessageID> keyMapper() {
return idMapper;
return primaryKeyMapper;
}
}) > 0;
}

View File

@@ -20,6 +20,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -332,12 +333,12 @@ public class JDBCDatabaseService extends AbstractService implements
int rows = 0;
while (iterator.hasNext()) {
final T object = iterator.next();
final PreparedStatement st = conn.prepareStatement(query());
final PreparedStatement st = conn.prepareStatement(query(), Statement.RETURN_GENERATED_KEYS);
this.parametize(st, object);
rows += st.executeUpdate();
// update object desire --it has been realized
if (object instanceof Model) {
if (object instanceof Model && rows > 0) {
((Model<?>) object).setObjectDesire(ObjectDesire.NONE);
final Mapper<? extends ID<?>> mapper = keyMapper();

View File

@@ -352,6 +352,7 @@ public class CharacterServiceImpl extends AbstractService implements
return;
final Point3D old = character.getPoint();
character.setPoint(point);
// BroadcastService will catch this event and update the knownlist
eventDispatcher.dispatch(new CharacterMoveEvent(character, old));
if (point.getCoordinate().equals(

View File

@@ -50,7 +50,7 @@ public class RangePointFilter implements WorldObjectFilter<PositionableObject> {
Preconditions.checkNotNull(point, "point");
Preconditions.checkState(range >= 0, "range < 0");
this.point = point;
this.range = Math.pow(range, 2);
this.range = range;
}
@Override