Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package endlesspvp.endlessutilities;
- import java.io.File;
- import java.io.IOException;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.InvalidConfigurationException;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- import endlesspvp.endlessutilities.GUIFeature.InventoryClick;
- import endlesspvp.endlessutilities.GUIFeature.UtilitiesGUI;
- public class UtilitiesMain
- extends JavaPlugin
- {
- private File commandMessagesf;
- private FileConfiguration commandMessages;
- public void onEnable()
- {
- saveResource("commandMessages.yml", true);
- Bukkit.getServer().getPluginManager().registerEvents(new InventoryClick(), this);
- System.out.println("EndlessUtilities, A Plugin Designed By Fang456");
- System.out.println("This plugin version is 0.0.1");
- System.out.println("Any updates are here: https://www.spigotmc.org/members/fang456.117884/");
- registerCommands();
- registerEvents();
- createFiles();
- getCommand("website").setExecutor(new UtilitiesCommands(this));
- getCommand("store").setExecutor(new UtilitiesCommands(this));
- getCommand("discord").setExecutor(new UtilitiesCommands(this));
- getCommand("instagram").setExecutor(new UtilitiesCommands(this));
- getCommand("twitter").setExecutor(new UtilitiesCommands(this));
- getCommand("facebook").setExecutor(new UtilitiesCommands(this));
- getCommand("teamspeak").setExecutor(new UtilitiesCommands(this));
- getCommand("skype").setExecutor(new UtilitiesCommands(this));
- getCommand("steam").setExecutor(new UtilitiesCommands(this));
- getCommand("snapchat").setExecutor(new UtilitiesCommands(this));
- getCommand("reddit").setExecutor(new UtilitiesCommands(this));
- getCommand("cmode").setExecutor(new UtilitiesCommands(this));
- getCommand("smode").setExecutor(new UtilitiesCommands(this));
- getCommand("banpanel").setExecutor(new UtilitiesCommands(this));
- saveDefaultConfig();
- }
- public void onDisable() {}
- public String getPrefix()
- {
- return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix"));
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
- {
- if (cmd.getName().equalsIgnoreCase("ereload"))
- {
- reloadConfig();
- this.commandMessages = YamlConfiguration.loadConfiguration(this.commandMessagesf);
- sender.sendMessage(getPrefix() + ChatColor.GREEN + "Reloaded Plugin!");
- }
- return true;
- }
- public void registerCommands()
- {
- getCommand("info").setExecutor(new UtilitiesGUI());
- }
- public void registerEvents()
- {
- PluginManager pm = getServer().getPluginManager();
- pm.registerEvents(new InventoryClick(), this);
- }
- public FileConfiguration getcommandMessagesConfig()
- {
- return this.commandMessages;
- }
- private void createFiles()
- {
- this.commandMessagesf = new File(getDataFolder(), "commandMessages.yml");
- if (!this.commandMessagesf.exists())
- {
- this.commandMessagesf.getParentFile().mkdirs();
- saveResource("commandMessages.yml", false);
- }
- this.commandMessages = new YamlConfiguration();
- try
- {
- this.commandMessages.load(this.commandMessagesf);
- }
- catch (IOException|InvalidConfigurationException e)
- {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement