This update makes the plugin easier to set up (:
This commit is contained in:
parent
0b626397a5
commit
2b0bfae44c
@ -2,6 +2,7 @@ package com.massivecraft.factions;
|
||||
|
||||
import ch.njol.skript.Skript;
|
||||
import ch.njol.skript.SkriptAddon;
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.cmd.CmdAutoHelp;
|
||||
@ -185,6 +186,8 @@ public class FactionsPlugin extends MPlugin {
|
||||
this.loadSuccessful = false;
|
||||
|
||||
saveDefaultConfig();
|
||||
//Attempt to generate a permission list
|
||||
PermissionList.generateFile();
|
||||
|
||||
// Load Conf from disk
|
||||
Conf.load();
|
||||
@ -289,9 +292,15 @@ public class FactionsPlugin extends MPlugin {
|
||||
|
||||
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
|
||||
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("Vault") && FactionsPlugin.this.getServer().getServicesManager().getRegistration(Essentials.class) != null) {
|
||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
FactionsPlugin.econ = rsp.getProvider();
|
||||
} else {
|
||||
divider();
|
||||
System.out.println("You are missing dependencies!");
|
||||
System.out.println("Please verify EssentialsX and Vault are installed!");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
}
|
||||
|
||||
if (getDescription().getFullName().contains("BETA")) {
|
||||
divider();
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class PermissionList {
|
||||
public static void generateFile() {
|
||||
File file = new File(FactionsPlugin.getInstance().getDataFolder().toString() + "/" + "permissions.yml");
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
FactionsPlugin.getInstance().log("Generating a file with all permissions...");
|
||||
file.createNewFile();
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
for (Permission p : Permission.values()) {
|
||||
config.set(p.node, p.name());
|
||||
}
|
||||
config.save(file);
|
||||
FactionsPlugin.getInstance().log("Generation complete you can find this file at " + FactionsPlugin.getInstance().getDataFolder().toString() + "/" + "permissions.yml");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user