This commit is contained in:
Telesphoreo 2018-07-24 19:44:00 -07:00 committed by Seth
parent 0d503a6c06
commit 7278176143
24 changed files with 184 additions and 53 deletions

View File

@ -40,7 +40,7 @@
<scm>
<connection>scm:git:git@github.com:TFPatches/TotalFreedomMod.git</connection>
<developerConnection>scm:git:git@github.com:TFPatches/TotalFreedomMod.git</developerConnection>
<url>git@github.com:TotalFreedom/TFPatches.git</url>
<url>git@github.com:TFPatches/TotalFreedomMod.git</url>
</scm>
<repositories>
@ -151,6 +151,7 @@
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.7.1_385</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -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);
}
}

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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()

View File

@ -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())
{

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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();

View File

@ -56,7 +56,6 @@ public class ItemFun extends FreedomService
switch (event.getMaterial())
{
case TROPICAL_FISH:
{
final int RADIUS_HIT = 5;
final int STRENGTH = 4;

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);

View File

@ -1,5 +1,5 @@
#
# TotalFreedomMod 5.0 Admin List
# TotalFreedomMod 5.2 Admin List
#
prozza:

View File

@ -1,3 +1,3 @@
#
# TotalFreedomMod 5.0 Player Bans
# TotalFreedomMod 5.2 Player Bans
#

View File

@ -1,5 +1,5 @@
#
# TotalFreedomMod 5.0 Configuration
# TotalFreedomMod 5.2 Configuration
# by Madgeek1450 and Prozza
#

View File

@ -1,3 +1,3 @@
#
# TotalFreedomMod 5.0 Master Builder List
# TotalFreedomMod 5.2 Master Builder List
#

View File

@ -1,5 +1,5 @@
#
# TotalFreedomMod 5.0 Permanent Bans
# TotalFreedomMod 5.2 Permanent Bans
#
badplayer1:

View File

@ -1,3 +1,3 @@
#
# TotalFreedomMod 5.0 Player Punishments
# TotalFreedomMod 5.2 Player Punishments
#

71
totalfreedom.iml Normal file
View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13-pre7-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.18" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-LibsDisguises:c213295f95" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.4.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-bukkit:2e79570525" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-core:2e79570525" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:jchronic:0.2.4a" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.thoughtworks.paranamer:paranamer:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.lib:jlibnoise:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sk89q.bukkit:bukkit-classloader-check:1.7.9-R0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:dummypermscompat:1.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.13-pre7-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:3.7.1_385" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20160810" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java:1.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java-api:1.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.dev.jna:jna:4.4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java-natives:1.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.neovisionaries:nv-websocket-client:2.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
<orderEntry type="module-library">
<library name="Maven: net.coreprotect:CoreProtect:2.14.2">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/CoreProtect_2.14.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-legacy:6.2" level="project" />
</component>
</module>