Changed updateUserPoints to be settings points instead of adding to existing points and doing it for all points a user has in one go
This commit is contained in:
parent
51fb4758d5
commit
bd46ce7df7
|
|
@ -44,15 +44,15 @@ public class Queries {
|
||||||
* NOTE: run async
|
* NOTE: run async
|
||||||
* Add a specified amount of points to the user for the given villager type
|
* Add a specified amount of points to the user for the given villager type
|
||||||
*
|
*
|
||||||
* @param uuid Uuid for the user you want to add the points to
|
* @param uuid Uuid for the user you want to add the points to
|
||||||
* @param villagerType Type of villager you want to add the points to
|
* @param pointsMap Contains all (villagerType, points) entries for user
|
||||||
* @param points The amount of points to add
|
* @return success
|
||||||
* @return success
|
|
||||||
*/
|
*/
|
||||||
public static boolean updateUserPoints(UUID uuid, String villagerType, int points) {
|
public static boolean updateUserPoints(UUID uuid, Object2ObjectArrayMap<String, Integer> pointsMap) {
|
||||||
String sql = "UPDATE user_points SET points = points + ? " +
|
String sql = "INSERT INTO user_points " +
|
||||||
"WHERE UUID = ? " +
|
"(uuid, villager_type, points) " +
|
||||||
"AND villager_type = ?;";
|
"VALUES (?, ?, ?) " +
|
||||||
|
"ON DUPLICATE KEY UPDATE points = ?";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PreparedStatement preparedStatement = Database.connection.prepareStatement(sql);
|
PreparedStatement preparedStatement = Database.connection.prepareStatement(sql);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user