mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 10:05:12 +01:00
Fix a bug in chunks (still not working fully)
Also remove bungeecord-proxy
This commit is contained in:
parent
aeec7e5f95
commit
b0d64bfebd
@ -33,14 +33,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- BungeeCord Proxy -->
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-proxy</artifactId>
|
||||
<version>1.4.7-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Common Module -->
|
||||
<dependency>
|
||||
<groupId>us.myles</groupId>
|
||||
|
@ -2,24 +2,31 @@ package us.myles.ViaVersion.bungee.platform;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.platform.ViaInjector;
|
||||
import us.myles.ViaVersion.bungee.handlers.BungeeChannelInitializer;
|
||||
import us.myles.ViaVersion.util.ReflectionUtil;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
public class BungeeViaInjector implements ViaInjector {
|
||||
@Override
|
||||
public void inject() throws Exception {
|
||||
try {
|
||||
try {
|
||||
ChannelInitializer<Channel> oldInit = PipelineUtils.SERVER_CHILD;
|
||||
ChannelInitializer newInit = new BungeeChannelInitializer(oldInit);
|
||||
|
||||
ReflectionUtil.setStatic(PipelineUtils.class, "SERVER_CHILD", newInit);
|
||||
Class<?> pipelineUtils = Class.forName("net.md_5.bungee.netty.PipelineUtils");
|
||||
Field field = pipelineUtils.getDeclaredField("SERVER_CHILD");
|
||||
field.setAccessible(true);
|
||||
// Remove any final stuff
|
||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
||||
|
||||
BungeeChannelInitializer newInit = new BungeeChannelInitializer((ChannelInitializer<Channel>) field.get(null));
|
||||
field.set(null, newInit);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new Exception("Unable to find core component 'childHandler', please check your plugins. issue: ");
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Via.getPlatform().getLogger().severe("Unable to inject ViaVersion, please post these details on our GitHub and ensure you're using a compatible server version.");
|
||||
|
@ -5,6 +5,9 @@ import us.myles.ViaVersion.api.platform.ViaPlatformLoader;
|
||||
public class BungeeViaLoader implements ViaPlatformLoader {
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
// TODO: Movement Transmitter
|
||||
// TODO: Config
|
||||
// TODO: Platform specific commands
|
||||
// TODO: Get rid of bungeecord-proxy just use reflection
|
||||
}
|
||||
}
|
||||
|
@ -151,10 +151,9 @@ public class WorldPackets {
|
||||
throw new IOException("transformMapChunkBulk returned the wrong object type");
|
||||
|
||||
PacketWrapper output = (PacketWrapper) obj;
|
||||
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
output.setId(-1); // -1 for no writing of id
|
||||
output.writeToBuffer(buffer);
|
||||
|
||||
PacketWrapper chunkPacket = new PacketWrapper(0x21, buffer, wrapper.user());
|
||||
chunkPacket.send(Protocol1_9TO1_8.class, false);
|
||||
}
|
||||
|
@ -31,10 +31,6 @@ public class ReflectionUtil {
|
||||
public static void setStatic(Class<?> clazz, String f, Object value) throws NoSuchFieldException, IllegalAccessException {
|
||||
Field field = clazz.getDeclaredField(f);
|
||||
field.setAccessible(true);
|
||||
// Remove any final stuff
|
||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
||||
field.set(null, value);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user