From e894a3c73355ea7e16c485d044cf8abd4a00a9bc Mon Sep 17 00:00:00 2001 From: Mats Date: Sat, 19 Mar 2016 21:53:26 +0100 Subject: [PATCH] Remove unnecessary if statement, this is always true. --- .../us/myles/ViaVersion/ViaVersionPlugin.java | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java b/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java index 8e27b6895..5cdbc3796 100644 --- a/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java +++ b/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java @@ -136,33 +136,31 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI { getLogger().warning("We failed to find the ServerConnection? :( What server are you running?"); return; } - if (connection != null) { - for (Field field : connection.getClass().getDeclaredFields()) { - field.setAccessible(true); - final Object value = field.get(connection); - if (value instanceof List) { - // Inject the list - List wrapper = new ListWrapper((List) value) { - @Override - public synchronized void handleAdd(Object o) { - synchronized (this) { - if (o instanceof ChannelFuture) { - inject((ChannelFuture) o); - } - } - } - }; - field.set(connection, wrapper); - // Iterate through current list - synchronized (wrapper) { - for (Object o : (List) value) { + for (Field field : connection.getClass().getDeclaredFields()) { + field.setAccessible(true); + final Object value = field.get(connection); + if (value instanceof List) { + // Inject the list + List wrapper = new ListWrapper((List) value) { + @Override + public synchronized void handleAdd(Object o) { + synchronized (this) { if (o instanceof ChannelFuture) { 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. + } + } } } }