src/main/java/de/dosmike/sponge/megamenus/AntiGlitch.java
public static void log(Player player, Collection<ItemStackSnapshot> items) {
        Text message;
        {
            Text.Builder builder = Text.builder();
            builder.append(Text.of("Player ", player.getName(), "(", player.getUniqueId().toString(), ") acquired ", items.size(), " glitched items"));
            if (verbose) {
                boolean first = true;

                Set<Text> asText = items.stream().map(i-> {
                    Optional<Text> d = i.get(Keys.DISPLAY_NAME);
                    Optional<Integer> damage = i.toContainer()
                            .get(meta_1_12)
                            .map(o->(Integer)o);

                    Text.Builder item = Text.builder();
                    item.append(Text.of(i.getQuantity(), "x "));
                    if (d.isPresent()) {
                        if (damage.isPresent())
                            item.append(d.get(), Text.of('[', i.getType().getId(), ':', damage.get(), ']'));
                        else
                            item.append(d.get(), Text.of('[', i.getType().getId(), ']'));
                    } else {
                        if (damage.isPresent())
                            item.append(Text.of(i.getType().getId(), ':', damage.get()));
                        else
                            item.append(Text.of(i.getType().getId()));
                    }
                    return item.build();
                }).collect(Collectors.toSet());
                for (Text t : asText) {
                    if (first) {
                        first=false;
                        builder.append(Text.of(": "));
                    } else
                        builder.append(Text.of(", "));
                    builder.append(t);
                }
            }
            builder.color(TextColors.RED);
            message = builder.build();
        }
        MegaMenus.getLogger().error(message.toPlain());
        if (notifAdmins) {
            Sponge.getServer().getOnlinePlayers().stream()
                    .filter(p->p.hasPermission("megamenus.antiglitch.notify"))
                    .forEach(p->p.sendMessage(message));
        }
    }
/**
     * Tells the console and admins that the player glitched the specified items
     */
Tells the console and admins that the player glitched the specified items
Tells the console and admins that the player glitched the specified items
public static void log(Player player, Collection<ItemStackSnapshot> items) {
        Text message;
        {
            Text.Builder builder = Text.builder();
            builder.append(Text.of("Player ", player.getName(), "(", player.getUniqueId().toString(), ") acquired ", items.size(), " glitched items"));
            if (verbose) {
                boolean first = true;
                Set<Text> asText = items.stream().map(i-> {
                    Optional<Text> d = i.get(Keys.DISPLAY_NAME);
                    Optional<Integer> damage = i.toContainer()
                            .get(meta_1_12)
                            .map(o->(Integer)o);
                    Text.Builder item = Text.builder();
                    item.append(Text.of(i.getQuantity(), "x "));
                    if (d.isPresent()) {
                        if (damage.isPresent())
                            item.append(d.get(), Text.of('[', i.getType().getId(), ':', damage.get(), ']'));
                        else
                            item.append(d.get(), Text.of('[', i.getType().getId(), ']'));
                    } else {
                        if (damage.isPresent())
                            item.append(Text.of(i.getType().getId(), ':', damage.get()));
                        else
                            item.append(Text.of(i.getType().getId()));
                    }
                    return item.build();
                }).collect(Collectors.toSet());
                for (Text t : asText) {
                    if (first) {
                        first=false;
                        builder.append(Text.of(": "));
                    } else
                        builder.append(Text.of(", "));
                    builder.append(t);
                }
            }
            builder.color(TextColors.RED);
            message = builder.build();
        }
        MegaMenus.getLogger().error(message.toPlain());
        if (notifAdmins) {
            Sponge.getServer().getOnlinePlayers().stream()
                    .filter(p->p.hasPermission("megamenus.antiglitch.notify"))
                    .forEach(p->p.sendMessage(message));
        }
    }
public static void log ( Player player , Collection < ItemStackSnapshot > items ) { Text message ; { Text . Builder builder = Text . builder ( ) ; builder . append ( Text . of ( "Player " , player . getName ( ) , "(" , player . getUniqueId ( ) . toString ( ) , ") acquired " , items . size ( ) , " glitched items" ) ) ; if ( verbose ) { boolean first = true ; Set < Text > asText = items . stream ( ) . map ( i -> { Optional < Text > d = i . get ( Keys . DISPLAY_NAME ) ; Optional < Integer > damage = i . toContainer ( ) . get ( meta_1_12 ) . map ( o -> ( Integer ) o ) ; Text . Builder item = Text . builder ( ) ; item . append ( Text . of ( i . getQuantity ( ) , "x " ) ) ; if ( d . isPresent ( ) ) { if ( damage . isPresent ( ) ) item . append ( d . get ( ) , Text . of ( '[' , i . getType ( ) . getId ( ) , ':' , damage . get ( ) , ']' ) ) ; else item . append ( d . get ( ) , Text . of ( '[' , i . getType ( ) . getId ( ) , ']' ) ) ; } else { if ( damage . isPresent ( ) ) item . append ( Text . of ( i . getType ( ) . getId ( ) , ':' , damage . get ( ) ) ) ; else item . append ( Text . of ( i . getType ( ) . getId ( ) ) ) ; } return item . build ( ) ; } ) . collect ( Collectors . toSet ( ) ) ; for ( Text t : asText ) { if ( first ) { first = false ; builder . append ( Text . of ( ": " ) ) ; } else builder . append ( Text . of ( ", " ) ) ; builder . append ( t ) ; } } builder . color ( TextColors . RED ) ; message = builder . build ( ) ; } MegaMenus . getLogger ( ) . error ( message . toPlain ( ) ) ; if ( notifAdmins ) { Sponge . getServer ( ) . getOnlinePlayers ( ) . stream ( ) . filter ( p -> p . hasPermission ( "megamenus.antiglitch.notify" ) ) . forEach ( p -> p . sendMessage ( message ) ) ; } }
Tells the console and admins that the player glitched the specified items
Tells the console and admins that the player glitched the specified items