move some stuff around

This commit is contained in:
kento2 2026-07-05 18:59:56 +02:00
parent 9421ef511e
commit e7ff5d3da2
35 changed files with 54 additions and 90 deletions

View file

@ -1,21 +1,18 @@
package de.kentoj.scrowlib.economy;
import de.kentoj.scrow.bukkit.ScrowAPI;
import org.jdbi.v3.core.Jdbi;
import java.util.UUID;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
// TODO log operations to separate table
public class PostgresEconomyService implements EconomyService {
private final Jdbi jdbi;
public PostgresEconomyService() {
checkNotNull(ScrowAPI.getJdbi());
this.jdbi = ScrowAPI.getJdbi();
public PostgresEconomyService(Jdbi jdbi) {
this.jdbi = jdbi;
jdbi.withHandle(h -> h.execute("""
CREATE TABLE IF NOT EXISTS economy (
playerId UUID NOT NULL,

View file

@ -1,6 +1,5 @@
package de.kentoj.scrowlib.friends.friendship;
import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrowlib.friends.Friendship;
import de.kentoj.scrowlib.friends.FriendshipService;
import de.kentoj.scrowlib.friends.OrderedUUIDPair;
@ -14,15 +13,12 @@ import java.time.OffsetDateTime;
import java.util.List;
import java.util.UUID;
import static com.google.common.base.Preconditions.checkNotNull;
public class PostgresFriendshipService implements FriendshipService {
private final Jdbi jdbi;
public PostgresFriendshipService() {
checkNotNull(ScrowAPI.getJdbi());
jdbi = ScrowAPI.getJdbi();
public PostgresFriendshipService(Jdbi jdbi) {
this.jdbi = jdbi;
jdbi.useHandle(h -> h.execute("""
CREATE TABLE IF NOT EXISTS friendships (
first_uuid UUID NOT NULL,

View file

@ -1,6 +1,5 @@
package de.kentoj.scrowlib.friends.request;
import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrowlib.friends.FriendRequest;
import de.kentoj.scrowlib.friends.FriendRequestService;
import lombok.extern.slf4j.Slf4j;
@ -14,17 +13,13 @@ import java.time.OffsetDateTime;
import java.util.List;
import java.util.UUID;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class PostgresFriendRequestService implements FriendRequestService {
private final Jdbi jdbi;
public PostgresFriendRequestService() {
checkNotNull(ScrowAPI.getJdbi());
jdbi = ScrowAPI.getJdbi();
public PostgresFriendRequestService(Jdbi jdbi) {
this.jdbi = jdbi;
jdbi.useHandle(h -> h.execute("""
CREATE TABLE IF NOT EXISTS friendrequests (
from_uuid UUID NOT NULL,