<commit_before>package com.elmakers.mine.bukkit.api.magic;

import java.io.File;
import java.util.Collection;
import java.util.Set;
import java.util.logging.Logger;

import com.elmakers.mine.bukkit.api.block.CurrencyItem;
import com.elmakers.mine.bukkit.api.block.MaterialAndData;
import com.elmakers.mine.bukkit.api.maps.MapController;
import com.elmakers.mine.bukkit.api.wand.WandUpgradePath;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;

import com.elmakers.mine.bukkit.api.block.BlockList;
import com.elmakers.mine.bukkit.api.block.Schematic;
import com.elmakers.mine.bukkit.api.block.UndoList;
import com.elmakers.mine.bukkit.api.spell.SpellCategory;
import com.elmakers.mine.bukkit.api.spell.SpellTemplate;
import com.elmakers.mine.bukkit.api.wand.LostWand;
import com.elmakers.mine.bukkit.api.wand.Wand;
import org.bukkit.util.Vector;

public interface MageController {

    /**
     * Retrieve the Logger for this API instance.
     *
     * @return The logger being used by the API provider (usually MagicPlugin).
     */
    public Logger getLogger();

    /**
     * Retrieve the Plugin that owns this controller.
     *
     * This will generally be the MagicPlugin, but.. maybe not always?
     *
     * @return The owning plugin instance
     */
    public Plugin getPlugin();
    public File getConfigFolder();

    /**
     * Check to see if the given block is part of an Automata.
     *
     * This currently only works if you specify the redstone block associated
     * with the automata, though this will hopefully be improved in the future.
     *
     * @param block The block to check.
     * @return True if this is an Automata's power source.
     */
    public boolean isAutomata(Block block);
    public Automaton getAutomaton(Block block);

    /**
     * Return a list of all known LostWand records.
     *
     * @return A list of all known LostWand data.
     */
    public Collection<LostWand> getLostWands();

    /**
     * Create a new Wand from a template.
     *
     * Once created, a Wand is a unique item. It "remembers" which template
     * it was created from, but this is currently not used for anything.
     *
     * @param wandKey The template key, or blank for a default wand.
     * @return A new Wand instance, with a useable ItemStack.
     */
    public Wand createWand(String wandKey);
    public ItemStack createItem(String magicItemKey);
    public ItemStack createGenericItem(String itemKey);
    public Wand createUpgrade(String wandKey);
    public ItemStack createSpellItem(String spellKey);
    public ItemStack createBrushItem(String brushKey);
    public Wand getWand(ItemStack item);

    public String describeItem(ItemStack item);
    public String getItemKey(ItemStack item);
    public boolean takeItem(Player player, ItemStack item);
    public boolean hasItem(Player player, ItemStack item);

    public SpellCategory getCategory(String key);
    public Collection<SpellCategory> getCategories();
    public Collection<SpellTemplate> getSpellTemplates();
    public Collection<SpellTemplate> getSpellTemplates(boolean showHidden);
    public SpellTemplate getSpellTemplate(String key);
    public Set<String> getWandPathKeys();
    public WandUpgradePath getPath(String key);

    public void registerAutomata(Block block, String name, String message);
    public boolean unregisterAutomata(Block block);

    public void updateBlock(Block block);
    public void updateBlock(String worldName, int x, int y, int z);
    public void updateVolume(String worldName, int minx, int miny, int minz, int maxx, int maxy, int maxz);
    public void update(BlockList blockList);

    public boolean canCreateWorlds();
    public int getMaxUndoPersistSize();

    public Schematic loadSchematic(String name);
    public Set<Material> getMaterialSet(String name);

    public void sendToMages(String message, Location location);
    public Collection<Mage> getMages();

    public String getMessagePrefix();

    public String getReflectiveMaterials(Mage mage, Location location);
    public String getDestructibleMaterials(Mage mage, Location location);
    public Set<String> getSpellOverrides(Mage mage, Location location);

