(Object proxy, Method method, Object[] args)
| 48 | private T instance = entity; |
| 49 | |
| 50 | @Override |
| 51 | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { |
| 52 | if (!instance.isValid()) { |
| 53 | T replace = (T) Bukkit.getEntity(instance.getUniqueId()); |
| 54 | if (replace != null) { |
| 55 | instance = replace; |
| 56 | } |
| 57 | } |
| 58 | if (method.getName().equals("equals") && method.getParameters().length == 1 && method.getParameters()[0].getName().equals("Object")) { |
| 59 | if (args[0] instanceof Entity) { |
| 60 | return ((Entity) args[0]).getUniqueId().equals(instance.getUniqueId()); |
| 61 | } |
| 62 | return false; |
| 63 | } |
| 64 | return method.invoke(instance, args); |
| 65 | } |
| 66 | |
| 67 | }); |
| 68 | } |
no test coverage detected