Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. package com.buzzy.inkzzz.factionessentials;
  2.  
  3. import java.io.File;
  4. import java.util.logging.Logger;
  5.  
  6. import net.milkbowl.vault.Vault;
  7. import net.milkbowl.vault.economy.Economy;
  8.  
  9. import org.bukkit.ChatColor;
  10. import org.bukkit.configuration.file.FileConfiguration;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.plugin.Plugin;
  13. import org.bukkit.plugin.PluginManager;
  14. import org.bukkit.plugin.RegisteredServiceProvider;
  15. import org.bukkit.plugin.java.JavaPlugin;
  16.  
  17. import com.buzzy.inkzzz.factionessentials.hooks.FactionsHook;
  18. import com.buzzy.inkzzz.factionessentials.hooks.FactionsManager;
  19.  
  20. public class FactionEssentials extends JavaPlugin {
  21.  
  22. public static Economy economy = null;
  23. public Logger logger = Logger.getLogger("FactionsEssentials");
  24.  
  25. public static String nopermission = (ChatColor.RED + "Error " + ChatColor.GRAY + "" + ChatColor.BOLD + "≫ " + ChatColor.WHITE + "You don't have permission!");
  26. public static String PREFIX = "§cFaction §3Essentials §7> ";
  27. public static String arrow = "≫";
  28. FileConfiguration config;
  29. File cfile;
  30. private FactionsHook factionsHook;
  31.  
  32. spawnconfig spawn = spawnconfig.getInstance();
  33.  
  34. public void onEnable() {
  35. PluginManager pluginManager = this.getServer().getPluginManager();
  36. getLogger().info("has been enabled!");
  37. Loader load = new Loader(this);
  38. load.listeners();
  39. load.commands();
  40. this.config = getConfig();
  41. this.config.options().copyDefaults(true);
  42. saveDefaultConfig();
  43. this.cfile = new File(getDataFolder(), "config.yml");
  44. spawn.setupspawn(this);
  45.  
  46. if (pluginManager.getPlugin("Factions") != null) {
  47. String factionsVersion = pluginManager.getPlugin("Factions").getDescription().getVersion();
  48. this.factionsHook = new FactionsManager(factionsVersion).getHook();
  49. }
  50.  
  51. }
  52.  
  53.  
  54. private boolean setupVault()
  55. {
  56. Plugin vault = getServer().getPluginManager().getPlugin("Vault");
  57. if ((vault != null & vault instanceof Vault))
  58. {
  59. this.logger.info("Found Vault. Checking for economy plugin.");
  60. setupEconomy();
  61. }
  62. else
  63. {
  64. this.logger.info("Vault was NOT found! Running without economy!");
  65. }
  66. return vault != null;
  67. }
  68.  
  69. private boolean setupEconomy()
  70. {
  71. RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(Economy.class);
  72. if (economyProvider != null) {
  73. economy = (Economy)economyProvider.getProvider();
  74. }
  75. return economy != null;
  76. }
  77.  
  78.  
  79. public void onDisable() {
  80.  
  81. getLogger().info("has been disabled!");
  82.  
  83. }
  84.  
  85. public Economy getEconomy() {
  86. return this.economy;
  87. }
  88.  
  89. public static String playerDisplayName(Player player)
  90. {
  91. return playerDisplayName(player);
  92. }
  93.  
  94. public FactionsHook getFactionsHook() {
  95. return factionsHook;
  96. }
  97.  
  98.  
  99. public static Plugin getInstance() {
  100. // TODO Auto-generated method stub
  101. return null;
  102. }
  103.  
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement