mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-05 23:22:47 +00:00
Fixed exception in chat logging and fixed issue that caused knowlist
not being updated
This commit is contained in:
2
dist/sql/log_chat.sql
vendored
2
dist/sql/log_chat.sql
vendored
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -85,6 +85,16 @@ public abstract class JDBCChatMessageDAO extends
|
||||
return idFactory.resolveID(rs.getInt(MESSAGE_ID));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user