mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
functioning postgres, checkstyle fixes, etc
This commit is contained in:
1 parent
629c34db04
commit
de834ac32b
37 files changed
+641
-242
No files matched your search
@@ -42,9 +42,9 @@ import net.draycia.carbon.common.messages.placeholders.KeyPlaceholderResolver;
|
||||
import net.draycia.carbon.common.messages.placeholders.StringPlaceholderResolver;
|
||||
import net.draycia.carbon.common.messages.placeholders.UUIDPlaceholderResolver;
|
||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||
import net.draycia.carbon.common.users.db.mysql.MySQLUserManager;
|
||||
import net.draycia.carbon.common.users.db.postgresql.PostgreSQLUserManager;
|
||||
import net.draycia.carbon.common.users.json.JSONUserManager;
|
||||
import net.draycia.carbon.common.users.db.mysql.MySQLUserManager;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
@@ -25,7 +25,6 @@ import cloud.commandframework.minecraft.extras.MinecraftExtrasMetaKeys;
|
||||
import cloud.commandframework.minecraft.extras.RichDescription;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.common.command.CarbonCommand;
|
||||
|
||||
@@ -25,7 +25,6 @@ import cloud.commandframework.minecraft.extras.MinecraftExtrasMetaKeys;
|
||||
import cloud.commandframework.minecraft.extras.RichDescription;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.common.command.CarbonCommand;
|
||||
|
||||
@@ -25,7 +25,6 @@ import cloud.commandframework.minecraft.extras.MinecraftExtrasMetaKeys;
|
||||
import cloud.commandframework.minecraft.extras.RichDescription;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.common.command.CarbonCommand;
|
||||
|
||||
@@ -25,7 +25,6 @@ import cloud.commandframework.minecraft.extras.MinecraftExtrasMetaKeys;
|
||||
import cloud.commandframework.minecraft.extras.RichDescription;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.common.command.CarbonCommand;
|
||||
|
||||
@@ -25,7 +25,6 @@ import cloud.commandframework.minecraft.extras.MinecraftExtrasMetaKeys;
|
||||
import cloud.commandframework.minecraft.extras.RichDescription;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.common.command.CarbonCommand;
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@@ -45,7 +46,7 @@ public class ProxiedCachingUserManager implements UserManager<CarbonPlayerCommon
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<ComponentPlayerResult<CarbonPlayerCommon>> carbonPlayer(UUID uuid) {
|
||||
public CompletableFuture<ComponentPlayerResult<CarbonPlayerCommon>> carbonPlayer(final UUID uuid) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
final @Nullable CarbonPlayerCommon cachedPlayer = this.userCache.get(uuid);
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
package net.draycia.carbon.common.users.db;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import org.jdbi.v3.core.argument.AbstractArgumentFactory;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package net.draycia.carbon.common.users.db;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.jdbi.v3.core.argument.AbstractArgumentFactory;
|
||||
import org.jdbi.v3.core.argument.Argument;
|
||||
|
||||
@@ -22,7 +22,6 @@ package net.draycia.carbon.common.users.db;
|
||||
import com.google.common.base.Splitter;
|
||||
import java.util.List;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jdbi.v3.core.locator.ClasspathSqlLocator;
|
||||
import org.jdbi.v3.core.locator.internal.ClasspathBuilder;
|
||||
@@ -46,7 +45,7 @@ public final class QueriesLocator {
|
||||
}
|
||||
|
||||
private String locate(final String name) {
|
||||
return locator.getResource(
|
||||
return this.locator.getResource(
|
||||
CarbonChat.class.getClassLoader(),
|
||||
new ClasspathBuilder()
|
||||
.appendDotPath(name)
|
||||
|
||||
-1
@@ -24,7 +24,6 @@ import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.intellij.lang.annotations.Subst;
|
||||
|
||||
@@ -197,42 +197,42 @@ public final class MySQLUserManager implements UserManager<CarbonPlayerCommon>,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveMuted(UUID id, boolean muted) {
|
||||
public int saveMuted(final UUID id, final boolean muted) {
|
||||
return this.jdbi.withExtension(MySQLSaveOnChange.class, changeSaver -> changeSaver.saveMuted(id, muted));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveDeafened(UUID id, boolean deafened) {
|
||||
public int saveDeafened(final UUID id, final boolean deafened) {
|
||||
return this.jdbi.withExtension(MySQLSaveOnChange.class, changeSaver -> changeSaver.saveDeafened(id, deafened));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveSpying(UUID id, boolean spying) {
|
||||
public int saveSpying(final UUID id, final boolean spying) {
|
||||
return this.jdbi.withExtension(MySQLSaveOnChange.class, changeSaver -> changeSaver.saveSpying(id, spying));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveSelectedChannel(UUID id, @Nullable Key selectedChannel) {
|
||||
public int saveSelectedChannel(final UUID id, final @Nullable Key selectedChannel) {
|
||||
return this.jdbi.withExtension(MySQLSaveOnChange.class, changeSaver -> changeSaver.saveSelectedChannel(id, selectedChannel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveLastWhisperTarget(UUID id, @Nullable UUID lastWhisperTarget) {
|
||||
public int saveLastWhisperTarget(final UUID id, final @Nullable UUID lastWhisperTarget) {
|
||||
return this.jdbi.withExtension(MySQLSaveOnChange.class, changeSaver -> changeSaver.saveLastWhisperTarget(id, lastWhisperTarget));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveWhisperReplyTarget(UUID id, @Nullable UUID whisperReplyTarget) {
|
||||
public int saveWhisperReplyTarget(final UUID id, final @Nullable UUID whisperReplyTarget) {
|
||||
return this.jdbi.withExtension(MySQLSaveOnChange.class, changeSaver -> changeSaver.saveWhisperReplyTarget(id, whisperReplyTarget));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addIgnore(UUID id, UUID ignoredPlayer) {
|
||||
public int addIgnore(final UUID id, final UUID ignoredPlayer) {
|
||||
return this.jdbi.withExtension(MySQLSaveOnChange.class, changeSaver -> changeSaver.addIgnore(id, ignoredPlayer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeIgnore(UUID id, UUID ignoredPlayer) {
|
||||
public int removeIgnore(final UUID id, final UUID ignoredPlayer) {
|
||||
return this.jdbi.withExtension(MySQLSaveOnChange.class, changeSaver -> changeSaver.removeIgnore(id, ignoredPlayer));
|
||||
}
|
||||
|
||||
|
||||
+19
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2021 Josua Parks (Vicarious)
|
||||
* Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.draycia.carbon.common.users.db.postgresql;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
|
||||
+19
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2021 Josua Parks (Vicarious)
|
||||
* Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.draycia.carbon.common.users.db.postgresql;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
+10
-10
@@ -36,10 +36,10 @@ import net.draycia.carbon.api.users.UserManager;
|
||||
import net.draycia.carbon.common.config.DatabaseSettings;
|
||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||
import net.draycia.carbon.common.users.SaveOnChange;
|
||||
import net.draycia.carbon.common.users.db.DBType;
|
||||
import net.draycia.carbon.common.users.db.QueriesLocator;
|
||||
import net.draycia.carbon.common.users.db.ComponentArgumentFactory;
|
||||
import net.draycia.carbon.common.users.db.DBType;
|
||||
import net.draycia.carbon.common.users.db.KeyArgumentFactory;
|
||||
import net.draycia.carbon.common.users.db.QueriesLocator;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -194,42 +194,42 @@ public final class PostgreSQLUserManager implements UserManager<CarbonPlayerComm
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveMuted(UUID id, boolean muted) {
|
||||
public int saveMuted(final UUID id, final boolean muted) {
|
||||
return this.jdbi.withExtension(PostgreSQLSaveOnChange.class, changeSaver -> changeSaver.saveMuted(id, muted));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveDeafened(UUID id, boolean deafened) {
|
||||
public int saveDeafened(final UUID id, final boolean deafened) {
|
||||
return this.jdbi.withExtension(PostgreSQLSaveOnChange.class, changeSaver -> changeSaver.saveDeafened(id, deafened));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveSpying(UUID id, boolean spying) {
|
||||
public int saveSpying(final UUID id, final boolean spying) {
|
||||
return this.jdbi.withExtension(PostgreSQLSaveOnChange.class, changeSaver -> changeSaver.saveSpying(id, spying));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveSelectedChannel(UUID id, @Nullable Key selectedChannel) {
|
||||
public int saveSelectedChannel(final UUID id, final @Nullable Key selectedChannel) {
|
||||
return this.jdbi.withExtension(PostgreSQLSaveOnChange.class, changeSaver -> changeSaver.saveSelectedChannel(id, selectedChannel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveLastWhisperTarget(UUID id, @Nullable UUID lastWhisperTarget) {
|
||||
public int saveLastWhisperTarget(final UUID id, final @Nullable UUID lastWhisperTarget) {
|
||||
return this.jdbi.withExtension(PostgreSQLSaveOnChange.class, changeSaver -> changeSaver.saveLastWhisperTarget(id, lastWhisperTarget));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveWhisperReplyTarget(UUID id, @Nullable UUID whisperReplyTarget) {
|
||||
public int saveWhisperReplyTarget(final UUID id, final @Nullable UUID whisperReplyTarget) {
|
||||
return this.jdbi.withExtension(PostgreSQLSaveOnChange.class, changeSaver -> changeSaver.saveWhisperReplyTarget(id, whisperReplyTarget));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addIgnore(UUID id, UUID ignoredPlayer) {
|
||||
public int addIgnore(final UUID id, final UUID ignoredPlayer) {
|
||||
return this.jdbi.withExtension(PostgreSQLSaveOnChange.class, changeSaver -> changeSaver.addIgnore(id, ignoredPlayer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeIgnore(UUID id, UUID ignoredPlayer) {
|
||||
public int removeIgnore(final UUID id, final UUID ignoredPlayer) {
|
||||
return this.jdbi.withExtension(PostgreSQLSaveOnChange.class, changeSaver -> changeSaver.removeIgnore(id, ignoredPlayer));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user