Rework sending notes to chr, get rid of the first method

Sending notes should not be the handled by Character
This commit is contained in:
P0nk
2022-12-26 17:03:40 +01:00
parent 1f4ce98998
commit 4d480660b5
3 changed files with 28 additions and 16 deletions

View File

@@ -8796,14 +8796,10 @@ public class Character extends AbstractCharacterObject {
}
public void sendNote(String to, String msg, byte fame) throws SQLException {
sendNote(to, this.getName(), msg, fame);
}
public static void sendNote(String to, String from, String msg, byte fame) throws SQLException {
try (Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO notes (`to`, `from`, `message`, `timestamp`, `fame`) VALUES (?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) {
ps.setString(1, to);
ps.setString(2, from);
ps.setString(2, this.getName());
ps.setString(3, msg);
ps.setLong(4, Server.getInstance().getCurrentTime());
ps.setByte(5, fame);