mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-11-12 10:23:59 +01:00
Fixed dummy connection objects being private causing reflection-access to not work (#28)
This commit is contained in:
parent
cebeae9690
commit
a787fdd72a
@ -69,7 +69,21 @@ public final class ChunkLoaderNPC_v1_12_R1 extends EntityPlayer implements Chunk
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class DummyNetworkManager extends NetworkManager{
|
||||
public static class DummyNetworkManager extends NetworkManager{
|
||||
|
||||
private static Field channelField;
|
||||
private static Field socketAddressField;
|
||||
|
||||
static {
|
||||
try {
|
||||
channelField = NetworkManager.class.getDeclaredField("channel");
|
||||
channelField.setAccessible(true);
|
||||
socketAddressField = NetworkManager.class.getDeclaredField("l");
|
||||
socketAddressField.setAccessible(true);
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
DummyNetworkManager(){
|
||||
super(EnumProtocolDirection.SERVERBOUND);
|
||||
@ -78,23 +92,21 @@ public final class ChunkLoaderNPC_v1_12_R1 extends EntityPlayer implements Chunk
|
||||
|
||||
private void updateFields() {
|
||||
try {
|
||||
Field channelField = NetworkManager.class.getDeclaredField("channel");
|
||||
channelField.setAccessible(true);
|
||||
channelField.set(this, new DummyChannel());
|
||||
channelField.setAccessible(false);
|
||||
if (channelField != null) {
|
||||
channelField.set(this, new DummyChannel());
|
||||
}
|
||||
|
||||
Field socketAddressField = NetworkManager.class.getDeclaredField("l");
|
||||
socketAddressField.setAccessible(true);
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
catch (NoSuchFieldException|SecurityException|IllegalArgumentException|IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
if (socketAddressField != null) {
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class DummyPlayerConnection extends PlayerConnection {
|
||||
public static class DummyPlayerConnection extends PlayerConnection {
|
||||
|
||||
DummyPlayerConnection(MinecraftServer minecraftServer, EntityPlayer entityPlayer) {
|
||||
super(minecraftServer, new DummyNetworkManager(), entityPlayer);
|
||||
|
@ -71,7 +71,21 @@ public final class ChunkLoaderNPC_v1_15_R1 extends EntityPlayer implements Chunk
|
||||
return getBukkitEntity().getLocation();
|
||||
}
|
||||
|
||||
private static class DummyNetworkManager extends NetworkManager{
|
||||
public static class DummyNetworkManager extends NetworkManager{
|
||||
|
||||
private static Field channelField;
|
||||
private static Field socketAddressField;
|
||||
|
||||
static {
|
||||
try {
|
||||
channelField = NetworkManager.class.getDeclaredField("channel");
|
||||
channelField.setAccessible(true);
|
||||
socketAddressField = NetworkManager.class.getDeclaredField("socketAddress");
|
||||
socketAddressField.setAccessible(true);
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
DummyNetworkManager(){
|
||||
super(EnumProtocolDirection.SERVERBOUND);
|
||||
@ -80,23 +94,21 @@ public final class ChunkLoaderNPC_v1_15_R1 extends EntityPlayer implements Chunk
|
||||
|
||||
private void updateFields() {
|
||||
try {
|
||||
Field channelField = NetworkManager.class.getDeclaredField("channel");
|
||||
channelField.setAccessible(true);
|
||||
channelField.set(this, new DummyChannel());
|
||||
channelField.setAccessible(false);
|
||||
if (channelField != null) {
|
||||
channelField.set(this, new DummyChannel());
|
||||
}
|
||||
|
||||
Field socketAddressField = NetworkManager.class.getDeclaredField("socketAddress");
|
||||
socketAddressField.setAccessible(true);
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
catch (NoSuchFieldException|SecurityException|IllegalArgumentException|IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
if (socketAddressField != null) {
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class DummyPlayerConnection extends PlayerConnection {
|
||||
public static class DummyPlayerConnection extends PlayerConnection {
|
||||
|
||||
DummyPlayerConnection(MinecraftServer minecraftServer, EntityPlayer entityPlayer) {
|
||||
super(minecraftServer, new DummyNetworkManager(), entityPlayer);
|
||||
|
@ -82,7 +82,21 @@ public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements Chunk
|
||||
entityPlayer.shouldBeRemoved = true;
|
||||
}
|
||||
|
||||
private static class DummyNetworkManager extends NetworkManager{
|
||||
public static class DummyNetworkManager extends NetworkManager{
|
||||
|
||||
private static Field channelField;
|
||||
private static Field socketAddressField;
|
||||
|
||||
static {
|
||||
try {
|
||||
channelField = NetworkManager.class.getDeclaredField("channel");
|
||||
channelField.setAccessible(true);
|
||||
socketAddressField = NetworkManager.class.getDeclaredField("socketAddress");
|
||||
socketAddressField.setAccessible(true);
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
DummyNetworkManager(){
|
||||
super(EnumProtocolDirection.SERVERBOUND);
|
||||
@ -91,23 +105,21 @@ public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements Chunk
|
||||
|
||||
private void updateFields() {
|
||||
try {
|
||||
Field channelField = NetworkManager.class.getDeclaredField("channel");
|
||||
channelField.setAccessible(true);
|
||||
channelField.set(this, new DummyChannel());
|
||||
channelField.setAccessible(false);
|
||||
if (channelField != null) {
|
||||
channelField.set(this, new DummyChannel());
|
||||
}
|
||||
|
||||
Field socketAddressField = NetworkManager.class.getDeclaredField("socketAddress");
|
||||
socketAddressField.setAccessible(true);
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
catch (NoSuchFieldException|SecurityException|IllegalArgumentException|IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
if (socketAddressField != null) {
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class DummyPlayerConnection extends PlayerConnection {
|
||||
public static class DummyPlayerConnection extends PlayerConnection {
|
||||
|
||||
DummyPlayerConnection(MinecraftServer minecraftServer, EntityPlayer entityPlayer) {
|
||||
super(minecraftServer, new DummyNetworkManager(), entityPlayer);
|
||||
|
@ -76,7 +76,7 @@ public final class ChunkLoaderNPC_v1_17_R1 extends EntityPlayer implements Chunk
|
||||
worldServer.a(entityPlayer, RemovalReason.d);
|
||||
}
|
||||
|
||||
private static class DummyNetworkManager extends NetworkManager {
|
||||
public static class DummyNetworkManager extends NetworkManager {
|
||||
|
||||
DummyNetworkManager(){
|
||||
super(EnumProtocolDirection.a);
|
||||
@ -86,7 +86,7 @@ public final class ChunkLoaderNPC_v1_17_R1 extends EntityPlayer implements Chunk
|
||||
|
||||
}
|
||||
|
||||
private static class DummyPlayerConnection extends PlayerConnection {
|
||||
public static class DummyPlayerConnection extends PlayerConnection {
|
||||
|
||||
DummyPlayerConnection(MinecraftServer minecraftServer, EntityPlayer entityPlayer) {
|
||||
super(minecraftServer, new DummyNetworkManager(), entityPlayer);
|
||||
|
@ -71,7 +71,21 @@ public final class ChunkLoaderNPC_v1_7_R4 extends EntityPlayer implements ChunkL
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class DummyNetworkManager extends NetworkManager {
|
||||
public static class DummyNetworkManager extends NetworkManager {
|
||||
|
||||
private static Field channelField;
|
||||
private static Field socketAddressField;
|
||||
|
||||
static {
|
||||
try {
|
||||
channelField = NetworkManager.class.getDeclaredField("m");
|
||||
channelField.setAccessible(true);
|
||||
socketAddressField = NetworkManager.class.getDeclaredField("n");
|
||||
socketAddressField.setAccessible(true);
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
DummyNetworkManager(){
|
||||
super(false);
|
||||
@ -80,23 +94,21 @@ public final class ChunkLoaderNPC_v1_7_R4 extends EntityPlayer implements ChunkL
|
||||
|
||||
private void updateFields() {
|
||||
try {
|
||||
Field channelField = NetworkManager.class.getDeclaredField("m");
|
||||
channelField.setAccessible(true);
|
||||
channelField.set(this, new DummyChannel());
|
||||
channelField.setAccessible(false);
|
||||
if (channelField != null) {
|
||||
channelField.set(this, new DummyChannel());
|
||||
}
|
||||
|
||||
Field socketAddressField = NetworkManager.class.getDeclaredField("n");
|
||||
socketAddressField.setAccessible(true);
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
catch (NoSuchFieldException|SecurityException|IllegalArgumentException|IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
if (socketAddressField != null) {
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class DummyPlayerConnection extends PlayerConnection {
|
||||
public static class DummyPlayerConnection extends PlayerConnection {
|
||||
|
||||
DummyPlayerConnection(MinecraftServer minecraftServer, EntityPlayer entityPlayer) {
|
||||
super(minecraftServer, new DummyNetworkManager(), entityPlayer);
|
||||
|
@ -71,7 +71,21 @@ public final class ChunkLoaderNPC_v1_8_R3 extends EntityPlayer implements ChunkL
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class DummyNetworkManager extends NetworkManager{
|
||||
public static class DummyNetworkManager extends NetworkManager {
|
||||
|
||||
private static Field channelField;
|
||||
private static Field socketAddressField;
|
||||
|
||||
static {
|
||||
try {
|
||||
channelField = NetworkManager.class.getDeclaredField("channel");
|
||||
channelField.setAccessible(true);
|
||||
socketAddressField = NetworkManager.class.getDeclaredField("l");
|
||||
socketAddressField.setAccessible(true);
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
DummyNetworkManager(){
|
||||
super(EnumProtocolDirection.SERVERBOUND);
|
||||
@ -80,23 +94,21 @@ public final class ChunkLoaderNPC_v1_8_R3 extends EntityPlayer implements ChunkL
|
||||
|
||||
private void updateFields() {
|
||||
try {
|
||||
Field channelField = NetworkManager.class.getDeclaredField("channel");
|
||||
channelField.setAccessible(true);
|
||||
channelField.set(this, new DummyChannel());
|
||||
channelField.setAccessible(false);
|
||||
if (channelField != null) {
|
||||
channelField.set(this, new DummyChannel());
|
||||
}
|
||||
|
||||
Field socketAddressField = NetworkManager.class.getDeclaredField("l");
|
||||
socketAddressField.setAccessible(true);
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
catch (NoSuchFieldException|SecurityException|IllegalArgumentException|IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
if (socketAddressField != null) {
|
||||
socketAddressField.set(this, null);
|
||||
}
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class DummyPlayerConnection extends PlayerConnection {
|
||||
public static class DummyPlayerConnection extends PlayerConnection {
|
||||
|
||||
DummyPlayerConnection(MinecraftServer minecraftServer, EntityPlayer entityPlayer) {
|
||||
super(minecraftServer, new DummyNetworkManager(), entityPlayer);
|
||||
|
Loading…
Reference in New Issue
Block a user