Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package endlesspvp.endlessutilities;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.command.Command;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.configuration.InvalidConfigurationException;
  11. import org.bukkit.configuration.file.FileConfiguration;
  12. import org.bukkit.configuration.file.YamlConfiguration;
  13. import org.bukkit.plugin.PluginManager;
  14. import org.bukkit.plugin.java.JavaPlugin;
  15.  
  16. import endlesspvp.endlessutilities.GUIFeature.InventoryClick;
  17. import endlesspvp.endlessutilities.GUIFeature.UtilitiesGUI;
  18.  
  19. public class UtilitiesMain
  20. extends JavaPlugin
  21. {
  22. private File commandMessagesf;
  23. private FileConfiguration commandMessages;
  24.  
  25. public void onEnable()
  26. {
  27. saveResource("commandMessages.yml", true);
  28. Bukkit.getServer().getPluginManager().registerEvents(new InventoryClick(), this);
  29.  
  30. System.out.println("EndlessUtilities, A Plugin Designed By Fang456");
  31. System.out.println("This plugin version is 0.0.1");
  32. System.out.println("Any updates are here: https://www.spigotmc.org/members/fang456.117884/");
  33.  
  34. registerCommands();
  35. registerEvents();
  36. createFiles();
  37.  
  38. getCommand("website").setExecutor(new UtilitiesCommands(this));
  39. getCommand("store").setExecutor(new UtilitiesCommands(this));
  40. getCommand("discord").setExecutor(new UtilitiesCommands(this));
  41. getCommand("instagram").setExecutor(new UtilitiesCommands(this));
  42. getCommand("twitter").setExecutor(new UtilitiesCommands(this));
  43. getCommand("facebook").setExecutor(new UtilitiesCommands(this));
  44. getCommand("teamspeak").setExecutor(new UtilitiesCommands(this));
  45. getCommand("skype").setExecutor(new UtilitiesCommands(this));
  46. getCommand("steam").setExecutor(new UtilitiesCommands(this));
  47. getCommand("snapchat").setExecutor(new UtilitiesCommands(this));
  48. getCommand("reddit").setExecutor(new UtilitiesCommands(this));
  49. getCommand("cmode").setExecutor(new UtilitiesCommands(this));
  50. getCommand("smode").setExecutor(new UtilitiesCommands(this));
  51. getCommand("banpanel").setExecutor(new UtilitiesCommands(this));
  52.  
  53. saveDefaultConfig();
  54. }
  55.  
  56. public void onDisable() {}
  57.  
  58. public String getPrefix()
  59. {
  60. return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix"));
  61. }
  62.  
  63. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  64. {
  65. if (cmd.getName().equalsIgnoreCase("ereload"))
  66. {
  67. reloadConfig();
  68. this.commandMessages = YamlConfiguration.loadConfiguration(this.commandMessagesf);
  69. sender.sendMessage(getPrefix() + ChatColor.GREEN + "Reloaded Plugin!");
  70. }
  71. return true;
  72. }
  73.  
  74. public void registerCommands()
  75. {
  76. getCommand("info").setExecutor(new UtilitiesGUI());
  77. }
  78.  
  79. public void registerEvents()
  80. {
  81. PluginManager pm = getServer().getPluginManager();
  82.  
  83. pm.registerEvents(new InventoryClick(), this);
  84. }
  85.  
  86. public FileConfiguration getcommandMessagesConfig()
  87. {
  88. return this.commandMessages;
  89. }
  90.  
  91. private void createFiles()
  92. {
  93. this.commandMessagesf = new File(getDataFolder(), "commandMessages.yml");
  94. if (!this.commandMessagesf.exists())
  95. {
  96. this.commandMessagesf.getParentFile().mkdirs();
  97. saveResource("commandMessages.yml", false);
  98. }
  99. this.commandMessages = new YamlConfiguration();
  100. try
  101. {
  102. this.commandMessages.load(this.commandMessagesf);
  103. }
  104. catch (IOException|InvalidConfigurationException e)
  105. {
  106. e.printStackTrace();
  107. }
  108. }
  109. }
Advertisement
RAW Paste Data Copied
Advertisement