Add NoteService to handle note operations
NoteService should be the only class with access to NoteDao; nowhere else should NoteDao be accessed directly. Channel dependencies are static in PacketProcessor, for now. Ideally they would be injected in the constructor, but since the constructor is private and I don't want to open up that can of worms, I'll leave it like this. At the very least, now we have a way of injecting services into the handlers. This will make further restructuring way easier.
This commit is contained in:
@@ -41,9 +41,6 @@ import constants.id.MapId;
|
||||
import constants.id.MobId;
|
||||
import constants.inventory.ItemConstants;
|
||||
import constants.skills.*;
|
||||
import database.DaoException;
|
||||
import database.NoteDao;
|
||||
import model.Note;
|
||||
import net.packet.Packet;
|
||||
import net.server.PlayerBuffValueHolder;
|
||||
import net.server.PlayerCoolDownValueHolder;
|
||||
@@ -9627,18 +9624,6 @@ public class Character extends AbstractCharacterObject {
|
||||
client.announceHint(msg, length);
|
||||
}
|
||||
|
||||
public void showNote() {
|
||||
final List<Note> notes;
|
||||
try {
|
||||
notes = NoteDao.findAllByTo(name);
|
||||
} catch (DaoException e) {
|
||||
log.error("Failed to find notes for chr name {}", name, e);
|
||||
return;
|
||||
}
|
||||
|
||||
sendPacket(PacketCreator.showNotes(notes));
|
||||
}
|
||||
|
||||
public void silentGiveBuffs(List<Pair<Long, PlayerBuffValueHolder>> buffs) {
|
||||
for (Pair<Long, PlayerBuffValueHolder> mbsv : buffs) {
|
||||
PlayerBuffValueHolder mbsvh = mbsv.getRight();
|
||||
|
||||
Reference in New Issue
Block a user