mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
asdf (#91)
This commit is contained in:
@ -286,28 +286,39 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
try
|
||||
{
|
||||
final Properties props;
|
||||
final Properties gitprops;
|
||||
|
||||
try (InputStream in = plugin.getResource("build.properties"))
|
||||
{
|
||||
props = new Properties();
|
||||
props.load(in);
|
||||
}
|
||||
try (InputStream in = plugin.getResource("git.properties"))
|
||||
{
|
||||
gitprops = new Properties();
|
||||
gitprops.load(in);
|
||||
}
|
||||
|
||||
author = props.getProperty("buildAuthor", "unknown");
|
||||
codename = props.getProperty("buildCodeName", "unknown");
|
||||
version = props.getProperty("buildVersion", pluginVersion);
|
||||
number = props.getProperty("buildNumber", "1");
|
||||
date = gitprops.getProperty("git.build.time", "unknown");
|
||||
date = props.getProperty("buildDate", "unknown");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe("Could not load build properties! Did you compile with NetBeans/Maven?");
|
||||
FLog.severe(ex);
|
||||
}
|
||||
try
|
||||
{
|
||||
final Properties gitprops;
|
||||
|
||||
try (InputStream in = plugin.getResource("git.properties"))
|
||||
{
|
||||
gitprops = new Properties();
|
||||
gitprops.load(in);
|
||||
}
|
||||
|
||||
head = gitprops.getProperty("git.commit.id.abbrev", "unknown");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe("Could not load build properties! Did you compile with Netbeans/Maven?");
|
||||
FLog.severe("Could not load Git properties! Is there a valid .git directory?");
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ import java.util.List;
|
||||
public class CoreProtectBridge extends FreedomService
|
||||
{
|
||||
private CoreProtectAPI coreProtectAPI = null;
|
||||
|
||||
|
||||
private final List<String> tables = Arrays.asList("co_sign", "co_session", "co_container", "co_block");
|
||||
|
||||
|
||||
private BukkitTask wiper;
|
||||
|
||||
public CoreProtectBridge(TotalFreedomMod plugin)
|
||||
@ -56,7 +56,7 @@ public class CoreProtectBridge extends FreedomService
|
||||
|
||||
if (coreProtectPlugin != null && coreProtectPlugin instanceof CoreProtect)
|
||||
{
|
||||
coreProtect = (CoreProtect)coreProtectPlugin;
|
||||
coreProtect = (CoreProtect) coreProtectPlugin;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -73,9 +73,9 @@ public class CoreProtectBridge extends FreedomService
|
||||
try
|
||||
{
|
||||
final CoreProtect coreProtect = getCoreProtect();
|
||||
|
||||
|
||||
coreProtectAPI = coreProtect.getAPI();
|
||||
|
||||
|
||||
// Check if the plugin or api is not enabled, if so, return null
|
||||
if (!coreProtect.isEnabled() || !coreProtectAPI.isEnabled())
|
||||
{
|
||||
@ -90,7 +90,7 @@ public class CoreProtectBridge extends FreedomService
|
||||
|
||||
return coreProtectAPI;
|
||||
}
|
||||
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
final CoreProtect coreProtect = getCoreProtect();
|
||||
@ -117,7 +117,7 @@ public class CoreProtectBridge extends FreedomService
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
||||
|
||||
// Reverts a rollback for the specifed player's edits that were in the last 24 hours.
|
||||
public void undoRollback(final String name)
|
||||
{
|
||||
@ -137,7 +137,7 @@ public class CoreProtectBridge extends FreedomService
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
||||
|
||||
public File getDatabase()
|
||||
{
|
||||
if (!isEnabled())
|
||||
@ -145,9 +145,9 @@ public class CoreProtectBridge extends FreedomService
|
||||
return null;
|
||||
}
|
||||
|
||||
return(new File(getCoreProtect().getDataFolder(), "database.db"));
|
||||
return (new File(getCoreProtect().getDataFolder(), "database.db"));
|
||||
}
|
||||
|
||||
|
||||
private void createAutomaticWiper()
|
||||
{
|
||||
final long interval = 10 * 20L;
|
||||
@ -165,15 +165,15 @@ public class CoreProtectBridge extends FreedomService
|
||||
FUtil.bcastMsg("The CoreProtect log file has grown too big for the server to cope, the data is being wiped!", ChatColor.RED);
|
||||
PluginManager pluginManager = server.getPluginManager();
|
||||
pluginManager.disablePlugin(coreProtect);
|
||||
for(World world : Bukkit.getWorlds())
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
if(!world.equals(plugin.wm.adminworld.getWorld()))
|
||||
if (!world.equals(plugin.wm.adminworld.getWorld()))
|
||||
{
|
||||
clearDatabase(world);
|
||||
}
|
||||
}
|
||||
//check if still too big, if so delete all data
|
||||
if(getDBSize() > ConfigEntry.COREPROTECT_FILE_LIMIT.getInteger())
|
||||
if (getDBSize() > ConfigEntry.COREPROTECT_FILE_LIMIT.getInteger())
|
||||
{
|
||||
FUtil.deleteFolder(databaseFile);
|
||||
}
|
||||
@ -182,6 +182,7 @@ public class CoreProtectBridge extends FreedomService
|
||||
}
|
||||
}.runTaskTimer(plugin, interval, interval);
|
||||
}
|
||||
|
||||
public double getDBSize()
|
||||
{
|
||||
double bytes = getDatabase().length();
|
||||
@ -189,6 +190,7 @@ public class CoreProtectBridge extends FreedomService
|
||||
double megabytes = (kilobytes / 1024);
|
||||
return (megabytes / 1024);
|
||||
}
|
||||
|
||||
// Wipes DB for the specified world
|
||||
public void clearDatabase(World world)
|
||||
{
|
||||
@ -214,7 +216,7 @@ public class CoreProtectBridge extends FreedomService
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + databaseFile);
|
||||
final Statement statement = connection.createStatement();
|
||||
statement.setQueryTimeout(30);
|
||||
|
||||
|
||||
// Obtain world ID from CoreProtect database
|
||||
ResultSet resultSet = statement.executeQuery("SELECT id FROM co_world WHERE world = '" + world.getName() + "'");
|
||||
String worldID = null;
|
||||
@ -250,7 +252,7 @@ public class CoreProtectBridge extends FreedomService
|
||||
// This exits for flatlands wipes
|
||||
if (shutdown)
|
||||
{
|
||||
if(plugin.amp.enabled)
|
||||
if (plugin.amp.enabled)
|
||||
{
|
||||
plugin.amp.restartServer();
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ public class Command_cage extends FreedomCommand
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Location location = player.getLocation().clone().add(0.0, 1.0, 0.0);
|
||||
if (skullName != null)
|
||||
{
|
||||
@ -95,7 +96,7 @@ public class Command_cage extends FreedomCommand
|
||||
fPlayer.getCageData().cage(location, outerMaterial, innerMaterial);
|
||||
}
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
if (outerMaterial == Material.PLAYER_HEAD)
|
||||
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class Command_premium extends FreedomCommand
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
msg("There was an error querying the mojang server.", ChatColor.RED);
|
||||
msg("There was an error querying the Mojang server.", ChatColor.RED);
|
||||
}
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
||||
|
@ -15,7 +15,7 @@ public class Command_restart extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if(!plugin.amp.enabled)
|
||||
if (!plugin.amp.enabled)
|
||||
{
|
||||
msg(ChatColor.RED + "AMP integration is not enabled. Please use /stop instead.");
|
||||
return true;
|
||||
|
@ -15,6 +15,12 @@ public class Command_wipecoreprotectdata extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!plugin.cpb.isEnabled())
|
||||
{
|
||||
msg("CoreProtect is not enabled on this server");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Wiping CoreProtect data for the flatlands", true);
|
||||
|
||||
new BukkitRunnable()
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Wipe the flatlands map. Requires manual restart after command is used.", usage = "/<command>")
|
||||
@ -20,7 +19,10 @@ public class Command_wipeflatlands extends FreedomCommand
|
||||
|
||||
FUtil.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);
|
||||
|
||||
plugin.wgb.wipeRegions(plugin.wm.flatlands.getWorld());
|
||||
if (plugin.wgb.isPluginEnabled())
|
||||
{
|
||||
plugin.wgb.wipeRegions(plugin.wm.flatlands.getWorld());
|
||||
}
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -38,7 +38,6 @@ public class Command_wipeuserdata extends FreedomCommand
|
||||
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(plugin.wm.flatlands.getName()).getWorldFolder().getName() + "stats"));
|
||||
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(w.getName()).getWorldFolder().getName() + "stats"));
|
||||
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(w.getName()).getWorldFolder().getName() + "playerdata"));
|
||||
|
||||
msg("All playerdata deleted.");
|
||||
return true;
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package me.totalfreedom.totalfreedommod.freeze;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
|
||||
import static me.totalfreedom.totalfreedommod.TotalFreedomMod.plugin;
|
||||
import static me.totalfreedom.totalfreedommod.player.FPlayer.AUTO_PURGE_TICKS;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
@ -36,7 +38,7 @@ public class FreezeData
|
||||
final Player player = fPlayer.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
FLog.info("Could not freeze " + fPlayer.getName() + ". Player not online!");
|
||||
FLog.info("Could not freeze " + player.getName() + ". Player not online!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -62,14 +64,14 @@ public class FreezeData
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!fPlayer.getPlugin().al.isAdminImpostor(player) && !fPlayer.getPlugin().pv.isPlayerImpostor(player))
|
||||
if (!plugin().al.isAdminImpostor(player) && plugin().pv.isPlayerImpostor(player))
|
||||
{
|
||||
FUtil.adminAction("TotalFreedom", "Unfreezing " + player.getName(), false);
|
||||
setFrozen(false);
|
||||
}
|
||||
}
|
||||
|
||||
}.runTaskLater(fPlayer.getPlugin(), AUTO_PURGE_TICKS);
|
||||
}.runTaskLater(plugin(), AUTO_PURGE_TICKS);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,11 @@ public class Freezer extends FreedomService
|
||||
{
|
||||
}
|
||||
|
||||
public boolean isGlobalFreeze()
|
||||
{
|
||||
return this.globalFreeze;
|
||||
}
|
||||
|
||||
public void setGlobalFreeze(boolean frozen)
|
||||
{
|
||||
this.globalFreeze = frozen;
|
||||
@ -65,7 +70,7 @@ public class Freezer extends FreedomService
|
||||
|
||||
FUtil.setFlying(player, true);
|
||||
|
||||
Location loc = fd.getLocation();
|
||||
Location loc = player.getLocation();
|
||||
if (loc == null)
|
||||
{
|
||||
loc = event.getFrom();
|
||||
|
@ -56,7 +56,6 @@ public class ItemFun extends FreedomService
|
||||
|
||||
switch (event.getMaterial())
|
||||
{
|
||||
case TROPICAL_FISH:
|
||||
{
|
||||
final int RADIUS_HIT = 5;
|
||||
final int STRENGTH = 4;
|
||||
|
@ -141,6 +141,31 @@ public class FPlayer
|
||||
this.invSee = toggle;
|
||||
}
|
||||
|
||||
public boolean isEditBlocked()
|
||||
{
|
||||
return editBlocked;
|
||||
}
|
||||
|
||||
public void setEditBlocked(boolean toggle)
|
||||
{
|
||||
this.editBlocked = toggle;
|
||||
}
|
||||
|
||||
public boolean isPvpBlocked()
|
||||
{
|
||||
return pvpBlocked;
|
||||
}
|
||||
|
||||
public CageData getCageData()
|
||||
{
|
||||
return cageData;
|
||||
}
|
||||
|
||||
public void setPvpBlocked(boolean toggle)
|
||||
{
|
||||
this.pvpBlocked = toggle;
|
||||
}
|
||||
|
||||
public boolean isFuckOff()
|
||||
{
|
||||
return fuckoffRadius > 0;
|
||||
@ -353,6 +378,12 @@ public class FPlayer
|
||||
this.inAdminchat = inAdminchat;
|
||||
}
|
||||
|
||||
public FreezeData getFreezeData()
|
||||
{
|
||||
return freezeData;
|
||||
}
|
||||
|
||||
|
||||
public boolean inAdminChat()
|
||||
{
|
||||
return this.inAdminchat;
|
||||
|
@ -82,20 +82,15 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
return ips.remove(ip);
|
||||
}
|
||||
|
||||
public void setDiscordId(final String discordId)
|
||||
{
|
||||
this.discordId = discordId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
return name != null
|
||||
&& !ips.isEmpty();
|
||||
}
|
||||
|
||||
public boolean getForumEnabled()
|
||||
{
|
||||
return this.forumEnabled;
|
||||
}
|
||||
|
||||
public boolean getDiscordEnabled()
|
||||
{
|
||||
return this.discordEnabled;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public final class AdminWorld extends CustomWorld
|
||||
@Override
|
||||
protected World generateWorld()
|
||||
{
|
||||
final WorldCreator worldCreator = new WorldCreator(getName());
|
||||
final WorldCreator worldCreator = new WorldCreator(WORLD_NAME);
|
||||
worldCreator.generateStructures(false);
|
||||
worldCreator.type(WorldType.NORMAL);
|
||||
worldCreator.environment(World.Environment.NORMAL);
|
||||
|
@ -23,6 +23,7 @@ public class Flatlands extends CustomWorld
|
||||
{
|
||||
super("flatlands");
|
||||
}
|
||||
private static final String WORLD_NAME = "flatlands";
|
||||
|
||||
@Override
|
||||
protected World generateWorld()
|
||||
@ -89,4 +90,8 @@ public class Flatlands extends CustomWorld
|
||||
}
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.WORLD_NAME;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ public final class MasterBuilderWorld extends CustomWorld
|
||||
//
|
||||
private WorldWeather weather = WorldWeather.OFF;
|
||||
private WorldTime time = WorldTime.INHERIT;
|
||||
private static final String WORLD_NAME = "masterbuilderworld";
|
||||
|
||||
public MasterBuilderWorld()
|
||||
{
|
||||
@ -43,7 +44,7 @@ public final class MasterBuilderWorld extends CustomWorld
|
||||
@Override
|
||||
protected World generateWorld()
|
||||
{
|
||||
final WorldCreator worldCreator = new WorldCreator(getName());
|
||||
final WorldCreator worldCreator = new WorldCreator(WORLD_NAME);
|
||||
worldCreator.generateStructures(false);
|
||||
worldCreator.type(WorldType.NORMAL);
|
||||
worldCreator.environment(World.Environment.NORMAL);
|
||||
|
Reference in New Issue
Block a user