Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onEnable() {
- DataFile classDataFile = new DataFile();
- plugin = this;
- // DATA FILES
- createFiles();
- DataFile.setupDataFile();
- DataFile.getDataFile().options().copyDefaults(true);
- DataFile.saveDataFile();
- DataFile.getDataFile().createSection("callsigns");
- // RESTORE CALLSIGNS IN "data.yml" TO HASHMAP
- for (String key : DataFile.getDataFile().getConfigurationSection("callsigns").getKeys(false)) {
- UUID uuid = UUID.fromString(key);
- ConfigurationSection dataFileSec = DataFile.getDataFile().getConfigurationSection("callsigns." + key);
- String cs = dataFileSec.getString("cs");
- classDataFile.getCallsignMap().put(uuid, cs);
- }
- // Luck Perms Init
- RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
- if (provider != null) {
- luckPerms = provider.getProvider();
- }
- // LISTENER REGISTER
- this.getServer().getPluginManager().registerEvents(new LocalChatListener(luckPerms), this);
- // COMMAND REGISTER
- this.getCommand("global").setExecutor(new GlobalCommand(luckPerms));
- this.getCommand("global").setTabCompleter(new TabComplete());
- this.getCommand("advert").setExecutor(new AdCommand(luckPerms));
- this.getCommand("advert").setTabCompleter(new TabComplete());
- this.getCommand("news").setExecutor(new NewsCommand(luckPerms));
- this.getCommand("news").setTabCompleter(new TabComplete());
- this.getCommand("blackmarket").setExecutor(new BlackmarketCommand(luckPerms));
- this.getCommand("blackmarket").setTabCompleter(new TabComplete());
- this.getCommand("callsign").setExecutor(new CallsignCommand(luckPerms));
- this.getCommand("callsign").setTabCompleter(new CallsignTabComplete());
- // ENABLED
- log.info("CityRP-Chat v1.4 Enabled. Created by aDrew1");
- }
- @Override
- public void onDisable() {
- // SAVE CALLSIGNS IN HASHMAP TO "data.yml"
- DataFile classDataFile = new DataFile();
- for (UUID uuid : classDataFile.getCallsignMap().keySet()) {
- String key = uuid.toString();
- String cs = classDataFile.getCallsignMap().get(uuid);
- DataFile.getDataFile().createSection("callsigns." + key);
- ConfigurationSection configSec = DataFile.getDataFile().getConfigurationSection("callsigns." + key);
- configSec.set("cs", cs);
- DataFile.saveDataFile();
- }
- log.info("CityRP-Chat v1.4 Disabled. Created by aDrew1");
- }
Advertisement
Add Comment
Please, Sign In to add comment