mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
Refractored .createBackup() to TFM_Util.createBackup(String)
This commit is contained in:
parent
a3f3903760
commit
796ef3d359
@ -32,7 +32,6 @@ public class Command_permban extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
playerMsg("Reloading permban list...", ChatColor.RED);
|
||||
TFM_PermbanList.createBackup();
|
||||
TFM_PermbanList.load();
|
||||
dumplist(sender);
|
||||
}
|
||||
|
@ -155,13 +155,6 @@ public class TFM_AdminList
|
||||
TFM_Log.info("Loaded " + adminList.size() + " admins (" + superUUIDs.size() + " active) and " + superIps.size() + " IPs.");
|
||||
}
|
||||
|
||||
public static void createBackup()
|
||||
{
|
||||
final File oldYaml = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE);
|
||||
final File newYaml = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE + ".bak");
|
||||
FileUtil.copy(oldYaml, newYaml);
|
||||
}
|
||||
|
||||
public static void updateIndexLists()
|
||||
{
|
||||
superUUIDs.clear();
|
||||
@ -423,7 +416,7 @@ public class TFM_AdminList
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isIdentityMatched(Player player)
|
||||
{
|
||||
if (!isSuperAdmin(player))
|
||||
|
@ -58,11 +58,4 @@ public class TFM_PermbanList
|
||||
|
||||
TFM_Log.info("Loaded " + PERMBANNED_PLAYERS.size() + " permanently banned players and " + PERMBANNED_IPS.size() + " permanently banned IPs.");
|
||||
}
|
||||
|
||||
public static void createBackup()
|
||||
{
|
||||
final File oldYaml = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PERMBAN_FILE);
|
||||
final File newYaml = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PERMBAN_FILE + ".bak");
|
||||
FileUtil.copy(oldYaml, newYaml);
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.FileUtil;
|
||||
|
||||
public class TFM_Util
|
||||
{
|
||||
@ -182,7 +183,7 @@ public class TFM_Util
|
||||
* @return The config-friendly IP address.
|
||||
* @see #fromEscapedString(String)
|
||||
*/
|
||||
public static String toEscapedString(String ip) // BukkitLib
|
||||
public static String toEscapedString(String ip) // BukkitLib @ https://github.com/Pravian/BukkitLib
|
||||
{
|
||||
return ip.trim().replaceAll("\\.", "_");
|
||||
}
|
||||
@ -199,7 +200,7 @@ public class TFM_Util
|
||||
* @return The config-friendly IP address.
|
||||
* @see #toEscapedString(String)
|
||||
*/
|
||||
public static String fromEscapedString(String escapedIp) // BukkitLib
|
||||
public static String fromEscapedString(String escapedIp) // BukkitLib @ https://github.com/Pravian/BukkitLib
|
||||
{
|
||||
return escapedIp.trim().replaceAll("_", "\\.");
|
||||
}
|
||||
@ -242,14 +243,14 @@ public class TFM_Util
|
||||
|
||||
public static void buildHistory(Location location, int length, TFM_PlayerData playerdata)
|
||||
{
|
||||
Block center = location.getBlock();
|
||||
final Block center = location.getBlock();
|
||||
for (int xOffset = -length; xOffset <= length; xOffset++)
|
||||
{
|
||||
for (int yOffset = -length; yOffset <= length; yOffset++)
|
||||
{
|
||||
for (int zOffset = -length; zOffset <= length; zOffset++)
|
||||
{
|
||||
Block block = center.getRelative(xOffset, yOffset, zOffset);
|
||||
final Block block = center.getRelative(xOffset, yOffset, zOffset);
|
||||
playerdata.insertHistoryBlock(block.getLocation(), block.getType());
|
||||
}
|
||||
}
|
||||
@ -258,7 +259,7 @@ public class TFM_Util
|
||||
|
||||
public static void generateCube(Location location, int length, Material material)
|
||||
{
|
||||
Block center = location.getBlock();
|
||||
final Block center = location.getBlock();
|
||||
for (int xOffset = -length; xOffset <= length; xOffset++)
|
||||
{
|
||||
for (int yOffset = -length; yOffset <= length; yOffset++)
|
||||
@ -277,7 +278,7 @@ public class TFM_Util
|
||||
|
||||
public static void generateHollowCube(Location location, int length, Material material)
|
||||
{
|
||||
Block center = location.getBlock();
|
||||
final Block center = location.getBlock();
|
||||
for (int xOffset = -length; xOffset <= length; xOffset++)
|
||||
{
|
||||
for (int yOffset = -length; yOffset <= length; yOffset++)
|
||||
@ -312,7 +313,7 @@ public class TFM_Util
|
||||
}
|
||||
|
||||
block.setType(Material.SKULL);
|
||||
Skull skull = (Skull) block.getState();
|
||||
final Skull skull = (Skull) block.getState();
|
||||
skull.setSkullType(SkullType.PLAYER);
|
||||
skull.setOwner("DarthSalamon");
|
||||
skull.update();
|
||||
@ -698,6 +699,13 @@ public class TFM_Util
|
||||
}
|
||||
}
|
||||
|
||||
public static void createBackup(String file)
|
||||
{
|
||||
final File oldYaml = new File(TotalFreedomMod.plugin.getDataFolder(), file);
|
||||
final File newYaml = new File(TotalFreedomMod.plugin.getDataFolder(), file + ".bak");
|
||||
FileUtil.copy(oldYaml, newYaml);
|
||||
}
|
||||
|
||||
public static String dateToString(Date date)
|
||||
{
|
||||
return new SimpleDateFormat(DATE_STORAGE_FORMAT, Locale.ENGLISH).format(date);
|
||||
|
@ -30,7 +30,7 @@ import org.mcstats.Metrics;
|
||||
|
||||
public class TotalFreedomMod extends JavaPlugin
|
||||
{
|
||||
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
||||
public static final long HEARTBEAT_RATE = 5L; // Seconds
|
||||
public static final long SERVICE_CHECKER_RATE = 120L;
|
||||
//
|
||||
public static final String SUPERADMIN_FILE = "superadmin.yml";
|
||||
@ -90,11 +90,11 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
}
|
||||
|
||||
// Admin list
|
||||
TFM_AdminList.createBackup();
|
||||
TFM_Util.createBackup(SUPERADMIN_FILE);
|
||||
TFM_AdminList.load();
|
||||
|
||||
// Permban list
|
||||
TFM_PermbanList.createBackup();
|
||||
TFM_Util.createBackup(PERMBAN_FILE);
|
||||
TFM_PermbanList.load();
|
||||
|
||||
// Playerlist and bans
|
||||
|
Loading…
Reference in New Issue
Block a user