package bukkit.Eggspurt.me.Classes; import java.io.File; import java.io.IOException; import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import bukkit.Eggspurt.me.Commands.ExchangePoints; public class Main extends JavaPlugin implements Listener{ //Extending JavaPlugin so that Bukkit knows its the main class... public File pluginfile; public static FileConfiguration stats; private static Plugin plugin; public void onEnable() { plugin = this; registerEvents(this, new PointGiver()); getCommand("epoints").setExecutor(new ExchangePoints()); Bukkit.getServer().getPluginManager().registerEvents(this, this); } public void onDisable() { } @EventHandler public void onJoin(PlayerJoinEvent event) { UUID uuid = event.getPlayer().getUniqueId(); File pluginfile = new File("plugins/CRStats/"+uuid+".yml"); stats = YamlConfiguration.loadConfiguration(pluginfile); if (!pluginfile.exists()){ try { pluginfile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } } //Much eaisier then registering events in 10 diffirent methods public static void registerEvents(org.bukkit.plugin.Plugin plugin, Listener... listeners) { for (Listener listener : listeners) { Bukkit.getServer().getPluginManager().registerEvents(listener, plugin); } } //To access the plugin variable from other classes public static Plugin getPlugin() { return plugin; } }