File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed
src/main/java/pro/cloudnode/smp/bankaccounts Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change 3030import java .util .Optional ;
3131import java .util .UUID ;
3232import java .util .logging .Level ;
33- import java .util .stream .IntStream ;
3433import java .util .zip .CRC32 ;
3534
3635public final class POS {
@@ -374,26 +373,18 @@ public static void openBuyGui(final @NotNull Player player, final @NotNull Chest
374373 return Arrays .stream (items ).sorted (Comparator .comparing (ItemStack ::translationKey )).sorted (Comparator .comparing (ItemStack ::getAmount )).map (POS ::checksum ).toArray (String []::new );
375374 }
376375
377- /**
378- * Verify checksum
379- *
380- * @param item The item to verify
381- * @param checksum The checksum to verify against
382- */
383- public static boolean verifyChecksum (final @ NotNull ItemStack item , final @ NotNull String checksum ) {
384- return checksum (item ).equals (checksum );
385- }
386-
387376 /**
388377 * Verify checksums
389378 *
390379 * @param items The items to verify
391380 * @param checksums The checksums to verify against
392381 */
393382 public static boolean verifyChecksum (final @ NotNull ItemStack @ NotNull [] items , final @ NotNull String @ NotNull [] checksums ) {
394- if (items .length != checksums .length )
395- throw new IllegalArgumentException ("The number of items and checksums must be the same." );
396-
397- return IntStream .range (0 , items .length ).allMatch (i -> verifyChecksum (items [i ], checksums [i ]));
383+ if (items .length != checksums .length ) return false ;
384+ final @ NotNull String @ NotNull [] itemChecksums = checksum (items );
385+ return Arrays .equals (
386+ Arrays .stream (itemChecksums ).sorted ().toArray (String []::new ),
387+ Arrays .stream (checksums ).sorted ().toArray (String []::new )
388+ );
398389 }
399390}
You can’t perform that action at this time.
0 commit comments