Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CitybuildSystem extends JavaPlugin {
- public static CitybuildSystem instance;
- public static CitybuildSystem plugin;
- private PlayerhomeManager playerhomeManager;
- private Map<UUID, List<UUID>> tpaRequests = new HashMap<>();
- public static HashMap<UUID, UUID> LastMessage = new HashMap<>();
- public static ArrayList<UUID> messagetoggle = new ArrayList<UUID>();
- public static File homeFile = new File("plugins/CitybuildSystem/home/homes.yml");
- public static YamlConfiguration homeConfiguration = YamlConfiguration.loadConfiguration(homeFile);
- public static PlotAPI plotAPI;
- @Override
- public void onEnable() {
- RegisterInitiation();
- RegisterListener(Bukkit.getPluginManager());
- RegisterCommands();
- RegisterMessage();
- RegisterConfiguration();
- }
- private void RegisterConfiguration() {
- getConfig().options().copyDefaults(true);
- saveDefaultConfig();
- saveConfig();
- reloadConfig();
- }
- private void RegisterMessage() {
- Bukkit.getConsoleSender().sendMessage("§a-------------==+==-------------");
- Bukkit.getConsoleSender().sendMessage("§7Plugin §7» §eCitybuildSystem");
- Bukkit.getConsoleSender().sendMessage("§7Plugin author §7» §eFaceknoxwell");
- Bukkit.getConsoleSender().sendMessage("§7Plugin version §7» §e1.0");
- Bukkit.getConsoleSender().sendMessage("§7Plugin aktiviert §7» §a§lJa");
- Bukkit.getConsoleSender().sendMessage("§7Skype Support §7» §bFaceknoxwell");
- Bukkit.getConsoleSender().sendMessage("§a-------------==+==-------------");
- }
- private void RegisterCommands() {
- getCommand("armor").setExecutor(new ArmorCommand());
- getCommand("clearchat").setExecutor(new ClearchatCommand());
- getCommand("clear").setExecutor(new ClearCommand());
- getCommand("coins").setExecutor(new CoinsCommand());
- getCommand("commandspy").setExecutor(new CommandspyCommand());
- getCommand("day").setExecutor(new DayCommand());
- getCommand("deletehome").setExecutor(new DeletehomeCommand());
- getCommand("deletewarp").setExecutor(new DeletewarpCommand());
- getCommand("enderchest").setExecutor(new EnderchestCommand());
- getCommand("fly").setExecutor(new FlyCommand());
- getCommand("gamemode").setExecutor(new GamemodeCommand());
- getCommand("heal").setExecutor(new HealCommand());
- getCommand("home").setExecutor(new HomeCommand());
- getCommand("invsee").setExecutor(new InvseeCommand());
- getCommand("kill").setExecutor(new KillCommand());
- getCommand("message").setExecutor(new MessageCommand());
- getCommand("messagetoggle").setExecutor(new MessagetoggleCommand());
- getCommand("night").setExecutor(new NightCommand());
- getCommand("pay").setExecutor(new PayCommand());
- getCommand("rand").setExecutor(new RandCommand());
- getCommand("repair").setExecutor(new RepairCommand());
- getCommand("reply").setExecutor(new ReplyCommand());
- getCommand("sethome").setExecutor(new SethomeCommand());
- getCommand("setspawn").setExecutor(new SetspawnCommand());
- getCommand("setwarp").setExecutor(new SetwarpCommand());
- getCommand("skull").setExecutor(new SkullCommand());
- getCommand("spawn").setExecutor(new SpawnCommand());
- getCommand("warp").setExecutor(new WarpCommand());
- getCommand("warplist").setExecutor(new WarplistCommand());
- getCommand("citybuild").setExecutor(new CitybuildCommand());
- getCommand("sun").setExecutor(new SunCommand());
- getCommand("teleport").setExecutor(new TeleportCommand());
- getCommand("teleporthere").setExecutor(new TeleporthereCommand());
- getCommand("sudo").setExecutor(new SudoCommand());
- getCommand("tpa").setExecutor(new TpaCommand());
- getCommand("tpaaccept").setExecutor(new TpaacceptCommand());
- getCommand("tpadeny").setExecutor(new TpadenyCommand());
- }
- private void RegisterInitiation() {
- instance = this;
- plugin = this;
- plotAPI = new PlotAPI();
- playerhomeManager = new PlayerhomeManager();
- MySQL.host = instance.getConfig().getString("MySQL.Host");
- MySQL.port = instance.getConfig().getString("MySQL.Port");
- MySQL.database = instance.getConfig().getString("MySQL.Database");
- MySQL.username = instance.getConfig().getString("MySQL.Username");
- MySQL.password = instance.getConfig().getString("MySQL.Password");
- if (CitybuildSystem.plugin.getConfig().getBoolean("Entityremover.MobRemover", true)) {
- new EntityRemover().start();
- }
- try {
- homeConfiguration.save(homeFile);
- } catch (IOException e) {
- e.printStackTrace();
- }
- try {
- MySQL.connect();
- Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
- public void run() {
- UUIDFetcher.clearCache();
- }
- }, 12000L, 12000L);
- MySQL.createTableIfNotExists();
- Bukkit.getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() {
- public void run() {
- MySQL.createTableIfNotExists();
- }
- }, 12000L, 12000L);
- //
- Bukkit.getConsoleSender().sendMessage(Data.Prefix + "§a§lDie Verbindung zur Datenbank wurde erfolgreich hergestellt.");
- } catch (Exception e) {
- Bukkit.getConsoleSender().sendMessage(Data.Prefix + "§c§lDie Verbindung zur Datenbank konnte nicht hergestellt werden.");
- }
- }
- private void RegisterListener(final PluginManager pluginManager) {
- pluginManager.registerEvents(new PlayerSpawnListener(), this);
- pluginManager.registerEvents(new PlayerAchievementsListener(), this);
- pluginManager.registerEvents(new PlayerJoinListener(), this);
- pluginManager.registerEvents(new PlayerQuitListener(), this);
- pluginManager.registerEvents(new PlayerRandListener(), this);
- pluginManager.registerEvents(new PlayerRespawnListener(), this);
- pluginManager.registerEvents(new PlayerSpyListener(), this);
- pluginManager.registerEvents(new PlayerChatListener(), this);
- pluginManager.registerEvents(new PlayerOwnerListener(), this);
- pluginManager.registerEvents(new PlayerDeathListener(), this);
- pluginManager.registerEvents(new PlayerExistListener(), this);
- pluginManager.registerEvents(new PlayerAsyncloginListener(), this);
- }
- @Override
- public void onDisable() {
- Bukkit.getConsoleSender().sendMessage("§a-------------==+==-------------");
- Bukkit.getConsoleSender().sendMessage("§7Plugin §7» §eCitybuildSystem");
- Bukkit.getConsoleSender().sendMessage("§7Plugin author §7» §eFaceknoxwell");
- Bukkit.getConsoleSender().sendMessage("§7Plugin version §7» §e1.0");
- Bukkit.getConsoleSender().sendMessage("§7Plugin deaktiviert §7» §c§lJa");
- Bukkit.getConsoleSender().sendMessage("§7Skype Support §7» §bFaceknoxwell");
- Bukkit.getConsoleSender().sendMessage("§a-------------==+==-------------");
- MySQL.disconnect();
- try {
- homeConfiguration.save(homeFile);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public static CitybuildSystem getInstance() {
- return instance;
- }
- public static CitybuildSystem getPlugin() {
- return plugin;
- }
- public PlayerhomeManager getPlayerhomeManager() {
- return playerhomeManager;
- }
- public Map<UUID, List<UUID>> getTpaRequests() {
- return tpaRequests;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement