@@ -77,24 +77,18 @@ public Boolean runAsync() {
77
77
78
78
@ Override
79
79
public Mixed exec (Target t , Environment environment , Mixed ... args ) throws ConfigRuntimeException {
80
- MCPlayer p = environment . getEnv ( CommandHelperEnvironment . class ). GetPlayer () ;
80
+ MCPlayer p ;
81
81
MCItemStack is ;
82
82
Mixed slot ;
83
83
if (args .length == 2 ) {
84
84
p = Static .GetPlayer (args [0 ], t );
85
85
slot = args [1 ];
86
86
} else {
87
+ p = environment .getEnv (CommandHelperEnvironment .class ).GetPlayer ();
88
+ Static .AssertPlayerNonNull (p , t );
87
89
slot = args [0 ];
88
90
}
89
- Static .AssertPlayerNonNull (p , t );
90
- if (slot instanceof CNull ) {
91
- is = p .getItemAt (null );
92
- } else {
93
- is = p .getItemAt (ArgumentValidation .getInt32 (slot , t ));
94
- }
95
- if (is == null ) {
96
- throw new CRECastException ("There is no item at slot " + slot , t );
97
- }
91
+ is = p .getItemAt (slot instanceof CNull ? null : ArgumentValidation .getInt32 (slot , t ));
98
92
return ObjectGenerator .GetGenerator ().itemMeta (is , t );
99
93
}
100
94
@@ -186,7 +180,7 @@ public Boolean runAsync() {
186
180
187
181
@ Override
188
182
public Mixed exec (Target t , Environment environment , Mixed ... args ) throws ConfigRuntimeException {
189
- MCPlayer p = environment . getEnv ( CommandHelperEnvironment . class ). GetPlayer () ;
183
+ MCPlayer p ;
190
184
Mixed slot ;
191
185
Mixed meta ;
192
186
MCItemStack is ;
@@ -195,15 +189,12 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
195
189
slot = args [1 ];
196
190
meta = args [2 ];
197
191
} else {
192
+ p = environment .getEnv (CommandHelperEnvironment .class ).GetPlayer ();
193
+ Static .AssertPlayerNonNull (p , t );
198
194
slot = args [0 ];
199
195
meta = args [1 ];
200
196
}
201
- Static .AssertPlayerNonNull (p , t );
202
- if (slot instanceof CNull ) {
203
- is = p .getItemAt (null );
204
- } else {
205
- is = p .getItemAt (ArgumentValidation .getInt32 (slot , t ));
206
- }
197
+ is = p .getItemAt (slot instanceof CNull ? null : ArgumentValidation .getInt32 (slot , t ));
207
198
if (is == null ) {
208
199
throw new CRECastException ("There is no item at slot " + slot , t );
209
200
}
@@ -441,16 +432,21 @@ public Boolean runAsync() {
441
432
442
433
@ Override
443
434
public Mixed exec (Target t , Environment environment , Mixed ... args ) throws ConfigRuntimeException {
444
- MCPlayer p = environment . getEnv ( CommandHelperEnvironment . class ). GetPlayer () ;
445
- int slot ;
435
+ MCPlayer p ;
436
+ Mixed slot ;
446
437
if (args .length == 2 ) {
447
438
p = Static .GetPlayer (args [0 ], t );
448
- slot = ArgumentValidation . getInt32 ( args [1 ], t ) ;
439
+ slot = args [1 ];
449
440
} else {
450
- slot = ArgumentValidation .getInt32 (args [0 ], t );
441
+ p = environment .getEnv (CommandHelperEnvironment .class ).GetPlayer ();
442
+ Static .AssertPlayerNonNull (p , t );
443
+ slot = args [0 ];
451
444
}
452
- Static .AssertPlayerNonNull (p , t );
453
- return CBoolean .get (p .getItemAt (slot ).getItemMeta () instanceof MCLeatherArmorMeta );
445
+ MCItemStack is = p .getItemAt (slot instanceof CNull ? null : ArgumentValidation .getInt32 (slot , t ));
446
+ if (is == null ) {
447
+ return CBoolean .FALSE ;
448
+ }
449
+ return CBoolean .get (is .getItemMeta () instanceof MCLeatherArmorMeta );
454
450
}
455
451
456
452
@ Override
0 commit comments