Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floodgate 2.2.2-SNAPSHOT #81

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ dependencies {

repositories {
//mavenLocal()

// temporary for custom bStats fork
maven {
url 'https://jitpack.io'
}

maven {
url = 'https://oss.sonatype.org/content/repositories/snapshots'
}
Expand Down Expand Up @@ -112,6 +118,7 @@ shadowJar {
configurations = [project.configurations.shadow]
// TODO this is temporary until Floodgate's dev branch is merged
relocate("com.google.inject", "org.geysermc.floodgate.shadow.guice")
relocate("org.bstats", "org.geysermc.floodgate.shadow.bstats")
relocate("org.yaml.snakeyaml", "org.geysermc.floodgate.shadow.snakeyaml") //relocate snakeyaml to avoid conflicts with other mods
exclude([
'cloud/**',
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2G
minecraft_version=1.19.3
loader_version=0.14.11
# Mod Properties
mod_version=2.2.0-SNAPSHOT
mod_version=2.2.2-SNAPSHOT
maven_group=org.geysermc.floodgate
archives_base_name=floodgate-fabric
# Dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/geysermc/floodgate/FabricMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void onInitialize() {
new FabricPlatformModule()
);

FabricPlatform platform = injector.getInstance(FabricPlatform.class);
FloodgatePlatform platform = injector.getInstance(FloodgatePlatform.class);

platform.enable(new FabricCommandModule());

Expand Down
14 changes: 0 additions & 14 deletions src/main/java/org/geysermc/floodgate/FabricPlatform.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public final class FabricInjector extends CommonPlatformInjector {
@Getter private final boolean injected = true;

@Override
public boolean inject() throws Exception {
return true;
public void inject() throws Exception {
//no-op
}

public void injectClient(ChannelFuture future) {
Expand All @@ -39,8 +39,8 @@ protected void initChannel(Channel channel) {
}

@Override
public boolean removeInjection() throws Exception {
return true;
public void removeInjection() throws Exception {
//no-op
}

public static FabricInjector getInstance() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
package org.geysermc.floodgate.logger;

import lombok.RequiredArgsConstructor;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.Configurator;
import org.geysermc.floodgate.api.logger.FloodgateLogger;
import org.geysermc.floodgate.config.FloodgateConfig;
import org.geysermc.floodgate.util.LanguageManager;

import static org.geysermc.floodgate.util.MessageFormatter.format;

@RequiredArgsConstructor
@Singleton
public final class Log4jFloodgateLogger implements FloodgateLogger {
private final Logger logger;
private final LanguageManager languageManager;
@Inject
@Named("logger")
private Logger logger;
private LanguageManager languageManager;

@Inject
private void init(LanguageManager languageManager, FloodgateConfig config) {
this.languageManager = languageManager;
if (config.isDebug() && !logger.isDebugEnabled()) {
Configurator.setLevel(logger.getName(), Level.DEBUG);
}
}

@Override
public void error(String message, Object... args) {
Expand Down Expand Up @@ -49,20 +62,6 @@ public void trace(String message, Object... args) {
logger.trace(message, args);
}

@Override
public void enableDebug() {
if (!logger.isDebugEnabled()) {
Configurator.setLevel(logger.getName(), Level.DEBUG);
}
}

@Override
public void disableDebug() {
if (logger.isDebugEnabled()) {
Configurator.setLevel(logger.getName(), Level.INFO);
}
}

@Override
public boolean isDebug() {
return logger.isDebugEnabled();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.geysermc.floodgate.module;

import com.google.inject.name.Names;
import org.apache.logging.log4j.Logger;
import org.geysermc.floodgate.inject.fabric.FabricInjector;
import org.geysermc.floodgate.listener.FabricEventListener;
import org.geysermc.floodgate.listener.FabricEventRegistration;
Expand Down Expand Up @@ -32,12 +34,8 @@ public final class FabricPlatformModule extends AbstractModule {
@Override
protected void configure() {
bind(PlatformUtils.class).to(FabricPlatformUtils.class);
}

@Provides
@Singleton
public FloodgateLogger floodgateLogger(LanguageManager languageManager) {
return new Log4jFloodgateLogger(LogManager.getLogger("floodgate"), languageManager);
bind(Logger.class).annotatedWith(Names.named("logger")).toInstance(LogManager.getLogger("floodgate"));
bind(FloodgateLogger.class).to(Log4jFloodgateLogger.class);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.floodgate.MinecraftServerHolder;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
import org.geysermc.floodgate.mixin.ChunkMapMixin;
import org.geysermc.floodgate.skin.SkinApplier;
import org.geysermc.floodgate.skin.SkinData;

import static org.geysermc.floodgate.api.event.skin.SkinApplyEvent.SkinData;

import java.util.Collections;

public final class FabricSkinApplier implements SkinApplier {

@Override
public void applySkin(FloodgatePlayer floodgatePlayer, SkinData skinData) {
public void applySkin(@NonNull FloodgatePlayer floodgatePlayer, @NonNull SkinData skinData) {
MinecraftServerHolder.get().execute(() -> {
ServerPlayer bedrockPlayer = MinecraftServerHolder.get().getPlayerList()
.getPlayer(floodgatePlayer.getCorrectUniqueId());
Expand All @@ -31,7 +33,7 @@ public void applySkin(FloodgatePlayer floodgatePlayer, SkinData skinData) {
PropertyMap properties = bedrockPlayer.getGameProfile().getProperties();

properties.removeAll("textures");
properties.put("textures", new Property("textures", skinData.getValue(), skinData.getSignature()));
properties.put("textures", new Property("textures", skinData.value(), skinData.signature()));

ChunkMap tracker = ((ServerLevel) bedrockPlayer.level).getChunkSource().chunkMap;
ChunkMap.TrackedEntity entry = ((ChunkMapMixin) tracker).getEntityMap().get(bedrockPlayer.getId());
Expand Down