mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
bump fabric to 1.19.4 and change server instance handling
This commit is contained in:
17 files changed
+139
-133
No files matched your search
@@ -27,15 +27,15 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public abstract class PlatformUserManager<C extends WrappedCarbonPlayer> implements UserManagerInternal<C> {
|
||||
|
||||
private final UserManagerInternal<CarbonPlayerCommon> wrapped;
|
||||
private final UserManagerInternal<CarbonPlayerCommon> backingManager;
|
||||
|
||||
public PlatformUserManager(final UserManagerInternal<CarbonPlayerCommon> wrapped) {
|
||||
this.wrapped = wrapped;
|
||||
public PlatformUserManager(final UserManagerInternal<CarbonPlayerCommon> backingManager) {
|
||||
this.backingManager = backingManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<C> user(final UUID uuid) {
|
||||
return this.wrapped.user(uuid).thenApply(common -> {
|
||||
return this.backingManager.user(uuid).thenApply(common -> {
|
||||
final C wrapped = this.wrap(common);
|
||||
this.updateTransientLoadedStatus(wrapped);
|
||||
return wrapped;
|
||||
@@ -48,21 +48,22 @@ public abstract class PlatformUserManager<C extends WrappedCarbonPlayer> impleme
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
this.wrapped.shutdown();
|
||||
this.backingManager.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> save(final C player) {
|
||||
return this.wrapped.save(player.carbonPlayerCommon());
|
||||
return this.backingManager.save(player.carbonPlayerCommon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> loggedOut(final UUID uuid) {
|
||||
return this.wrapped.loggedOut(uuid);
|
||||
return this.backingManager.loggedOut(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup() {
|
||||
this.wrapped.cleanup();
|
||||
this.backingManager.cleanup();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,8 +15,8 @@ dependencies {
|
||||
minecraft(libs.fabricMinecraft)
|
||||
mappings(loom.officialMojangMappings())
|
||||
modImplementation(libs.fabricLoader)
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.69.1+1.19.3")
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api-deprecated:0.69.1+1.19.3") // LuckPerms needs to work at dev time
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.76.0+1.19.4")
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api-deprecated:0.76.0+1.19.4") // LuckPerms needs to work at dev time
|
||||
|
||||
carbon(projects.carbonchatCommon) {
|
||||
exclude("net.kyori", "adventure-api")
|
||||
|
||||
@@ -36,13 +36,11 @@ import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.draycia.carbon.common.messaging.MessagingManager;
|
||||
import net.draycia.carbon.common.users.ProfileCache;
|
||||
import net.draycia.carbon.common.users.ProfileResolver;
|
||||
import net.draycia.carbon.common.users.UserManagerInternal;
|
||||
import net.draycia.carbon.fabric.callback.ChatCallback;
|
||||
import net.draycia.carbon.fabric.command.DeleteMessageCommand;
|
||||
import net.draycia.carbon.fabric.listeners.FabricChatListener;
|
||||
import net.draycia.carbon.fabric.listeners.FabricChatPreviewListener;
|
||||
import net.draycia.carbon.fabric.listeners.FabricPlayerJoinListener;
|
||||
import net.draycia.carbon.fabric.listeners.FabricPlayerLeaveListener;
|
||||
import net.draycia.carbon.fabric.listeners.FabricJoinQuitListener;
|
||||
import net.draycia.carbon.fabric.users.CarbonPlayerFabric;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent;
|
||||
@@ -55,20 +53,14 @@ import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@Singleton
|
||||
public final class CarbonChatFabric extends CarbonChatInternal<CarbonPlayerFabric> {
|
||||
|
||||
private @Nullable MinecraftServer minecraftServer;
|
||||
|
||||
public static ResourceKey<ChatType> CHAT_TYPE = ResourceKey.create(Registries.CHAT_TYPE, new ResourceLocation("carbon", "chat"));
|
||||
|
||||
@Inject
|
||||
@@ -79,7 +71,7 @@ public final class CarbonChatFabric extends CarbonChatInternal<CarbonPlayerFabri
|
||||
final @PeriodicTasks ScheduledExecutorService periodicTasks,
|
||||
final ProfileCache profileCache,
|
||||
final ProfileResolver profileResolver,
|
||||
final UserManagerInternal<CarbonPlayerFabric> userManager,
|
||||
final FabricUserManager userManager,
|
||||
final ExecutionCoordinatorHolder commandExecutor,
|
||||
final CarbonServer carbonServer,
|
||||
final CarbonMessages carbonMessages,
|
||||
@@ -124,20 +116,13 @@ public final class CarbonChatFabric extends CarbonChatInternal<CarbonPlayerFabri
|
||||
}
|
||||
|
||||
private void registerServerLifecycleListeners() {
|
||||
ServerLifecycleEvents.SERVER_STARTING.register(server -> this.minecraftServer = server);
|
||||
ServerLifecycleEvents.SERVER_STOPPED.register(server -> {
|
||||
this.shutdown();
|
||||
this.minecraftServer = null;
|
||||
});
|
||||
ServerLifecycleEvents.SERVER_STOPPED.register(server -> this.shutdown());
|
||||
}
|
||||
|
||||
private void registerPlayerStatusListeners() {
|
||||
ServerPlayConnectionEvents.DISCONNECT.register(this.injector().getInstance(FabricPlayerLeaveListener.class));
|
||||
ServerPlayConnectionEvents.JOIN.register(this.injector().getInstance(FabricPlayerJoinListener.class));
|
||||
}
|
||||
|
||||
public MinecraftServer minecraftServer() {
|
||||
return requireNonNull(this.minecraftServer, "Attempted to get the MinecraftServer instance when one is not active.");
|
||||
final FabricJoinQuitListener listener = this.injector().getInstance(FabricJoinQuitListener.class);
|
||||
ServerPlayConnectionEvents.DISCONNECT.register(listener);
|
||||
ServerPlayConnectionEvents.JOIN.register(listener);
|
||||
}
|
||||
|
||||
public boolean luckPermsLoaded() {
|
||||
|
||||
@@ -106,8 +106,8 @@ public final class CarbonChatFabricModule extends AbstractModule {
|
||||
}
|
||||
|
||||
@Provides
|
||||
public PlayerSuggestions playerSuggestions(final Provider<CarbonChatFabric> carbon) {
|
||||
return (ctx, input) -> carbon.get().minecraftServer().getPlayerList().getPlayers().stream()
|
||||
public PlayerSuggestions playerSuggestions(final MinecraftServerHolder serverHolder) {
|
||||
return (ctx, input) -> serverHolder.requireServer().getPlayerList().getPlayers().stream()
|
||||
.map(player -> player.getGameProfile().getName())
|
||||
.toList();
|
||||
}
|
||||
|
||||
@@ -38,28 +38,28 @@ import org.jetbrains.annotations.NotNull;
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class CarbonServerFabric implements CarbonServer, ForwardingAudience.Single {
|
||||
|
||||
private final CarbonChatFabric carbonChatFabric;
|
||||
private final MinecraftServerHolder serverHolder;
|
||||
private final FabricUserManager userManager;
|
||||
|
||||
@Inject
|
||||
private CarbonServerFabric(final CarbonChatFabric carbonChatFabric, final FabricUserManager userManager) {
|
||||
this.carbonChatFabric = carbonChatFabric;
|
||||
private CarbonServerFabric(final MinecraftServerHolder serverHolder, final FabricUserManager userManager) {
|
||||
this.serverHolder = serverHolder;
|
||||
this.userManager = userManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Audience audience() {
|
||||
return FabricServerAudiences.of(this.carbonChatFabric.minecraftServer()).all();
|
||||
return FabricServerAudiences.of(this.serverHolder.requireServer()).all();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Audience console() {
|
||||
return this.carbonChatFabric.minecraftServer().createCommandSourceStack();
|
||||
return this.serverHolder.requireServer().createCommandSourceStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends CarbonPlayer> players() {
|
||||
return this.carbonChatFabric.minecraftServer().getPlayerList().getPlayers().stream()
|
||||
return this.serverHolder.requireServer().getPlayerList().getPlayers().stream()
|
||||
.map(serverPlayer -> this.userManager.user(serverPlayer.getUUID()).getNow(null))
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package net.draycia.carbon.fabric;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
import net.draycia.carbon.common.users.Backing;
|
||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||
@@ -33,17 +34,23 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@Singleton
|
||||
public final class FabricUserManager extends PlatformUserManager<CarbonPlayerFabric> {
|
||||
|
||||
private final CarbonChatFabric carbonChatFabric;
|
||||
private final MinecraftServerHolder serverHolder;
|
||||
private final Provider<CarbonChatFabric> carbonChat;
|
||||
|
||||
@Inject
|
||||
private FabricUserManager(final @Backing UserManagerInternal<CarbonPlayerCommon> proxiedUserManager, final CarbonChatFabric carbonChatFabric) {
|
||||
super(proxiedUserManager);
|
||||
this.carbonChatFabric = carbonChatFabric;
|
||||
private FabricUserManager(
|
||||
final @Backing UserManagerInternal<CarbonPlayerCommon> backingManager,
|
||||
final MinecraftServerHolder serverHolder,
|
||||
final Provider<CarbonChatFabric> carbonChat
|
||||
) {
|
||||
super(backingManager);
|
||||
this.serverHolder = serverHolder;
|
||||
this.carbonChat = carbonChat;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CarbonPlayerFabric wrap(final CarbonPlayerCommon common) {
|
||||
return new CarbonPlayerFabric(common, this.carbonChatFabric);
|
||||
return new CarbonPlayerFabric(common, this.serverHolder, this.carbonChat);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2023 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.fabric;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Objects;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class MinecraftServerHolder {
|
||||
|
||||
private @Nullable MinecraftServer server;
|
||||
|
||||
@Inject
|
||||
private MinecraftServerHolder() {
|
||||
ServerLifecycleEvents.SERVER_STARTING.register(server -> this.server = server);
|
||||
ServerLifecycleEvents.SERVER_STOPPED.register(server -> this.server = null);
|
||||
}
|
||||
|
||||
public MinecraftServer requireServer() {
|
||||
return Objects.requireNonNull(this.server, "server requested when not active");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
import net.draycia.carbon.common.util.ConcurrentUtil;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.audience.MessageType;
|
||||
@@ -33,7 +34,6 @@ import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.thread.NamedThreadFactory;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@@ -54,8 +54,8 @@ public enum ChatCallback {
|
||||
private @Nullable ExecutorService chatExecutor;
|
||||
private final List<Consumer<Chat>> listeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
private void initExecutor() {
|
||||
this.chatExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("CarbonChat-Chat-Thread"));
|
||||
private void initExecutor(final Logger logger) {
|
||||
this.chatExecutor = Executors.newSingleThreadExecutor(ConcurrentUtil.carbonThreadFactory(logger, "Chat Handling"));
|
||||
}
|
||||
|
||||
private void shutdownExecutor() {
|
||||
@@ -114,7 +114,7 @@ public enum ChatCallback {
|
||||
}
|
||||
|
||||
public static void setup() {
|
||||
ServerLifecycleEvents.SERVER_STARTING.register(server -> INSTANCE.initExecutor());
|
||||
ServerLifecycleEvents.SERVER_STARTING.register(server -> INSTANCE.initExecutor(LOGGER));
|
||||
ServerLifecycleEvents.SERVER_STOPPED.register(server -> INSTANCE.shutdownExecutor());
|
||||
}
|
||||
|
||||
|
||||
+22
-4
@@ -23,25 +23,36 @@ import com.google.inject.Inject;
|
||||
import java.util.List;
|
||||
import net.draycia.carbon.common.config.ConfigFactory;
|
||||
import net.draycia.carbon.common.users.ProfileCache;
|
||||
import net.draycia.carbon.common.users.UserManagerInternal;
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketSender;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
import net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public class FabricPlayerJoinListener implements ServerPlayConnectionEvents.Join {
|
||||
public class FabricJoinQuitListener implements ServerPlayConnectionEvents.Join, ServerPlayConnectionEvents.Disconnect {
|
||||
|
||||
private final ProfileCache profileCache;
|
||||
private final Logger logger;
|
||||
private final ConfigFactory configFactory;
|
||||
private final UserManagerInternal<?> userManager;
|
||||
|
||||
@Inject
|
||||
public FabricPlayerJoinListener(final ConfigFactory configFactory, final ProfileCache profileCache) {
|
||||
public FabricJoinQuitListener(
|
||||
final Logger logger,
|
||||
final ConfigFactory configFactory,
|
||||
final ProfileCache profileCache,
|
||||
final UserManagerInternal<?> userManager
|
||||
) {
|
||||
this.logger = logger;
|
||||
this.configFactory = configFactory;
|
||||
this.profileCache = profileCache;
|
||||
this.userManager = userManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,8 +65,15 @@ public class FabricPlayerJoinListener implements ServerPlayConnectionEvents.Join
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendPacket(new ClientboundCustomChatCompletionsPacket(ClientboundCustomChatCompletionsPacket.Action.SET,
|
||||
suggestions));
|
||||
sender.sendPacket(new ClientboundCustomChatCompletionsPacket(ClientboundCustomChatCompletionsPacket.Action.SET, suggestions));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayDisconnect(final ServerGamePacketListenerImpl handler, final MinecraftServer server) {
|
||||
this.userManager.loggedOut(handler.getPlayer().getGameProfile().getId()).exceptionally(thr -> {
|
||||
this.logger.warn("Exception saving data for player " + handler.getPlayer().getGameProfile().getName() + " with uuid " + handler.getPlayer().getGameProfile().getId());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2023 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.fabric.listeners;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import net.draycia.carbon.fabric.FabricUserManager;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public class FabricPlayerLeaveListener implements ServerPlayConnectionEvents.Disconnect {
|
||||
|
||||
private final FabricUserManager userManager;
|
||||
private final Logger logger;
|
||||
|
||||
@Inject
|
||||
public FabricPlayerLeaveListener(
|
||||
final Logger logger,
|
||||
final FabricUserManager userManager
|
||||
) {
|
||||
this.logger = logger;
|
||||
this.userManager = userManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayDisconnect(final ServerGamePacketListenerImpl handler, final MinecraftServer server) {
|
||||
this.userManager.loggedOut(handler.getPlayer().getGameProfile().getId()).exceptionally(thr -> {
|
||||
this.logger.warn("Exception saving data for player " + handler.getPlayer().getGameProfile().getName() + " with uuid " + handler.getPlayer().getGameProfile().getId());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
package net.draycia.carbon.fabric.users;
|
||||
|
||||
import com.google.inject.Provider;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -30,6 +31,7 @@ import net.draycia.carbon.api.util.InventorySlot;
|
||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||
import net.draycia.carbon.common.users.WrappedCarbonPlayer;
|
||||
import net.draycia.carbon.fabric.CarbonChatFabric;
|
||||
import net.draycia.carbon.fabric.MinecraftServerHolder;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
@@ -46,10 +48,12 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
public class CarbonPlayerFabric extends WrappedCarbonPlayer implements ForwardingAudience.Single {
|
||||
|
||||
private final CarbonPlayerCommon carbonPlayerCommon;
|
||||
private final CarbonChatFabric carbonChatFabric;
|
||||
private final MinecraftServerHolder serverHolder;
|
||||
private final Provider<CarbonChatFabric> carbonChatFabric;
|
||||
|
||||
public CarbonPlayerFabric(final CarbonPlayerCommon carbonPlayerCommon, final CarbonChatFabric carbonChatFabric) {
|
||||
public CarbonPlayerFabric(final CarbonPlayerCommon carbonPlayerCommon, final MinecraftServerHolder serverHolder, final Provider<CarbonChatFabric> carbonChatFabric) {
|
||||
this.carbonPlayerCommon = carbonPlayerCommon;
|
||||
this.serverHolder = serverHolder;
|
||||
this.carbonChatFabric = carbonChatFabric;
|
||||
}
|
||||
|
||||
@@ -60,7 +64,7 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
||||
|
||||
public Optional<ServerPlayer> player() {
|
||||
return Optional.ofNullable(
|
||||
this.carbonChatFabric.minecraftServer().getPlayerList()
|
||||
this.serverHolder.requireServer().getPlayerList()
|
||||
.getPlayer(this.carbonPlayerCommon.uuid())
|
||||
);
|
||||
}
|
||||
@@ -109,7 +113,7 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
||||
}
|
||||
|
||||
final @Nullable ServerPlayer player = this.player().orElse(null);
|
||||
final @Nullable ServerPlayer otherPlayer = this.carbonChatFabric.minecraftServer()
|
||||
final @Nullable ServerPlayer otherPlayer = this.serverHolder.requireServer()
|
||||
.getPlayerList().getPlayer(other.uuid());
|
||||
|
||||
if (player == null || otherPlayer == null) {
|
||||
@@ -130,7 +134,7 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
||||
}
|
||||
|
||||
final Optional<ServerPlayer> player = this.player();
|
||||
final @Nullable ServerPlayer otherPlayer = this.carbonChatFabric.minecraftServer()
|
||||
final @Nullable ServerPlayer otherPlayer = this.serverHolder.requireServer()
|
||||
.getPlayerList().getPlayer(other.uuid());
|
||||
|
||||
if (player.isEmpty() || otherPlayer == null) {
|
||||
@@ -184,7 +188,7 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
||||
|
||||
@Override
|
||||
public String primaryGroup() {
|
||||
if (!this.carbonChatFabric.luckPermsLoaded()) {
|
||||
if (!this.carbonChatFabric.get().luckPermsLoaded()) {
|
||||
return "default";
|
||||
}
|
||||
|
||||
@@ -193,7 +197,7 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
||||
|
||||
@Override
|
||||
public List<String> groups() {
|
||||
if (!this.carbonChatFabric.luckPermsLoaded()) {
|
||||
if (!this.carbonChatFabric.get().luckPermsLoaded()) {
|
||||
return List.of("default");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import net.draycia.carbon.common.users.MojangProfileResolver;
|
||||
import net.draycia.carbon.common.users.ProfileResolver;
|
||||
import net.draycia.carbon.fabric.CarbonChatFabric;
|
||||
import net.draycia.carbon.fabric.MinecraftServerHolder;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@@ -35,18 +35,18 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class FabricProfileResolver implements ProfileResolver {
|
||||
|
||||
private final CarbonChatFabric carbonChatFabric;
|
||||
private final MinecraftServerHolder serverHolder;
|
||||
private final ProfileResolver mojang;
|
||||
|
||||
@Inject
|
||||
private FabricProfileResolver(final CarbonChatFabric carbonChatFabric, final MojangProfileResolver mojang) {
|
||||
this.carbonChatFabric = carbonChatFabric;
|
||||
private FabricProfileResolver(final MinecraftServerHolder serverHolder, final MojangProfileResolver mojang) {
|
||||
this.serverHolder = serverHolder;
|
||||
this.mojang = mojang;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<@Nullable UUID> resolveUUID(final String username, final boolean cacheOnly) {
|
||||
final @Nullable ServerPlayer online = this.carbonChatFabric.minecraftServer().getPlayerList().getPlayerByName(username);
|
||||
final @Nullable ServerPlayer online = this.serverHolder.requireServer().getPlayerList().getPlayerByName(username);
|
||||
if (online != null) {
|
||||
return CompletableFuture.completedFuture(online.getUUID());
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public final class FabricProfileResolver implements ProfileResolver {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<@Nullable String> resolveName(final UUID uuid, final boolean cacheOnly) {
|
||||
final @Nullable ServerPlayer online = this.carbonChatFabric.minecraftServer().getPlayerList().getPlayer(uuid);
|
||||
final @Nullable ServerPlayer online = this.serverHolder.requireServer().getPlayerList().getPlayer(uuid);
|
||||
if (online != null) {
|
||||
return CompletableFuture.completedFuture(online.getGameProfile().getName());
|
||||
}
|
||||
|
||||
@@ -12,18 +12,18 @@ plugins:
|
||||
versions:
|
||||
indra: 3.0.1
|
||||
licenser: 0.6.1
|
||||
shadow: 7.1.2
|
||||
adventure: 4.12.0
|
||||
cloud: 1.8.0
|
||||
shadow: 8.1.0
|
||||
adventure: 4.13.0
|
||||
cloud: 1.8.3
|
||||
cloudSponge: 1.8.0-SNAPSHOT
|
||||
configurate: 4.1.2
|
||||
typesafeConfig: 1.4.1
|
||||
checkerQual: 3.28.0
|
||||
checkerQual: 3.32.0
|
||||
stylecheck: 0.1
|
||||
gson: 2.10
|
||||
guava: 30.1-jre
|
||||
bstats: 3.0.0
|
||||
paperApi: 1.19.3-R0.1-SNAPSHOT
|
||||
paperApi: 1.19.4-R0.1-SNAPSHOT
|
||||
paperLib: 1.0.8-SNAPSHOT
|
||||
kyoriEventApi: 5.0.0-SNAPSHOT
|
||||
kyoriRegistry: 1.0.0-SNAPSHOT
|
||||
@@ -32,9 +32,9 @@ versions:
|
||||
guice: 5.1.0
|
||||
velocityApi: 3.1.1
|
||||
geantyref: 1.3.11
|
||||
fabricMinecraft: 1.19.3
|
||||
fabricLoader: 0.14.12
|
||||
adventurePlatformFabric: 5.6.1
|
||||
fabricMinecraft: 1.19.4
|
||||
fabricLoader: 0.14.17
|
||||
adventurePlatformFabric: 5.8.0
|
||||
luckPermsApi: 5.3
|
||||
essentialsx: 2.19.3
|
||||
discordsrv: 1.26.0
|
||||
@@ -301,7 +301,7 @@ dependencies:
|
||||
name: indra-licenser-cadix
|
||||
version: { ref: indra }
|
||||
shadow:
|
||||
group: gradle.plugin.com.github.johnrengelman
|
||||
group: com.github.johnrengelman
|
||||
name: shadow
|
||||
version: { ref: shadow }
|
||||
licenser:
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
public final class PaperUserManager extends PlatformUserManager<CarbonPlayerPaper> {
|
||||
|
||||
@Inject
|
||||
private PaperUserManager(final @Backing UserManagerInternal<CarbonPlayerCommon> proxiedUserManager) {
|
||||
super(proxiedUserManager);
|
||||
private PaperUserManager(final @Backing UserManagerInternal<CarbonPlayerCommon> backingManager) {
|
||||
super(backingManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user