Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.npc.exp;
- import java.io.File;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.logging.Logger;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.Server;
- import org.bukkit.command.PluginCommand;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- public class ExplosivePickaxe extends JavaPlugin
- {
- public Logger log = null;
- public File configFile;
- private List<ItemStack> pickaxes = new ArrayList();
- private String lore;
- private int radius;
- private boolean credit;
- private boolean natural;
- public void onEnable()
- {
- getServer().getPluginManager().registerEvents(new EventListener(this), this); <----Event listener is another class
- Commands cmds = new Commands(this); <----Commands is another class
- getCommand("ep").setExecutor(cmds);
- getCommand("explosivepickaxe").setExecutor(cmds);
- this.configFile = new File(getDataFolder() + "/config.yml");
- this.log = Logger.getLogger("Minecraft");
- if (!this.configFile.exists()) {
- saveDefaultConfig();
- }
- setupConfigValues();
- }
- private void setupConfigValues() {
- FileConfiguration config = YamlConfiguration.loadConfiguration(this.configFile);
- this.lore = ChatColor.translateAlternateColorCodes('&', config.getString("lore"));
- this.radius = config.getInt("radius");
- this.credit = config.getBoolean("credits");
- this.natural = config.getBoolean("naturalExplosion");
- this.pickaxes.add(new ItemStack(Material.WOOD_PICKAXE));
- this.pickaxes.add(new ItemStack(Material.STONE_PICKAXE));
- this.pickaxes.add(new ItemStack(Material.IRON_PICKAXE));
- this.pickaxes.add(new ItemStack(Material.GOLD_PICKAXE));
- this.pickaxes.add(new ItemStack(Material.DIAMOND_PICKAXE));
- }
- public boolean isPickaxe(ItemStack item) {
- for (int i = 0; i < this.pickaxes.size(); i++) {
- ItemStack pickaxe = (ItemStack)this.pickaxes.get(i);
- if (item.getType() == pickaxe.getType()) {
- return true;
- }
- }
- return false;
- }
- public String getLore() {
- return this.lore;
- }
- public int getRadius() {
- return this.radius;
- }
- public boolean getCredit() {
- return this.credit;
- }
- public boolean getNatural() {
- return this.natural;
- }
- public ExplosivePickaxe getInstance() {
- return this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement