mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 07:46:31 +00:00
Update TotalFreedomMod.java
This commit is contained in:
parent
d6b5585a49
commit
4a376fb674
1 changed files with 27 additions and 1 deletions
|
@ -24,6 +24,9 @@ import me.StevenLawson.TotalFreedomMod.world.FlatlandsWorld;
|
||||||
import me.StevenLawson.TotalFreedomMod.world.ProtectedArea;
|
import me.StevenLawson.TotalFreedomMod.world.ProtectedArea;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
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.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.ServicePriority;
|
import org.bukkit.plugin.ServicePriority;
|
||||||
|
@ -31,6 +34,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -45,6 +49,7 @@ public class TotalFreedomMod extends JavaPlugin {
|
||||||
public static final String CONFIG_FILENAME = "config.yml";
|
public static final String CONFIG_FILENAME = "config.yml";
|
||||||
public static final String SUPERADMIN_FILENAME = "superadmin.yml";
|
public static final String SUPERADMIN_FILENAME = "superadmin.yml";
|
||||||
public static final String PERMBAN_FILENAME = "permban.yml";
|
public static final String PERMBAN_FILENAME = "permban.yml";
|
||||||
|
public static final String PLAYERTAGS_FILENAME = "playerTags.yml";
|
||||||
public static final String UUID_FILENAME = "uuids.db";
|
public static final String UUID_FILENAME = "uuids.db";
|
||||||
public static final String PROTECTED_AREA_FILENAME = "protectedareas.dat";
|
public static final String PROTECTED_AREA_FILENAME = "protectedareas.dat";
|
||||||
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
||||||
|
@ -65,6 +70,7 @@ public class TotalFreedomMod extends JavaPlugin {
|
||||||
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<>();
|
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<>();
|
||||||
public static Logger logger;
|
public static Logger logger;
|
||||||
|
|
||||||
|
private FileConfiguration customConfig; // Custom configuration implementation by Eva
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
|
@ -103,7 +109,8 @@ public class TotalFreedomMod extends JavaPlugin {
|
||||||
Utilities.createBackups(CONFIG_FILENAME, true);
|
Utilities.createBackups(CONFIG_FILENAME, true);
|
||||||
Utilities.createBackups(SUPERADMIN_FILENAME);
|
Utilities.createBackups(SUPERADMIN_FILENAME);
|
||||||
Utilities.createBackups(PERMBAN_FILENAME);
|
Utilities.createBackups(PERMBAN_FILENAME);
|
||||||
|
Utilities.createBackups(PLAYERTAGS_FILENAME);
|
||||||
|
this.createCustomConfig();
|
||||||
// Load services
|
// Load services
|
||||||
UUIDManager.load();
|
UUIDManager.load();
|
||||||
AdminList.load();
|
AdminList.load();
|
||||||
|
@ -219,6 +226,25 @@ public class TotalFreedomMod extends JavaPlugin {
|
||||||
return CommandHandler.handleCommand(sender, cmd, commandLabel, args);
|
return CommandHandler.handleCommand(sender, cmd, commandLabel, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileConfiguration getCustomConfig() {
|
||||||
|
return this.customConfig;
|
||||||
|
}
|
||||||
|
//CustomConfig implementation by Eva
|
||||||
|
private void createCustomConfig() {
|
||||||
|
File customConfigFile = new File(getDataFolder(), "playerTags.yml");
|
||||||
|
if (!customConfigFile.exists()) {
|
||||||
|
customConfigFile.getParentFile().mkdirs();
|
||||||
|
saveResource("playerTags.yml", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
customConfig= new YamlConfiguration();
|
||||||
|
try {
|
||||||
|
customConfig.load(customConfigFile);
|
||||||
|
} catch (IOException | InvalidConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void setAppProperties()
|
private static void setAppProperties()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in a new issue