Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import io.netty.channel.ChannelDuplexHandler;
- import io.netty.channel.ChannelFuture;
- import io.netty.channel.ChannelHandlerContext;
- import io.netty.channel.ChannelPromise;
- import java.io.PrintStream;
- import java.lang.reflect.Field;
- import java.lang.reflect.InvocationTargetException;
- import java.lang.reflect.Method;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import java.util.Set;
- import me.bigteddy98.bannerboard.Main;
- import me.bigteddy98.bannerboard.d91da;
- import me.bigteddy98.bannerboard.db;
- import org.bukkit.Bukkit;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.scheduler.BukkitTask;
- public final class b28
- extends ChannelDuplexHandler {
- private static Field e907;
- private static Method c;
- private static Class b28;
- private static Field db;
- private static final Field d07;
- private static final Class c8f92;
- private static final Field fed;
- private static final Field dac4d;
- private static final Method ea7fc;
- private static final Class cf79b;
- private static final Class d5bd;
- private static final Field d1ec;
- private final Object de2 = new Object();
- private final Map cb1a1 = new HashMap();
- private final Set c020 = new HashSet();
- private ChannelHandlerContext b77;
- private final Object a087 = new Object();
- /*
- * WARNING - Removed try catching itself - possible behaviour change.
- */
- public final void write(ChannelHandlerContext channelHandlerContext, Object iterator, ChannelPromise object) {
- block22 : {
- try {
- short s;
- Object object2 = this.a087;
- synchronized (object2) {
- this.b77 = channelHandlerContext;
- this.a087.notifyAll();
- }
- if (d5bd.isInstance(iterator) && this.c020.contains(s = (short)((Integer)d1ec.get(iterator)).intValue())) {
- return;
- }
- super.write(channelHandlerContext, (Object)iterator, (ChannelPromise)object);
- if (cf79b.isInstance(iterator)) {
- Short s2;
- block21 : {
- object = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
- if (object.equals("v1_11_R1") || object.equals("v1_12_R1")) {
- iterator = (List)d07.get(iterator);
- iterator = iterator.iterator();
- while (iterator.hasNext()) {
- String string;
- object = iterator.next();
- if (!c8f92.isInstance(object = e907.get(object))) continue;
- object2 = (short)((Integer)fed.get(object)).intValue();
- if ((object = dac4d.get(object)) == null || !(string = (String)ea7fc.invoke(object, new Object[0])).equalsIgnoreCase("item.map")) continue;
- s2 = (short)object2;
- break block21;
- }
- s2 = null;
- } else if (object.startsWith("v1_9_") || object.equals("v1_10_R1")) {
- iterator = (List)d07.get(iterator);
- iterator = iterator.iterator();
- while (iterator.hasNext()) {
- Object object3;
- object = iterator.next();
- if (!b28.isInstance(object = e907.get(object)) || !c8f92.isInstance(object3 = c.invoke(object, new Object[0]))) continue;
- short s3 = (short)((Integer)fed.get(object3)).intValue();
- String string = (String)ea7fc.invoke(dac4d.get(object3), new Object[0]);
- if (!string.equalsIgnoreCase("item.map")) continue;
- s2 = s3;
- break block21;
- }
- s2 = null;
- } else if (object.startsWith("v1_8_")) {
- iterator = (List)d07.get(iterator);
- iterator = iterator.iterator();
- while (iterator.hasNext()) {
- object = iterator.next();
- if (!c8f92.isInstance(object = db.get(object))) continue;
- object2 = (short)((Integer)fed.get(object)).intValue();
- if (!(object = (String)ea7fc.invoke(dac4d.get(object), new Object[0])).equalsIgnoreCase("item.map")) continue;
- s2 = (short)object2;
- break block21;
- }
- s2 = null;
- } else {
- throw new RuntimeException("Unknown version " + (String)object);
- }
- }
- Short s4 = s2;
- if (s2 != null) {
- iterator = this.de2;
- synchronized (iterator) {
- if (this.c020.contains(s4) && (object = this.cb1a1.get(s4)) != null) {
- channelHandlerContext.write(object);
- }
- break block22;
- }
- }
- }
- return;
- }
- catch (Throwable throwable) {
- Throwable throwable2 = throwable;
- throwable.printStackTrace();
- }
- }
- }
- private static Short e907(Object iterator) {
- Object object = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
- if (object.equals("v1_11_R1") || object.equals("v1_12_R1")) {
- iterator = (List)d07.get(iterator);
- iterator = iterator.iterator();
- while (iterator.hasNext()) {
- String string;
- object = iterator.next();
- if (!c8f92.isInstance(object = e907.get(object))) continue;
- short s = (short)((Integer)fed.get(object)).intValue();
- if ((object = dac4d.get(object)) == null || !(string = (String)ea7fc.invoke(object, new Object[0])).equalsIgnoreCase("item.map")) continue;
- return s;
- }
- return null;
- }
- if (object.startsWith("v1_9_") || object.equals("v1_10_R1")) {
- iterator = (List)d07.get(iterator);
- iterator = iterator.iterator();
- while (iterator.hasNext()) {
- Object object2;
- object = iterator.next();
- if (!b28.isInstance(object = e907.get(object)) || !c8f92.isInstance(object2 = c.invoke(object, new Object[0]))) continue;
- short s = (short)((Integer)fed.get(object2)).intValue();
- String string = (String)ea7fc.invoke(dac4d.get(object2), new Object[0]);
- if (!string.equalsIgnoreCase("item.map")) continue;
- return s;
- }
- return null;
- }
- if (object.startsWith("v1_8_")) {
- iterator = (List)d07.get(iterator);
- iterator = iterator.iterator();
- while (iterator.hasNext()) {
- object = iterator.next();
- if (!c8f92.isInstance(object = db.get(object))) continue;
- short s = (short)((Integer)fed.get(object)).intValue();
- if (!(object = (String)ea7fc.invoke(dac4d.get(object), new Object[0])).equalsIgnoreCase("item.map")) continue;
- return s;
- }
- return null;
- }
- throw new RuntimeException("Unknown version " + (String)object);
- }
- /*
- * WARNING - Removed try catching itself - possible behaviour change.
- */
- public final void e907(short s, byte[] object) {
- try {
- Object object2 = this.de2;
- synchronized (object2) {
- object = d91da.e907(s, (byte[])object);
- this.cb1a1.put(s, object);
- new db(this, object).runTaskAsynchronously((Plugin)Main.e907());
- }
- }
- catch (IllegalAccessException | IllegalArgumentException | InstantiationException | InvocationTargetException exception) {
- Exception exception2 = exception;
- exception.printStackTrace();
- }
- }
- /*
- * WARNING - Removed try catching itself - possible behaviour change.
- */
- public final void e907() {
- Object object = this.de2;
- synchronized (object) {
- this.cb1a1.clear();
- return;
- }
- }
- /*
- * WARNING - Removed try catching itself - possible behaviour change.
- */
- public final void e907(short s) {
- Object object = this.de2;
- synchronized (object) {
- this.c020.add(s);
- return;
- }
- }
- static /* synthetic */ Object e907(b28 b282) {
- return b282.a087;
- }
- static /* synthetic */ ChannelHandlerContext c(b28 b282) {
- return b282.b77;
- }
- static {
- try {
- String string = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
- if (string.startsWith("v1_9_") || string.equals("v1_10_R1") || string.equals("v1_11_R1") || string.equals("v1_12_R1")) {
- e907 = d91da.e907("DataWatcher$Item").getDeclaredField("b");
- e907.setAccessible(true);
- b28 = Class.forName("com.google.common.base.Present");
- c = Class.forName("com.google.common.base.Optional").getMethod("get", new Class[0]);
- }
- if (string.startsWith("v1_8_")) {
- try {
- db = d91da.e907("DataWatcher$WatchableObject").getDeclaredField("c");
- db.setAccessible(true);
- }
- catch (ClassNotFoundException classNotFoundException) {
- db = d91da.e907("WatchableObject").getDeclaredField("c");
- db.setAccessible(true);
- }
- }
- d07 = d91da.e907("PacketPlayOutEntityMetadata").getDeclaredField("b");
- d07.setAccessible(true);
- c8f92 = d91da.e907("ItemStack");
- fed = d91da.e907("ItemStack").getDeclaredField("damage");
- fed.setAccessible(true);
- dac4d = d91da.e907("ItemStack").getDeclaredField("item");
- dac4d.setAccessible(true);
- ea7fc = d91da.e907("Item").getMethod("getName", new Class[0]);
- cf79b = d91da.e907("PacketPlayOutEntityMetadata");
- d5bd = d91da.e907("PacketPlayOutMap");
- d1ec = d5bd.getDeclaredField("a");
- d1ec.setAccessible(true);
- return;
- }
- catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException | SecurityException exception) {
- System.out.println("The Error:");
- exception.printStackTrace();
- throw new RuntimeException(exception);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement