<commit_before>/*
 * PermissionsEx - Permissions plugin for Bukkit
 * Copyright (C) 2011 t3hk0d3 http://www.tehkode.ru
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package ru.tehkode.permissions.bukkit.superperms;

import java.lang.reflect.Field;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible;
import org.bukkit.permissions.PermissibleBase;
import org.bukkit.permissions.Permission;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;

public class PermissiblePEX extends PermissibleBase {

    protected Player player = null;
    protected boolean strictMode = false;

    protected PermissiblePEX(Player opable, boolean disableUnmatched) {
        super(opable);

        this.strictMode = disableUnmatched;
        this.player = opable;
    }

    public static void inject(Player player, boolean strictMode) {
        if (player.hasPermission("permissionsex.handler.injected")) { // already injected
            Logger.getLogger("Minecraft").info("[PermissionsEx] Already injected ======================");
            return;
        }

        try {
            Permissible permissible = new PermissiblePEX(player, strictMode);
            
            if (player.getClass().getName().contains("Spout")) { // we have spout installed
                Logger.getLogger("Minecraft").warning("[PermissionsEx] Spout server plugin detected. Taking additional measures.");
                injectSpout(player, permissible);
            } else {
                injectCraftBukkit(player, permissible);
            }
            
            permissible.recalculatePermissions();

            Logger.getLogger("Minecraft").info("[PermissionsEx] Permissions handler for " + player.getName() + " injected");
        } catch (Throwable e) {
            Logger.getLogger("Minecraft").warning("[PermissionsEx] Failed to inject own Permissible");<commit_msg>Fixed debug output<commit_after>/*
 * PermissionsEx - Permissions plugin for Bukkit
 * Copyright (C) 2011 t3hk0d3 http://www.tehkode.ru
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package ru.tehkode.permissions.bukkit.superperms;

import java.lang.reflect.Field;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible;
import org.bukkit.permissions.PermissibleBase;
import org.bukkit.permissions.Permission;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;

public class PermissiblePEX extends PermissibleBase {

    protected Player player = null;
    protected boolean strictMode = false;

    protected PermissiblePEX(Player opable, boolean disableUnmatched) {
        super(opable);

        this.strictMode = disableUnmatched;
        this.player = opable;
    }

    public static void inject(Player player, boolean strictMode) {
        if (player.hasPermission("permissionsex.handler.injected")) { // already injected
            return;
        }

        try {
            Permissible permissible = new PermissiblePEX(player, strictMode);
            
            if (player.getClass().getName().contains("Spout")) { // we have spout installed
                Logger.getLogger("Minecraft").warning("[PermissionsEx] Spout plugin detected. Taking additional measures.");
                injectSpout(player, permissible);
            } else {
                injectCraftBukkit(player, permissible);
            }
            
            permissible.recalculatePermissions();

            Logger.getLogger("Minecraft").info("[PermissionsEx] Permissions handler for " + player.getName() + " injected");
        } catch (Throwable e) {
            Logger.getLogger("Minecraft").warning("[PermissionsEx] Failed to inject own Permissible");
{'fraction_non_alphanumeric': 0.09083865969397636, 'fraction_numerical': 0.007360061979469301, 'mean_word_length': 3.253706754530478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3318296', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1320, 'n_words': 439}