    public Set<Material> getDestructibleMaterials();
    public Set<Material> getBuildingMaterials();
    public Set<Material> getRestrictedMaterials();

    public Collection<String> getMaterialSets();

    public Collection<String> getPlayerNames();

    public int getMessageThrottle();
    public boolean isMage(Entity entity);
    public Mage getMage(CommandSender sender);
    public Mage getMage(Player player);
    public Mage getMage(Entity entity);
    public Mage getMage(String id, String name);
    public Mage getRegisteredMage(String mageId);

    public Collection<String> getBrushKeys();

    public boolean commitAll();

    public void disablePhysics(int interval);

    public boolean hasPermission(CommandSender sender, String pNode, boolean defaultValue);
    public boolean hasCastPermission(CommandSender sender, SpellTemplate spell);
    public Boolean getRegionCastPermission(Player player, SpellTemplate spell, Location location);
    public Boolean getPersonalCastPermission(Player player, SpellTemplate spell, Location location);
    public boolean isPVPAllowed(Player player, Location location);
    public boolean canTarget(Entity attacker, Entity target);
    public boolean isUrlIconsEnabled();
    public Set<EntityType> getUndoEntityTypes();

    public boolean sendMail(CommandSender sender, String fromPlayer, String toPlayer, String message);

    public Location getWarp(String warpName);

    public void giveItemToPlayer(Player player, ItemStack itemStack);

    public UndoList undoAny(Block target);
    public UndoList undoRecent(Block target, int timeout);
    public void forgetMage(Mage mage);
    public void scheduleUndo(UndoList undoList);
    public void cancelScheduledUndo(UndoList undoList);

    public String getEntityName(Entity entity);
    public String getEntityDisplayName(Entity entity);

    public int getMaxWandFillLevel();
    public double getWorthBase();
    public double getWorthXP();
    public double getWorthSkillPoints();<commit_msg>Add getTownLocation to API, for Towny integration<commit_after>package com.elmakers.mine.bukkit.api.magic;

import java.io.File;
import java.util.Collection;
import java.util.Set;
import java.util.logging.Logger;

import com.elmakers.mine.bukkit.api.block.CurrencyItem;
import com.elmakers.mine.bukkit.api.block.MaterialAndData;
import com.elmakers.mine.bukkit.api.maps.MapController;
import com.elmakers.mine.bukkit.api.wand.WandUpgradePath;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;

import com.elmakers.mine.bukkit.api.block.BlockList;
import com.elmakers.mine.bukkit.api.block.Schematic;
import com.elmakers.mine.bukkit.api.block.UndoList;
import com.elmakers.mine.bukkit.api.spell.SpellCategory;
import com.elmakers.mine.bukkit.api.spell.SpellTemplate;
import com.elmakers.mine.bukkit.api.wand.LostWand;
import com.elmakers.mine.bukkit.api.wand.Wand;
import org.bukkit.util.Vector;

public interface MageController {

    /**
     * Retrieve the Logger for this API instance.
     *
     * @return The logger being used by the API provider (usually MagicPlugin).
     */
    public Logger getLogger();

    /**
     * Retrieve the Plugin that owns this controller.
     *
     * This will generally be the MagicPlugin, but.. maybe not always?
     *
     * @return The owning plugin instance
     */
    public Plugin getPlugin();
    public File getConfigFolder();

    /**
     * Check to see if the given block is part of an Automata.
     *
     * This currently only works if you specify the redstone block associated
     * with the automata, though this will hopefully be improved in the future.
     *
     * @param block The block to check.
     * @return True if this is an Automata's power source.
     */
    public boolean isAutomata(Block block);
    public Automaton getAutomaton(Block block);

    /**
     * Return a list of all known LostWand records.
     *
     * @return A list of all known LostWand data.
     */
    public Collection<LostWand> getLostWands();

