<commit_before>package de.wolfi.minopoly.commands;

import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.MaterialData;

import de.wolfi.minopoly.Main;
import de.wolfi.minopoly.components.Minopoly;
import de.wolfi.minopoly.components.Player;
import de.wolfi.minopoly.components.fields.Field;
import de.wolfi.minopoly.components.fields.NormalField;
import de.wolfi.utils.ItemBuilder;
import de.wolfi.utils.inventory.InventoryCounter;

public class FieldCommand extends CommandInterface implements InventoryHolder {

	public static final ItemStack fieldGUI = new ItemBuilder(Material.WATER_LILY).setName("aFelder Managen").build();

	private final String title = "Felder Managen";

	private static final Enchantment owned = new ItemBuilder.MyEnchantment("Owned");

	public FieldCommand(Main plugin) {
		super(plugin, 1, true);
	}

	@Override
	public List<String> onTabComplete(final CommandSender paramCommandSender, final Command paramCommand,
			final String paramString, final String[] paramArrayOfString) {
		// TODO
		return null;
	}

	@Override
	protected void executeCommand(Minopoly board, Player player, String[] args) {
		switch (args[0]) {
		case "gui": {
			Inventory inv = this.getInventory();
			for (Field f : board.getFieldManager().getFields()) {
				MaterialData data = f.getBlock();
				ItemBuilder field = new ItemBuilder(data.toItemStack());
				field.setName(f.toString());
				field.addLore("Typ: "+f.getClass().getSimpleName());
				if(f instanceof NormalField) field.addLore("Farbe: "+f.getColor().toString());
				if(f.getPrice() >= 0){
					field.addLore("Preis: "+f.getPrice());
					field.addLore("Steuern: "+f.getBilling());
				}
				if(f.isOwned()) field.addLore("Owner: "+f.getOwner().getDisplay());
				if (f.isOwnedBy(player))
					field.enchant(owned, 10);
				inv.addItem(field.build());
			}
			player.getHook().openInventory(inv);
		}
		break;
		case "buy":
			if(!player.getLocation().isOwned()) player.getLocation().buy(player);
			break;
		default:
			break;
		}
	}

	@EventHandler
	public void onItemUse(PlayerInteractEvent e) {
		if (e.getAction() == Action.RIGHT_CLICK_AIR
				|| e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getItem() != null) {
			if (e.getItem().equals(FieldCommand.fieldGUI)) {
				e.setCancelled(true);
				Bukkit.dispatchCommand(Main.getMain().getMinopoly(e.getPlayer().getWorld()),
						"field " + e.getPlayer().getName() + " gui");
			}
		}
	}

	@EventHandler
	public void onClick(InventoryClickEvent e) {
		if (e.getInventory().getHolder() == this) {
			e.setCancelled(true);
			if (e.getCurrentItem() != null) {

				Minopoly game = Main.getMain().getMinopoly(e.getWhoClicked().getWorld());<commit_msg>move and sell your friends (2) o/<commit_after>package de.wolfi.minopoly.commands;

import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.MaterialData;

import de.wolfi.minopoly.Main;
import de.wolfi.minopoly.components.Minopoly;
import de.wolfi.minopoly.components.Player;
import de.wolfi.minopoly.components.fields.Field;
import de.wolfi.minopoly.components.fields.NormalField;
import de.wolfi.utils.ItemBuilder;
import de.wolfi.utils.inventory.InventoryCounter;

public class FieldCommand extends CommandInterface implements InventoryHolder {

	public static final ItemStack fieldGUI = new ItemBuilder(Material.WATER_LILY).setName("aFelder Managen").build();

	private final String title = "Felder Managen";

	private static final Enchantment owned = new ItemBuilder.MyEnchantment("Owned");

	public FieldCommand(Main plugin) {
		super(plugin, 1, true);
	}

	@Override
	public List<String> onTabComplete(final CommandSender paramCommandSender, final Command paramCommand,
			final String paramString, final String[] paramArrayOfString) {
		// TODO
		return null;
	}

	@Override
	protected void executeCommand(Minopoly board, Player player, String[] args) {
		switch (args[0]) {
		case "gui": {
			Inventory inv = this.getInventory();
			for (Field f : board.getFieldManager().getFields()) {
				MaterialData data = f.getBlock();
				ItemBuilder field = new ItemBuilder(data.toItemStack());
				field.setName(f.toString());
				field.addLore("Typ: "+f.getClass().getSimpleName());
				if(f instanceof NormalField) field.addLore("Farbe: "+f.getColor().toString());
				if(f.getPrice() >= 0){
					field.addLore("Preis: "+f.getPrice());
					field.addLore("Steuern: "+f.getBilling());
				}
				if(f.isOwned()) field.addLore("Owner: "+f.getOwner().getDisplay());
				if (f.isOwnedBy(player))
					field.enchant(owned, 10);
				inv.addItem(field.build());
			}
			player.getHook().openInventory(inv);
		}
		break;
		case "buy":
			if(!player.getLocation().isOwned()) player.getLocation().buy(player);
			break;
		case "sell":
			if(player.getLocation().isOwnedBy(player)) player.getLocation().sell();
			break;
		case "move":
			Player pr = board.getByPlayerName(args[1]);
			if(player.getLocation().isOwnedBy(player)) player.getLocation().moveProperty(pr);
			break;
		default:
			break;
		}
	}

	@EventHandler
	public void onItemUse(PlayerInteractEvent e) {
		if (e.getAction() == Action.RIGHT_CLICK_AIR
				|| e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getItem() != null) {
			if (e.getItem().equals(FieldCommand.fieldGUI)) {
				e.setCancelled(true);
				Bukkit.dispatchCommand(Main.getMain().getMinopoly(e.getPlayer().getWorld()),
						"field " + e.getPlayer().getName() + " gui");
			}
		}
	}

	@EventHandler
	public void onClick(InventoryClickEvent e) {
		if (e.getInventory().getHolder() == this) {
			e.setCancelled(true);
			if (e.getCurrentItem() != null) {

				Minopoly game = Main.getMain().getMinopoly(e.getWhoClicked().getWorld());
{'fraction_non_alphanumeric': 0.14189290535473226, 'fraction_numerical': 0.001799910004499775, 'mean_word_length': 4.900884955752212, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 7, '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': '5441', 'n_tokens_mistral': 2479, 'n_tokens_neox': 2178, 'n_words': 398}