<commit_before>package com.skelril.aurora;

import com.sk89q.commandbook.CommandBook;
import com.sk89q.worldedit.blocks.BlockID;
import com.zachsthings.libcomponents.ComponentInformation;
import com.zachsthings.libcomponents.bukkit.BukkitComponent;
import org.bukkit.Server;
import org.bukkit.entity.Player;

import java.util.logging.Logger;

/**
 * Author: Turtle9598
 */
@ComponentInformation(friendlyName = "Pumpkin Scuba", desc = "Breath underwater.")
public class PumpkinScubaHelmetComponent extends BukkitComponent implements Runnable {

    private final CommandBook inst = CommandBook.inst();
    private final Logger log = inst.getLogger();
    private final Server server = CommandBook.server();

    @Override
    public void enable() {

        server.getScheduler().scheduleSyncRepeatingTask(inst, this, 0, 40);
    }

    @Override
    public void run() {

        for (Player player : server.getOnlinePlayers()) {
            if (player.getInventory().getHelmet() != null
                    && player.getInventory().getHelmet().getTypeId() == BlockID.PUMPKIN) {
                if (player.getRemainingAir() != player.getMaximumAir()) {
                    player.setRemainingAir(player.getMaximumAir());
                }
            }
        }
    }
}<commit_msg>Optimized the Pumpkin Scuba Helmet component<commit_after>package com.skelril.aurora;

import com.sk89q.commandbook.CommandBook;
import com.sk89q.worldedit.blocks.BlockID;
import com.zachsthings.libcomponents.ComponentInformation;
import com.zachsthings.libcomponents.bukkit.BukkitComponent;
import org.bukkit.Server;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;

import java.util.logging.Logger;

/**
 * Author: Turtle9598
 */
@ComponentInformation(friendlyName = "<NAME>", desc = "Breath underwater.")
public class PumpkinScubaHelmetComponent extends BukkitComponent implements Listener {

    private final CommandBook inst = CommandBook.inst();
    private final Logger log = inst.getLogger();
    private final Server server = CommandBook.server();

    @Override
    public void enable() {

        //noinspection AccessStaticViaInstance
        inst.registerEvents(this);
    }

    @EventHandler(ignoreCancelled = true)
    public void onPlayerDamage(EntityDamageEvent event) {

        Entity e = event.getEntity();
        if (!(e instanceof Player) || !event.getCause().equals(EntityDamageEvent.DamageCause.SUFFOCATION)) return;

        Player player = (Player) e;

        if (player.getInventory().getHelmet() != null && player.getInventory().getHelmet().getTypeId() == BlockID.PUMPKIN) {
            player.setRemainingAir(player.getMaximumAir());
            event.setCancelled(true);
        }
    }
}
{'fraction_non_alphanumeric': 0.11048557353976073, 'fraction_numerical': 0.006685432793807178, 'mean_word_length': 3.6914191419141913, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5662025', 'n_tokens_mistral': 866, 'n_tokens_neox': 815, 'n_words': 162}