    /**
     * Create a new Wand from a template.
     *
     * Once created, a Wand is a unique item. It "remembers" which template
     * it was created from, but this is currently not used for anything.
     *
     * @param wandKey The template key, or blank for a default wand.
     * @return A new Wand instance, with a useable ItemStack.
     */
    public Wand createWand(String wandKey);
    public ItemStack createItem(String magicItemKey);
    public ItemStack createGenericItem(String itemKey);
    public Wand createUpgrade(String wandKey);
    public ItemStack createSpellItem(String spellKey);
    public ItemStack createBrushItem(String brushKey);
    public Wand getWand(ItemStack item);

    public String describeItem(ItemStack item);
    public String getItemKey(ItemStack item);
    public boolean takeItem(Player player, ItemStack item);
    public boolean hasItem(Player player, ItemStack item);

    public SpellCategory getCategory(String key);
    public Collection<SpellCategory> getCategories();
    public Collection<SpellTemplate> getSpellTemplates();
    public Collection<SpellTemplate> getSpellTemplates(boolean showHidden);
    public SpellTemplate getSpellTemplate(String key);
    public Set<String> getWandPathKeys();
    public WandUpgradePath getPath(String key);

    public void registerAutomata(Block block, String name, String message);
    public boolean unregisterAutomata(Block block);

    public void updateBlock(Block block);
    public void updateBlock(String worldName, int x, int y, int z);
    public void updateVolume(String worldName, int minx, int miny, int minz, int maxx, int maxy, int maxz);
    public void update(BlockList blockList);

    public boolean canCreateWorlds();
    public int getMaxUndoPersistSize();

    public Schematic loadSchematic(String name);
    public Set<Material> getMaterialSet(String name);

    public void sendToMages(String message, Location location);
    public Collection<Mage> getMages();

    public String getMessagePrefix();

    public String getReflectiveMaterials(Mage mage, Location location);
    public String getDestructibleMaterials(Mage mage, Location location);
    public Set<String> getSpellOverrides(Mage mage, Location location);

    public Set<Material> getDestructibleMaterials();
    public Set<Material> getBuildingMaterials();
    public Set<Material> getRestrictedMaterials();

    public Collection<String> getMaterialSets();

    public Collection<String> getPlayerNames();

    public int getMessageThrottle();
    public boolean isMage(Entity entity);
    public Mage getMage(CommandSender sender);
    public Mage getMage(Player player);
    public Mage getMage(Entity entity);
    public Mage getMage(String id, String name);
    public Mage getRegisteredMage(String mageId);

    public Collection<String> getBrushKeys();

    public boolean commitAll();

    public void disablePhysics(int interval);

    public boolean hasPermission(CommandSender sender, String pNode, boolean defaultValue);
    public boolean hasCastPermission(CommandSender sender, SpellTemplate spell);
    public Boolean getRegionCastPermission(Player player, SpellTemplate spell, Location location);
    public Boolean getPersonalCastPermission(Player player, SpellTemplate spell, Location location);
    public boolean isPVPAllowed(Player player, Location location);
    public boolean canTarget(Entity attacker, Entity target);
    public boolean isUrlIconsEnabled();
    public Set<EntityType> getUndoEntityTypes();

    public boolean sendMail(CommandSender sender, String fromPlayer, String toPlayer, String message);

    public Location getWarp(String warpName);
    public Location getTownLocation(Player player);

    public void giveItemToPlayer(Player player, ItemStack itemStack);

    public UndoList undoAny(Block target);
    public UndoList undoRecent(Block target, int timeout);
    public void forgetMage(Mage mage);
    public void scheduleUndo(UndoList undoList);
    public void cancelScheduledUndo(UndoList undoList);

    public String getEntityName(Entity entity);
    public String getEntityDisplayName(Entity entity);

    public int getMaxWandFillLevel();
    public double getWorthBase();
    public double getWorthXP();
    public double getWorthSkillPoints();
{'fraction_non_alphanumeric': 0.07970682546953733, 'fraction_numerical': 0.0, 'mean_word_length': 4.2375049980008, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '1891135', 'n_tokens_mistral': 3672, 'n_tokens_neox': 3539, 'n_words': 1131}