<commit_before>package com.carrot.carrotshop.listener;

import java.util.Optional;

import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.data.type.HandTypes;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.block.InteractBlockEvent;
import org.spongepowered.api.event.filter.cause.First;
import org.spongepowered.api.item.ItemTypes;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

import com.carrot.carrotshop.CarrotShop;
import com.carrot.carrotshop.ShopsData;
import com.carrot.carrotshop.shop.Shop;


public class PlayerClickListener {
	@Listener(order=Order.FIRST)
	public void onPlayerRightClick(InteractBlockEvent.Secondary.MainHand event, @First Player player)
	{
		Optional<Location<World>> optLoc = event.getTargetBlock().getLocation();
		if (!optLoc.isPresent())
			return;

		Optional<Shop> shop = ShopsData.getShop(optLoc.get());
		if (shop.isPresent()) {
			if (optLoc.get().getBlockType() == BlockTypes.STANDING_SIGN || optLoc.get().getBlockType() == BlockTypes.WALL_SIGN) {
				event.setCancelled(true);
				shop.get().trigger(player);
				Sponge.getScheduler().createTaskBuilder().delayTicks(4).execute(
						task -> {
							shop.get().update();
							task.cancel();
						}).submit(CarrotShop.getInstance());
			}
		}
	}

	@Listener
	public void onPlayerLeftClick(InteractBlockEvent.Primary.MainHand event, @First Player player)
	{
		Optional<Location<World>> optLoc = event.getTargetBlock().getLocation();
		if (!optLoc.isPresent())
			return;

		Optional<ItemStack> optItem = player.getItemInHand(HandTypes.MAIN_HAND);
		if (optItem.isPresent() && optItem.get().getItem().equals(ItemTypes.REDSTONE)) {
			if (optLoc.get().getBlockType() == BlockTypes.CHEST || optLoc.get().getBlockType() == BlockTypes.TRAPPED_CHEST) {
				event.setCancelled(true);
				ShopsData.storeItemLocation(player, optLoc.get());
			} else if (optLoc.get().getBlockType() == BlockTypes.STANDING_SIGN || optLoc.get().getBlockType() == BlockTypes.WALL_SIGN) {
				event.setCancelled(true);
				Shop.build(player, optLoc.get());
			}
		} else {
			Optional<Shop> shop = ShopsData.getShop(optLoc.get());
			if (shop.isPresent()) {
				shop.get().info(player);
				if (player.gameMode().get().equals(GameModes.CREATIVE) && (!optItem.isPresent() || !optItem.get().getItem().equals(ItemTypes.BEDROCK)))
					event.setCancelled(true);
			}
		}
	}
}
<commit_msg>Final fix for perm problem<commit_after>package com.carrot.carrotshop.listener;

import java.util.Optional;

import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.data.type.HandTypes;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.block.InteractBlockEvent;
import org.spongepowered.api.event.filter.cause.First;
import org.spongepowered.api.item.ItemTypes;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

import com.carrot.carrotshop.CarrotShop;
import com.carrot.carrotshop.ShopsData;
import com.carrot.carrotshop.shop.Shop;


public class PlayerClickListener {
	@Listener(order=Order.FIRST)
	public void onPlayerRightClick(InteractBlockEvent.Secondary.MainHand event, @First Player player)
	{
		Optional<Location<World>> optLoc = event.getTargetBlock().getLocation();
		if (!optLoc.isPresent())
			return;

		Optional<Shop> shop = ShopsData.getShop(optLoc.get());
		if (shop.isPresent()) {
			if (optLoc.get().getBlockType() == BlockTypes.STANDING_SIGN || optLoc.get().getBlockType() == BlockTypes.WALL_SIGN) {
				event.setCancelled(true);
				shop.get().trigger(player);
				Sponge.getScheduler().createTaskBuilder().delayTicks(4).execute(
						task -> {
							shop.get().update();
							task.cancel();
						}).submit(CarrotShop.getInstance());
			}
		}
	}

	@Listener(order=Order.FIRST)
	public void onPlayerLeftClickMaster(InteractBlockEvent.Primary.MainHand event, @First Player player)
	{
		Optional<Location<World>> optLoc = event.getTargetBlock().getLocation();
		if (!optLoc.isPresent())
			return;

		Optional<Shop> shop = ShopsData.getShop(optLoc.get());
		if (shop.isPresent()) {
			shop.get().info(player);
			if (player.gameMode().get().equals(GameModes.CREATIVE)) {
				Optional<ItemStack> optItem = player.getItemInHand(HandTypes.MAIN_HAND);
				if (!optItem.isPresent() || !optItem.get().getItem().equals(ItemTypes.BEDROCK))
					event.setCancelled(true);
			}
		}		
	}

	@Listener
	public void onPlayerLeftClickNormal(InteractBlockEvent.Primary.MainHand event, @First Player player)
	{
		Optional<Location<World>> optLoc = event.getTargetBlock().getLocation();
		if (!optLoc.isPresent())
			return;

		Optional<ItemStack> optItem = player.getItemInHand(HandTypes.MAIN_HAND);
		if (optItem.isPresent() && optItem.get().getItem().equals(ItemTypes.REDSTONE)) {
			if (optLoc.get().getBlockType() == BlockTypes.CHEST || optLoc.get().getBlockType() == BlockTypes.TRAPPED_CHEST) {
				event.setCancelled(true);
				ShopsData.storeItemLocation(player, optLoc.get());
			} else if (optLoc.get().getBlockType() == BlockTypes.STANDING_SIGN || optLoc.get().getBlockType() == BlockTypes.WALL_SIGN) {
				event.setCancelled(true);
				Shop.build(player, optLoc.get());
			}
		}
	}
}

{'fraction_non_alphanumeric': 0.1480194579569145, 'fraction_numerical': 0.00034746351633078526, 'mean_word_length': 5.1506410256410255, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 22, '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': '1089634', 'n_tokens_mistral': 2132, 'n_tokens_neox': 1910, 'n_words': 259}