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:
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,
|
`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,
|
`channel_id` int(12) NOT NULL,
|
||||||
`sender` int(12) NOT NULL,
|
`sender` int(12) NOT NULL,
|
||||||
`date` int(12) NOT NULL,
|
`date` TIMESTAMP NOT NULL,
|
||||||
`message` text NOT NULL,
|
`message` text NOT NULL,
|
||||||
PRIMARY KEY (`message_id`)
|
PRIMARY KEY (`message_id`)
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
@@ -36,7 +36,7 @@ import com.l2jserver.service.database.JDBCDatabaseService;
|
|||||||
public abstract class AbstractJDBCDAO<T extends Model<?>, I extends ID<?>>
|
public abstract class AbstractJDBCDAO<T extends Model<?>, I extends ID<?>>
|
||||||
extends AbstractDAO<T, I> {
|
extends AbstractDAO<T, I> {
|
||||||
/**
|
/**
|
||||||
* The MySQL Database Service
|
* The JDBC Database Service
|
||||||
*/
|
*/
|
||||||
protected final JDBCDatabaseService database;
|
protected final JDBCDatabaseService database;
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,16 @@ public abstract class JDBCChatMessageDAO extends
|
|||||||
return idFactory.resolveID(rs.getInt(MESSAGE_ID));
|
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}
|
* The {@link Mapper} for {@link ChatMessage}
|
||||||
@@ -180,7 +190,7 @@ public abstract class JDBCChatMessageDAO extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Mapper<ChatMessageID> keyMapper() {
|
protected Mapper<ChatMessageID> keyMapper() {
|
||||||
return idMapper;
|
return primaryKeyMapper;
|
||||||
}
|
}
|
||||||
}) > 0;
|
}) > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -332,12 +333,12 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
int rows = 0;
|
int rows = 0;
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final T object = iterator.next();
|
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);
|
this.parametize(st, object);
|
||||||
rows += st.executeUpdate();
|
rows += st.executeUpdate();
|
||||||
|
|
||||||
// update object desire --it has been realized
|
// update object desire --it has been realized
|
||||||
if (object instanceof Model) {
|
if (object instanceof Model && rows > 0) {
|
||||||
((Model<?>) object).setObjectDesire(ObjectDesire.NONE);
|
((Model<?>) object).setObjectDesire(ObjectDesire.NONE);
|
||||||
|
|
||||||
final Mapper<? extends ID<?>> mapper = keyMapper();
|
final Mapper<? extends ID<?>> mapper = keyMapper();
|
||||||
|
|||||||
@@ -352,6 +352,7 @@ public class CharacterServiceImpl extends AbstractService implements
|
|||||||
return;
|
return;
|
||||||
final Point3D old = character.getPoint();
|
final Point3D old = character.getPoint();
|
||||||
character.setPoint(point);
|
character.setPoint(point);
|
||||||
|
// BroadcastService will catch this event and update the knownlist
|
||||||
eventDispatcher.dispatch(new CharacterMoveEvent(character, old));
|
eventDispatcher.dispatch(new CharacterMoveEvent(character, old));
|
||||||
|
|
||||||
if (point.getCoordinate().equals(
|
if (point.getCoordinate().equals(
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class RangePointFilter implements WorldObjectFilter<PositionableObject> {
|
|||||||
Preconditions.checkNotNull(point, "point");
|
Preconditions.checkNotNull(point, "point");
|
||||||
Preconditions.checkState(range >= 0, "range < 0");
|
Preconditions.checkState(range >= 0, "range < 0");
|
||||||
this.point = point;
|
this.point = point;
|
||||||
this.range = Math.pow(range, 2);
|
this.range = range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user