@@ -66,56 +66,56 @@ public void intercept(@This Object obj, @AllArguments Object[] allArguments, @Mo
66
66
}
67
67
}
68
68
69
- if (allArguments [0 ] instanceof Integer ) {
70
- var index = (int ) allArguments [0 ];
71
-
72
- if (index > 45 - 5 )
73
- if (allArguments [1 ] != null ) {
74
-
75
- if (this ._setCountMethod == null )
76
- try {
77
- this ._setCountMethod = allArguments [1 ].getClass ().getDeclaredMethod ("setCount" , int .class );
78
- } catch (NoSuchMethodException ignored ) {
79
- }
69
+ if (!(allArguments [0 ] instanceof Integer ))
70
+ return ;
80
71
72
+ var index = (int ) allArguments [0 ];
81
73
74
+ if (index > 45 - 5 )
75
+ if (allArguments [1 ] != null ) {
76
+ if (this ._setCountMethod == null )
82
77
try {
83
- var itemStack = (ItemStack ) this ._asCraftMirrorMethod .invoke (null , allArguments [1 ]);
84
- if (!itemStack .getType ().name ().contains ("AIR" ))
85
- this ._victim .getWorld ()
86
- .dropItem (this ._victim .getEyeLocation ().add (0 , -0.33 , 0 ), itemStack )
87
- .setVelocity (new Vector (0.0 , 0.0 , 0.0 ).add (this ._victim .getLocation ().getDirection ().multiply (0.35 )));
88
- } catch (IllegalAccessException | InvocationTargetException exception ) {
89
- exception .printStackTrace ();
90
- return ;
78
+ this ._setCountMethod = allArguments [1 ].getClass ().getDeclaredMethod ("setCount" , int .class );
79
+ } catch (NoSuchMethodException ignored ) {
91
80
}
92
81
93
- var timer = new Timer ();
94
- timer .schedule (new MyTimerTask (allArguments ), 1000L / 20 );
82
+
83
+ try {
84
+ var itemStack = (ItemStack ) this ._asCraftMirrorMethod .invoke (null , allArguments [1 ]);
85
+ if (!itemStack .getType ().name ().contains ("AIR" ))
86
+ this ._victim .getWorld ()
87
+ .dropItem (this ._victim .getEyeLocation ().add (0 , -0.33 , 0 ), itemStack )
88
+ .setVelocity (new Vector (0.0 , 0.0 , 0.0 ).add (this ._victim .getLocation ().getDirection ().multiply (0.35 )));
89
+ } catch (IllegalAccessException | InvocationTargetException exception ) {
90
+ exception .printStackTrace ();
95
91
return ;
96
92
}
97
93
98
- if (this ._setItemMethod == null )
99
- this ._setItemMethod = Arrays .stream (this ._masterInventoryNms .getClass ().getDeclaredMethods ())
100
- .filter (method1 -> method1 .getName ().equalsIgnoreCase ("setItem" ))
101
- .findFirst ()
102
- .orElse (null );
103
-
104
- if (this ._setItemMethod == null )
105
- for (var declaredMethod : this ._masterInventoryNms .getClass ().getDeclaredMethods ())
106
- if (declaredMethod .getReturnType ().getName ().equalsIgnoreCase (void .class .getName ()))
107
- if (declaredMethod .getParameters ().length == 2 )
108
- if (declaredMethod .getParameters ()[0 ].getType ().getName ().equalsIgnoreCase (int .class .getName ()))
109
- if (declaredMethod .getParameters ()[1 ].getType ().getName ().toLowerCase (Locale .ROOT ).contains ("itemstack" )) {
110
- this ._setItemMethod = declaredMethod ;
111
- break ;
112
- }
113
-
114
- try {
115
- this ._setItemMethod .invoke (this ._masterInventoryNms , allArguments [0 ], allArguments [1 ]);
116
- } catch (IllegalAccessException | InvocationTargetException exception ) {
117
- exception .printStackTrace ();
94
+ var timer = new Timer ();
95
+ timer .schedule (new MyTimerTask (allArguments ), 1000L / 20 );
96
+ return ;
118
97
}
98
+
99
+ if (this ._setItemMethod == null )
100
+ this ._setItemMethod = Arrays .stream (this ._masterInventoryNms .getClass ().getDeclaredMethods ())
101
+ .filter (method1 -> method1 .getName ().equalsIgnoreCase ("setItem" ))
102
+ .findFirst ()
103
+ .orElse (null );
104
+
105
+ if (this ._setItemMethod == null )
106
+ for (var declaredMethod : this ._masterInventoryNms .getClass ().getDeclaredMethods ())
107
+ if (declaredMethod .getReturnType ().getName ().equalsIgnoreCase (void .class .getName ()))
108
+ if (declaredMethod .getParameters ().length == 2 )
109
+ if (declaredMethod .getParameters ()[0 ].getType ().getName ().equalsIgnoreCase (int .class .getName ()))
110
+ if (declaredMethod .getParameters ()[1 ].getType ().getName ().toLowerCase (Locale .ROOT ).contains ("itemstack" )) {
111
+ this ._setItemMethod = declaredMethod ;
112
+ break ;
113
+ }
114
+
115
+ try {
116
+ this ._setItemMethod .invoke (this ._masterInventoryNms , allArguments [0 ], allArguments [1 ]);
117
+ } catch (IllegalAccessException | InvocationTargetException exception ) {
118
+ exception .printStackTrace ();
119
119
}
120
120
}
121
121
@@ -130,7 +130,7 @@ public MyTimerTask(Object... allArguments) {
130
130
public void run () {
131
131
if (InvseeSetItemInterceptor .this ._setCountMethod != null )
132
132
try {
133
- InvseeSetItemInterceptor .this ._setCountMethod .invoke (_allArguments [1 ], 0 );
133
+ InvseeSetItemInterceptor .this ._setCountMethod .invoke (this . _allArguments [1 ], 0 );
134
134
} catch (IllegalAccessException | InvocationTargetException exception ) {
135
135
if (exception instanceof InvocationTargetException ) {
136
136
if (!(exception .getCause () instanceof AssertionError ))
@@ -140,7 +140,7 @@ public void run() {
140
140
}
141
141
142
142
try {
143
- var itemStack = (ItemStack ) InvseeSetItemInterceptor .this ._asCraftMirrorMethod .invoke (null , _allArguments [1 ]);
143
+ var itemStack = (ItemStack ) InvseeSetItemInterceptor .this ._asCraftMirrorMethod .invoke (null , this . _allArguments [1 ]);
144
144
itemStack .setAmount (0 );
145
145
} catch (IllegalAccessException | InvocationTargetException exception ) {
146
146
exception .printStackTrace ();
0 commit comments