From c7737ca96e424b5d0bded56ce6565bd795ac7398 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Wed, 27 Feb 2013 01:10:21 +0100 Subject: [PATCH] It's an injector container. --- .../injector/server/AbstractInputStreamLookup.java | 4 ++-- ...InjectContainer.java => InjectorContainer.java} | 2 +- .../injector/server/TemporaryPlayerFactory.java | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) rename ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/{InjectContainer.java => InjectorContainer.java} (94%) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/AbstractInputStreamLookup.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/AbstractInputStreamLookup.java index b7b88d6b..eef3275d 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/AbstractInputStreamLookup.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/AbstractInputStreamLookup.java @@ -110,8 +110,8 @@ public abstract class AbstractInputStreamLookup { Player player = previous.getPlayer(); // Default implementation - if (player instanceof InjectContainer) { - InjectContainer container = (InjectContainer) player; + if (player instanceof InjectorContainer) { + InjectorContainer container = (InjectorContainer) player; container.setInjector(current); } } diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/InjectContainer.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/InjectorContainer.java similarity index 94% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/InjectContainer.java rename to ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/InjectorContainer.java index 7d3738df..7a642a09 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/InjectContainer.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/InjectorContainer.java @@ -6,7 +6,7 @@ package com.comphenix.protocol.injector.server; * A necessary hack. * @author Kristian */ -class InjectContainer { +class InjectorContainer { private volatile SocketInjector injector; public SocketInjector getInjector() { diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/TemporaryPlayerFactory.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/TemporaryPlayerFactory.java index 0e6b4f15..91d1fed6 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/TemporaryPlayerFactory.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/server/TemporaryPlayerFactory.java @@ -53,8 +53,8 @@ public class TemporaryPlayerFactory { * @return The referenced player injector, or NULL if none can be found. */ public static SocketInjector getInjectorFromPlayer(Player player) { - if (player instanceof InjectContainer) { - return ((InjectContainer) player).getInjector(); + if (player instanceof InjectorContainer) { + return ((InjectorContainer) player).getInjector(); } return null; } @@ -65,7 +65,7 @@ public class TemporaryPlayerFactory { * @param injector - the injector to store. */ public static void setInjectorInPlayer(Player player, SocketInjector injector) { - ((InjectContainer) player).setInjector(injector); + ((InjectorContainer) player).setInjector(injector); } /** @@ -96,7 +96,7 @@ public class TemporaryPlayerFactory { public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { String methodName = method.getName(); - SocketInjector injector = ((InjectContainer) obj).getInjector(); + SocketInjector injector = ((InjectorContainer) obj).getInjector(); if (injector == null) throw new IllegalStateException("Unable to find injector."); @@ -149,7 +149,7 @@ public class TemporaryPlayerFactory { public int accept(Method method) { // Do not override the object method or the superclass methods if (method.getDeclaringClass().equals(Object.class) || - method.getDeclaringClass().equals(InjectContainer.class)) + method.getDeclaringClass().equals(InjectorContainer.class)) return 0; else return 1; @@ -159,7 +159,7 @@ public class TemporaryPlayerFactory { // CGLib is amazing Enhancer ex = new Enhancer(); - ex.setSuperclass(InjectContainer.class); + ex.setSuperclass(InjectorContainer.class); ex.setInterfaces(new Class[] { Player.class }); ex.setCallbacks(new Callback[] { NoOp.INSTANCE, implementation }); ex.setCallbackFilter(callbackFilter); @@ -176,7 +176,7 @@ public class TemporaryPlayerFactory { public Player createTemporaryPlayer(Server server, SocketInjector injector) { Player temporary = createTemporaryPlayer(server); - ((InjectContainer) temporary).setInjector(injector); + ((InjectorContainer) temporary).setInjector(injector); return temporary; }