merge basic mailing

This commit is contained in:
destro174
2022-01-29 14:53:47 +01:00
parent 99babd2120
commit 26b044b2e7
7 changed files with 107 additions and 30 deletions
@@ -482,4 +482,26 @@ public class Queries {
return userNames;
}
public static UUID getPlayerUUID(String playerName) {
String query = "SELECT UUID FROM utility_users WHERE Username = ?";
UUID uuid = null;
try {
Connection connection = DatabaseConnection.getConnection();
PreparedStatement statement = connection.prepareStatement(query);
statement.setString(1, playerName);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
uuid = UUID.fromString(resultSet.getString("UUID"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return uuid;
}
}
@@ -4,7 +4,6 @@ import com.alttd.chat.database.Queries;
import com.alttd.chat.objects.channels.Channel;
import com.alttd.chat.util.Utility;
import net.kyori.adventure.text.Component;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.List;
@@ -4,11 +4,11 @@ import java.util.UUID;
public class Mail {
private final UUID uuid; // the player
private final UUID sender; // the sender
private final long sendTime; // any other option for this? does the db store recordcreation and edit time?
private long readTime; // any other option for this?
private final String message; // do we want staff to edit this after being send but being unread?
private final UUID uuid;
private final UUID sender;
private final long sendTime;
private long readTime;
private final String message;
public Mail(UUID player, UUID sender, long sendTime, long readTime, String message) {
this.uuid = player;
@@ -21,8 +21,8 @@ public class Mail {
public Mail(UUID player, UUID sender, String message) {
this.uuid = player;
this.sender = sender;
this.sendTime = System.nanoTime();
this.readTime = System.nanoTime();
this.sendTime = System.currentTimeMillis();
this.readTime = System.currentTimeMillis();
this.message = message;
}