Folia support & display name state handling improvements (#240)

This commit is contained in:
Jason authored and GitHub committed 2023-04-25 12:48:40 -07:00
1 parent 0efeeaa5c8
commit 052c3731f5
12 files changed
+232 -17

No files matched your search

@@ -34,6 +34,7 @@ import net.draycia.carbon.api.users.UserManager;
import net.draycia.carbon.api.util.SourcedAudience;
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;
@@ -122,6 +123,7 @@ public final class CarbonChatFabricModule extends AbstractModule {
this.bind(Path.class).annotatedWith(DataDirectory.class).toInstance(FabricLoader.getInstance().getConfigDir().resolve(this.modContainer.getMetadata().getId()));
this.bind(CarbonServer.class).to(CarbonServerFabric.class);
this.bind(ProfileResolver.class).to(FabricProfileResolver.class);
this.bind(PlatformScheduler.class).to(FabricScheduler.class);
this.bind(new TypeLiteral<UserManager<?>>() {}).to(FabricUserManager.class);
this.bind(new TypeLiteral<UserManagerInternal<?>>() {}).to(FabricUserManager.class);
}
@@ -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 com.google.inject.Singleton;
import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.common.PlatformScheduler;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
@DefaultQualifier(NonNull.class)
@Singleton
public final class FabricScheduler implements PlatformScheduler {
private final MinecraftServerHolder serverHolder;
@Inject
private FabricScheduler(final MinecraftServerHolder serverHolder) {
this.serverHolder = serverHolder;
}
@Override
public void scheduleForPlayer(final CarbonPlayer carbonPlayer, final Runnable runnable) {
this.serverHolder.requireServer().execute(runnable);
}
}