Sets the value stored in a field in the wrapped object @param name The name of the field @param supers The number of superclasses to move up before getting the declared field @param obj The object to set. Will be unwrapped if it is an NMSObject.
(int supers, String name, Object obj)
| 113 | * @param obj The object to set. Will be unwrapped if it is an NMSObject. |
| 114 | */ |
| 115 | public void setField(int supers, String name, Object obj) { |
| 116 | if (obj instanceof NMSObject) { |
| 117 | obj = ((NMSObject) obj).getObject(); |
| 118 | } |
| 119 | try { |
| 120 | Field field = getSuperclass(this.obj.getClass(), supers).getDeclaredField(name); |
| 121 | field.setAccessible(true); |
| 122 | field.set(this.obj, obj); |
| 123 | } catch (IllegalAccessException | NoSuchFieldException e) { |
| 124 | throw new IllegalArgumentException(e); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Sets the value stored in a field in the wrapped object |
nothing calls this directly
no test coverage detected