mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +00:00
cross-server whispers & cross-server player name tab completion in commands
This commit is contained in:
1 parent
18f94a31c9
commit
b46f6c6016
27 files changed
+1895
-231
No files matched your search
@@ -36,7 +36,6 @@ import net.draycia.carbon.common.CarbonCommonModule;
|
||||
import net.draycia.carbon.common.DataDirectory;
|
||||
import net.draycia.carbon.common.PlatformScheduler;
|
||||
import net.draycia.carbon.common.command.Commander;
|
||||
import net.draycia.carbon.common.command.argument.PlayerSuggestions;
|
||||
import net.draycia.carbon.common.command.commands.ExecutionCoordinatorHolder;
|
||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.draycia.carbon.common.users.ProfileResolver;
|
||||
@@ -108,13 +107,6 @@ public final class CarbonChatFabricModule extends AbstractModule {
|
||||
return injector.getInstance(FabricMessageRenderer.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
public PlayerSuggestions playerSuggestions(final MinecraftServerHolder serverHolder) {
|
||||
return (ctx, input) -> serverHolder.requireServer().getPlayerList().getPlayers().stream()
|
||||
.map(player -> player.getGameProfile().getName())
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() {
|
||||
this.install(new CarbonCommonModule());
|
||||
|
||||
+13
-1
@@ -20,8 +20,11 @@
|
||||
package net.draycia.carbon.fabric.listeners;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import java.util.List;
|
||||
import net.draycia.carbon.common.config.ConfigFactory;
|
||||
import net.draycia.carbon.common.messaging.MessagingManager;
|
||||
import net.draycia.carbon.common.messaging.packets.PacketFactory;
|
||||
import net.draycia.carbon.common.users.ProfileCache;
|
||||
import net.draycia.carbon.common.users.UserManagerInternal;
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketSender;
|
||||
@@ -43,23 +46,32 @@ public class FabricJoinQuitListener implements ServerPlayConnectionEvents.Join,
|
||||
private final Logger logger;
|
||||
private final ConfigFactory configFactory;
|
||||
private final UserManagerInternal<?> userManager;
|
||||
private final Provider<MessagingManager> messaging;
|
||||
private final PacketFactory packetFactory;
|
||||
|
||||
@Inject
|
||||
public FabricJoinQuitListener(
|
||||
final Logger logger,
|
||||
final ConfigFactory configFactory,
|
||||
final ProfileCache profileCache,
|
||||
final UserManagerInternal<?> userManager
|
||||
final UserManagerInternal<?> userManager,
|
||||
final Provider<MessagingManager> messaging,
|
||||
final PacketFactory packetFactory
|
||||
) {
|
||||
this.logger = logger;
|
||||
this.configFactory = configFactory;
|
||||
this.profileCache = profileCache;
|
||||
this.userManager = userManager;
|
||||
this.messaging = messaging;
|
||||
this.packetFactory = packetFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayReady(final ServerGamePacketListenerImpl handler, final PacketSender sender, final MinecraftServer server) {
|
||||
this.profileCache.cache(handler.getPlayer().getUUID(), handler.getPlayer().getGameProfile().getName());
|
||||
this.messaging.get().withPacketService(packetService -> {
|
||||
packetService.queuePacket(this.packetFactory.addLocalPlayerPacket(handler.getPlayer().getUUID(), handler.getPlayer().getGameProfile().getName()));
|
||||
});
|
||||
|
||||
final @Nullable List<String> suggestions = this.configFactory.primaryConfig().customChatSuggestions();
|
||||
|
||||
|
||||
Reference in new issue
Block a user