Guest User

Untitled

a guest
May 9th, 2017
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.yhl;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Material;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.inventory.ItemStack;
  10. import org.bukkit.plugin.Plugin;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13. import net.md_5.bungee.api.ChatColor;
  14.  
  15. public class Miner extends JavaPlugin {
  16.  
  17. public static Plugin plugin;
  18. public static Miner instance;
  19. AnimationTimer at = new AnimationTimer(this);
  20. public MyConfig messages;
  21. public MyConfigManager man;
  22.  
  23. public void onEnable(){
  24.  
  25. man = new MyConfigManager(this);
  26. messages = man.getNewConfig("Miner.yml", new String[] {"Main Config for >Miner<", "Creds to dNiym for helping me out"});
  27.  
  28. plugin = this;
  29. instance = this;
  30. registerEvents(this, new ListenerClass());
  31. this.getServer().getScheduler().scheduleSyncRepeatingTask(this, at, 0L, 20L);
  32. }
  33.  
  34.  
  35.  
  36. public static void registerEvents(org.bukkit.plugin.Plugin plugin, Listener... listeners) {
  37. for (Listener listener : listeners) {
  38. Bukkit.getServer().getPluginManager().registerEvents(listener, plugin);
  39. }
  40. }
  41.  
  42. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  43.  
  44. if (!(sender instanceof Player)) {
  45. sender.sendMessage(ChatColor.AQUA + "");
  46. return true;
  47. }
  48.  
  49. Player player = (Player) sender;
  50.  
  51. if (cmd.getName().equalsIgnoreCase("Miner")) {
  52. if(player.hasPermission("Miner.miner")){
  53. at.setup(player);
  54.  
  55. } else{
  56. player.sendMessage(ChatColor.DARK_RED + "You do not have permission to do this.");
  57. return false;
  58. }
  59.  
  60. } else if (cmd.getName().equalsIgnoreCase("Miner2")) {
  61.  
  62.  
  63.  
  64. }
  65. return true;
  66. }
  67.  
  68. public static Plugin getPlugin() {
  69. return plugin;
  70. }
  71.  
  72. public static Miner getInstance() {
  73. return instance;
  74. }
  75. }
RAW Paste Data