3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Merge branch 'master' into apiv2

Dieser Commit ist enthalten in:
Myles 2016-03-19 22:05:57 +00:00
Commit d152b8b9e1
2 geänderte Dateien mit 23 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -181,33 +181,31 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
getLogger().warning("We failed to find the ServerConnection? :( What server are you running?"); getLogger().warning("We failed to find the ServerConnection? :( What server are you running?");
return; return;
} }
if (connection != null) { for (Field field : connection.getClass().getDeclaredFields()) {
for (Field field : connection.getClass().getDeclaredFields()) { field.setAccessible(true);
field.setAccessible(true); final Object value = field.get(connection);
final Object value = field.get(connection); if (value instanceof List) {
if (value instanceof List) { // Inject the list
// Inject the list List wrapper = new ListWrapper((List) value) {
List wrapper = new ListWrapper((List) value) { @Override
@Override public synchronized void handleAdd(Object o) {
public synchronized void handleAdd(Object o) { synchronized (this) {
synchronized (this) {
if (o instanceof ChannelFuture) {
inject((ChannelFuture) o);
}
}
}
};
field.set(connection, wrapper);
// Iterate through current list
synchronized (wrapper) {
for (Object o : (List) value) {
if (o instanceof ChannelFuture) { if (o instanceof ChannelFuture) {
inject((ChannelFuture) o); inject((ChannelFuture) o);
} else {
break; // not the right list.
} }
} }
} }
};
field.set(connection, wrapper);
// Iterate through current list
synchronized (wrapper) {
for (Object o : (List) value) {
if (o instanceof ChannelFuture) {
inject((ChannelFuture) o);
} else {
break; // not the right list.
}
}
} }
} }
} }

Datei anzeigen

@ -54,7 +54,9 @@ public class ViaDecodeHandler extends ByteToMessageDecoder {
throw (Exception) e.getCause(); throw (Exception) e.getCause();
} }
} finally { } finally {
bytebuf.release(); if (info.isActive()) {
bytebuf.release();
}
} }
} }
} }