Database: Rename setHome and setWarp methods to "save" for consistency

This commit is contained in:
William278 committed 2022-09-04 23:48:39 +03:00
1 parent a0c34743ef
commit 7a63e8c173
4 files changed
+13 -13

No files matched your search

@@ -382,7 +382,7 @@ public abstract class Database {
* @param home The {@link Home} to set - or update - in the database.
* @return A future returning void when complete
*/
public abstract CompletableFuture<Void> setHome(@NotNull Home home);
public abstract CompletableFuture<Void> saveHome(@NotNull Home home);
/**
* Sets or updates a {@link Warp} into the warp data table on the database.
@@ -390,7 +390,7 @@ public abstract class Database {
* @param warp The {@link Warp} to set - or update - in the database.
* @return A future returning void when complete
*/
public abstract CompletableFuture<Void> setWarp(@NotNull Warp warp);
public abstract CompletableFuture<Void> saveWarp(@NotNull Warp warp);
/**
* Deletes a {@link Home} by the given unique id from the home table on the database.
@@ -886,7 +886,7 @@ public class MySqlDatabase extends Database {
}
@Override
public CompletableFuture<Void> setHome(@NotNull Home home) {
public CompletableFuture<Void> saveHome(@NotNull Home home) {
return CompletableFuture.runAsync(() -> getHome(home.uuid)
.thenAccept(existingHome -> existingHome.ifPresentOrElse(presentHome -> {
try (Connection connection = getConnection()) {
@@ -935,7 +935,7 @@ public class MySqlDatabase extends Database {
}
@Override
public CompletableFuture<Void> setWarp(@NotNull Warp warp) {
public CompletableFuture<Void> saveWarp(@NotNull Warp warp) {
return CompletableFuture.runAsync(() -> getWarp(warp.uuid)
.thenAccept(existingHome -> existingHome.ifPresentOrElse(presentWarp -> {
try (Connection connection = getConnection()) {
@@ -901,7 +901,7 @@ public class SqLiteDatabase extends Database {
}
@Override
public CompletableFuture<Void> setHome(@NotNull Home home) {
public CompletableFuture<Void> saveHome(@NotNull Home home) {
return CompletableFuture.runAsync(() -> getHome(home.uuid)
.thenAccept(existingHome -> existingHome.ifPresentOrElse(presentHome -> {
try {
@@ -940,7 +940,7 @@ public class SqLiteDatabase extends Database {
}
@Override
public CompletableFuture<Void> setWarp(@NotNull Warp warp) {
public CompletableFuture<Void> saveWarp(@NotNull Warp warp) {
return CompletableFuture.runAsync(() -> getWarp(warp.uuid)
.thenAccept(existingHome -> existingHome.ifPresentOrElse(presentWarp -> {
try {
@@ -89,7 +89,7 @@ public class SavedPositionManager {
cache.homes.putIfAbsent(home.owner.uuid, new ArrayList<>());
cache.homes.get(home.owner.uuid).add(home.meta.name);
cache.privateHomeLists.remove(home.owner.uuid);
return database.setHome(home).thenApply(value ->
return database.saveHome(home).thenApply(value ->
new SaveResult(SaveResult.ResultType.SUCCESS, Optional.of(home))).join();
}).join();
}
@@ -178,7 +178,7 @@ public class SavedPositionManager {
if (home.isPublic && mapHook != null) {
mapHook.updateHome(home);
}
return database.setHome(home).thenApply(value ->
return database.saveHome(home).thenApply(value ->
new SaveResult(SaveResult.ResultType.SUCCESS, Optional.of(home))).join();
}).join();
});
@@ -226,7 +226,7 @@ public class SavedPositionManager {
if (home.isPublic && mapHook != null) {
mapHook.updateHome(home);
}
return database.setHome(home).thenApply(ignored -> true).join();
return database.saveHome(home).thenApply(ignored -> true).join();
});
}
@@ -263,7 +263,7 @@ public class SavedPositionManager {
return false;
}
return database.setHome(home).thenApply(ignored -> {
return database.saveHome(home).thenApply(ignored -> {
if (isHomePublic) {
cache.publicHomes.putIfAbsent(home.owner.username, new ArrayList<>());
cache.publicHomes.get(home.owner.username).add(home.meta.name);
@@ -307,7 +307,7 @@ public class SavedPositionManager {
if (mapHook != null) {
mapHook.updateWarp(warp);
}
return database.setWarp(warp).thenApply(ignored ->
return database.saveWarp(warp).thenApply(ignored ->
new SaveResult(SaveResult.ResultType.SUCCESS, Optional.of(warp))).join();
}).join();
}
@@ -389,7 +389,7 @@ public class SavedPositionManager {
if (mapHook != null) {
mapHook.updateWarp(warp);
}
return database.setWarp(warp).thenApply(value ->
return database.saveWarp(warp).thenApply(value ->
new SaveResult(SaveResult.ResultType.SUCCESS, Optional.of(warp))).join();
}).join();
});
@@ -436,7 +436,7 @@ public class SavedPositionManager {
if (mapHook != null) {
mapHook.updateWarp(warp);
}
return database.setWarp(warp).thenApply(ignored -> true).join();
return database.saveWarp(warp).thenApply(ignored -> true).join();
});
}