Advertisement
Guest User

sssss

a guest
Oct 30th, 2014
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. package org.npc.exp;
  2.  
  3. import java.io.File;
  4. import java.util.ArrayList;
  5. import java.util.List;
  6. import java.util.logging.Logger;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.Material;
  9. import org.bukkit.Server;
  10. import org.bukkit.command.PluginCommand;
  11. import org.bukkit.configuration.file.FileConfiguration;
  12. import org.bukkit.configuration.file.YamlConfiguration;
  13. import org.bukkit.inventory.ItemStack;
  14. import org.bukkit.plugin.PluginManager;
  15. import org.bukkit.plugin.java.JavaPlugin;
  16.  
  17. public class ExplosivePickaxe extends JavaPlugin
  18. {
  19. public Logger log = null;
  20. public File configFile;
  21. private List<ItemStack> pickaxes = new ArrayList();
  22. private String lore;
  23. private int radius;
  24. private boolean credit;
  25. private boolean natural;
  26.  
  27. public void onEnable()
  28. {
  29. getServer().getPluginManager().registerEvents(new EventListener(this), this); <----Event listener is another class
  30. Commands cmds = new Commands(this); <----Commands is another class
  31. getCommand("ep").setExecutor(cmds);
  32. getCommand("explosivepickaxe").setExecutor(cmds);
  33. this.configFile = new File(getDataFolder() + "/config.yml");
  34.  
  35. this.log = Logger.getLogger("Minecraft");
  36. if (!this.configFile.exists()) {
  37. saveDefaultConfig();
  38. }
  39. setupConfigValues();
  40. }
  41.  
  42. private void setupConfigValues() {
  43. FileConfiguration config = YamlConfiguration.loadConfiguration(this.configFile);
  44. this.lore = ChatColor.translateAlternateColorCodes('&', config.getString("lore"));
  45. this.radius = config.getInt("radius");
  46. this.credit = config.getBoolean("credits");
  47. this.natural = config.getBoolean("naturalExplosion");
  48. this.pickaxes.add(new ItemStack(Material.WOOD_PICKAXE));
  49. this.pickaxes.add(new ItemStack(Material.STONE_PICKAXE));
  50. this.pickaxes.add(new ItemStack(Material.IRON_PICKAXE));
  51. this.pickaxes.add(new ItemStack(Material.GOLD_PICKAXE));
  52. this.pickaxes.add(new ItemStack(Material.DIAMOND_PICKAXE));
  53. }
  54.  
  55. public boolean isPickaxe(ItemStack item) {
  56. for (int i = 0; i < this.pickaxes.size(); i++) {
  57. ItemStack pickaxe = (ItemStack)this.pickaxes.get(i);
  58. if (item.getType() == pickaxe.getType()) {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64.  
  65. public String getLore() {
  66. return this.lore;
  67. }
  68.  
  69. public int getRadius() {
  70. return this.radius;
  71. }
  72.  
  73. public boolean getCredit() {
  74. return this.credit;
  75. }
  76.  
  77. public boolean getNatural() {
  78. return this.natural;
  79. }
  80.  
  81. public ExplosivePickaxe getInstance() {
  82. return this;
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement