mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 22:16:22 +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
@@ -21,7 +21,6 @@ package net.draycia.carbon.paper;
|
||||
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.brigadier.CloudBrigadierManager;
|
||||
import cloud.commandframework.bukkit.parsers.PlayerArgument;
|
||||
import cloud.commandframework.paper.PaperCommandManager;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Injector;
|
||||
@@ -38,7 +37,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;
|
||||
@@ -132,7 +130,6 @@ public final class CarbonChatPaperModule extends AbstractModule {
|
||||
this.bind(Logger.class).toInstance(this.logger);
|
||||
this.bind(Path.class).annotatedWith(DataDirectory.class).toInstance(this.bootstrap.getDataFolder().toPath());
|
||||
this.bind(CarbonServer.class).to(CarbonServerPaper.class);
|
||||
this.bind(PlayerSuggestions.class).toInstance(new PlayerArgument.PlayerParser<Commander>()::suggestions);
|
||||
this.bind(ProfileResolver.class).to(PaperProfileResolver.class);
|
||||
this.bind(PlatformScheduler.class).to(PaperScheduler.class);
|
||||
this.bind(new TypeLiteral<UserManager<?>>() {}).to(PaperUserManager.class);
|
||||
|
||||
+20
-3
@@ -20,8 +20,11 @@
|
||||
package net.draycia.carbon.paper.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.paper.PaperUserManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -29,6 +32,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@@ -44,23 +48,36 @@ public class PaperPlayerJoinListener implements Listener {
|
||||
private final Logger logger;
|
||||
private final ProfileCache profileCache;
|
||||
private final PaperUserManager userManager;
|
||||
private final Provider<MessagingManager> messaging;
|
||||
private final PacketFactory packetFactory;
|
||||
|
||||
@Inject
|
||||
public PaperPlayerJoinListener(
|
||||
final ConfigFactory configFactory,
|
||||
final Logger logger,
|
||||
final ProfileCache profileCache,
|
||||
final PaperUserManager userManager
|
||||
final PaperUserManager userManager,
|
||||
final Provider<MessagingManager> messaging,
|
||||
final PacketFactory packetFactory
|
||||
) {
|
||||
this.configFactory = configFactory;
|
||||
this.logger = logger;
|
||||
this.profileCache = profileCache;
|
||||
this.userManager = userManager;
|
||||
this.messaging = messaging;
|
||||
this.packetFactory = packetFactory;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLogin(final PlayerLoginEvent event) {
|
||||
this.profileCache.cache(event.getPlayer().getUniqueId(), event.getPlayer().getName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void cacheProfile(final PlayerJoinEvent event) {
|
||||
this.profileCache.cache(event.getPlayer().getUniqueId(), event.getPlayer().getName());
|
||||
public void onJoinEarly(final PlayerJoinEvent event) {
|
||||
this.messaging.get().withPacketService(packetService -> {
|
||||
packetService.queuePacket(this.packetFactory.addLocalPlayerPacket(event.getPlayer().getUniqueId(), event.getPlayer().getName()));
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
|
||||
Reference in new issue
Block a user