Skip to content

Commit 3cf1720

Browse files
committed
Add server client remote channel checks.
1 parent 823ac20 commit 3cf1720

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ repositories {
6767
dependencies {
6868
compile "org.spongepowered:spongeapi:$spongeVersion"
6969
compile 'com.flowpowered:flow-math:1.0.2'
70-
compile 'org.mapdb:mapdb:3.0.0'
70+
compile 'org.mapdb:mapdb:3.0.1'
7171
//testCompile group: 'junit', name: 'junit', version: '4.11'
7272
}
7373

src/main/java/net/foxdenstudio/sponge/foxcore/mod/FCClientNetworkManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import io.netty.channel.ChannelInboundHandlerAdapter;
3434
import net.foxdenstudio.sponge.foxcore.common.network.IClientPacket;
3535
import net.foxdenstudio.sponge.foxcore.common.network.IServerPacketListener;
36+
import net.foxdenstudio.sponge.foxcore.plugin.FCServerNetworkManager;
3637
import net.minecraft.network.PacketBuffer;
3738
import net.minecraftforge.fml.common.network.ByteBufUtils;
3839
import net.minecraftforge.fml.common.network.FMLEmbeddedChannel;
@@ -163,6 +164,10 @@ public void sendDebug() {
163164
fmlEmbeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER);
164165
fmlEmbeddedChannel.writeAndFlush(new FMLProxyPacket(new PacketBuffer(byteBuf), "fox")).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
165166
}
167+
168+
public boolean hasServerChannel() {
169+
return FCClientNetworkManager.this.serverChannelMapping.values().contains(this.name);
170+
}
166171
}
167172

168173
/**

src/main/java/net/foxdenstudio/sponge/foxcore/plugin/FCServerNetworkManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ public void sendDebug(Player player) {
194194
}
195195
}
196196

197+
public boolean hasClientChannel(Player player) {
198+
PlayerConfig config = FCServerNetworkManager.this.playerConfigs.get(player);
199+
return config != null && config.clientChannelMapping.values().contains(this.name);
200+
}
201+
197202
}
198203

199204
public class PlayerConfig {

0 commit comments

Comments
 (0)