mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Merge branch 'development' of https://github.com/AtlasMediaGroup/TotalFreedomMod into development
This commit is contained in:
commit
fefb750b47
7
pom.xml
7
pom.xml
@ -100,8 +100,7 @@
|
|||||||
<id>esentialsx-repo</id>
|
<id>esentialsx-repo</id>
|
||||||
<url>https://repo.essentialsx.net/releases/</url>
|
<url>https://repo.essentialsx.net/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -411,14 +410,10 @@
|
|||||||
</relocations>
|
</relocations>
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>commons-io:commons-io</include>
|
|
||||||
<include>org.apache.commons:commons-lang3</include>
|
|
||||||
<include>org.reflections:reflections</include>
|
<include>org.reflections:reflections</include>
|
||||||
<include>org.javassist:javassist</include>
|
|
||||||
<include>io.papermc:paperlib</include>
|
<include>io.papermc:paperlib</include>
|
||||||
<include>org.bstats:bstats-bukkit</include>
|
<include>org.bstats:bstats-bukkit</include>
|
||||||
<include>org.bstats:bstats-base</include>
|
<include>org.bstats:bstats-base</include>
|
||||||
<include>org.jetbrains:annotations</include>
|
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -1,201 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.NoSuchProviderException;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class LogViewer extends FreedomService
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onStart()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateLogsRegistration(final CommandSender sender, final Player target, final LogsRegistrationMode mode)
|
|
||||||
{
|
|
||||||
updateLogsRegistration(sender, target.getName(), mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateLogsRegistration(final CommandSender sender, final String targetName, final LogsRegistrationMode mode)
|
|
||||||
{
|
|
||||||
final String logsRegisterUrl = ConfigEntry.LOGS_URL.getString();
|
|
||||||
final String logsRegisterPassword = ConfigEntry.LOGS_SECRET.getString();
|
|
||||||
|
|
||||||
if (logsRegisterUrl == null || logsRegisterPassword == null || logsRegisterUrl.isEmpty() || logsRegisterPassword.isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
new BukkitRunnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (sender != null)
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Connecting...");
|
|
||||||
}
|
|
||||||
|
|
||||||
final String key = SecureCodeGenerator.generateCode(20);
|
|
||||||
|
|
||||||
final URL urlAdd = new URLBuilder(logsRegisterUrl)
|
|
||||||
.addQueryParameter("mode", mode.name())
|
|
||||||
.addQueryParameter("password", logsRegisterPassword)
|
|
||||||
.addQueryParameter("name", targetName)
|
|
||||||
.addQueryParameter("key", key)
|
|
||||||
.getURL();
|
|
||||||
|
|
||||||
final HttpURLConnection connection = (HttpURLConnection)urlAdd.openConnection();
|
|
||||||
connection.setConnectTimeout(1000 * 5);
|
|
||||||
connection.setReadTimeout(1000 * 5);
|
|
||||||
connection.setUseCaches(false);
|
|
||||||
connection.setRequestMethod("HEAD");
|
|
||||||
|
|
||||||
final int responseCode = connection.getResponseCode();
|
|
||||||
|
|
||||||
if (sender != null)
|
|
||||||
{
|
|
||||||
if (!plugin.isEnabled())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
new BukkitRunnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
if (responseCode == 200)
|
|
||||||
{
|
|
||||||
if (mode == LogsRegistrationMode.ADD)
|
|
||||||
{
|
|
||||||
String link = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
final URL urlVerify = new URLBuilder(logsRegisterUrl)
|
|
||||||
.addQueryParameter("mode", LogsRegistrationMode.VERIFY.name())
|
|
||||||
.addQueryParameter("name", targetName)
|
|
||||||
.addQueryParameter("key", key)
|
|
||||||
.getURL();
|
|
||||||
link = urlVerify.toString();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
FLog.severe(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Open this link to verify your logviewer registration:\n" + ChatColor.DARK_GREEN + link);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Logviewer access revoked successfully.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.RED + "Error contacting logs registration server.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.runTask(plugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
FLog.severe(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.runTaskAsynchronously(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum LogsRegistrationMode
|
|
||||||
{
|
|
||||||
|
|
||||||
ADD, DELETE, VERIFY
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class URLBuilder
|
|
||||||
{
|
|
||||||
|
|
||||||
private final String requestPath;
|
|
||||||
private final Map<String, String> queryStringMap = new HashMap<>();
|
|
||||||
|
|
||||||
private URLBuilder(String requestPath)
|
|
||||||
{
|
|
||||||
this.requestPath = requestPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public URLBuilder addQueryParameter(String key, String value)
|
|
||||||
{
|
|
||||||
queryStringMap.put(key, value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public URL getURL() throws MalformedURLException
|
|
||||||
{
|
|
||||||
List<String> pairs = new ArrayList<>();
|
|
||||||
for (Map.Entry<String, String> pair : queryStringMap.entrySet())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
pairs.add(URLEncoder.encode(pair.getKey(), "UTF-8") + "=" + URLEncoder.encode(pair.getValue(), "UTF-8"));
|
|
||||||
}
|
|
||||||
catch (UnsupportedEncodingException ex)
|
|
||||||
{
|
|
||||||
FLog.severe(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new URL(requestPath + "?" + StringUtils.join(pairs, "&"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class SecureCodeGenerator
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final String CHARACTER_SET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
||||||
|
|
||||||
public static String generateCode(final int length)
|
|
||||||
{
|
|
||||||
SecureRandom random;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
random = SecureRandom.getInstance("SHA1PRNG", "SUN");
|
|
||||||
}
|
|
||||||
catch (NoSuchAlgorithmException | NoSuchProviderException ex)
|
|
||||||
{
|
|
||||||
random = new SecureRandom();
|
|
||||||
FLog.severe(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
|
||||||
for (int i = 0; i < length; i++)
|
|
||||||
{
|
|
||||||
sb.append(CHARACTER_SET.charAt(random.nextInt(CHARACTER_SET.length())));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -72,7 +72,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public CommandLoader cl;
|
public CommandLoader cl;
|
||||||
// Services
|
// Services
|
||||||
public WorldManager wm;
|
public WorldManager wm;
|
||||||
public LogViewer lv;
|
|
||||||
public AdminList al;
|
public AdminList al;
|
||||||
public ActivityLog acl;
|
public ActivityLog acl;
|
||||||
public RankManager rm;
|
public RankManager rm;
|
||||||
@ -283,7 +282,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
// Start services
|
// Start services
|
||||||
wm = new WorldManager();
|
wm = new WorldManager();
|
||||||
lv = new LogViewer();
|
|
||||||
sql = new SQLite();
|
sql = new SQLite();
|
||||||
al = new AdminList();
|
al = new AdminList();
|
||||||
acl = new ActivityLog();
|
acl = new ActivityLog();
|
||||||
|
@ -4,7 +4,6 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
@ -184,8 +183,6 @@ public class Admin
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.lv.updateLogsRegistration(null, getName(), LogsRegistrationMode.DELETE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class BlockBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
case STRUCTURE_BLOCK:
|
case STRUCTURE_BLOCK:
|
||||||
{
|
{
|
||||||
if (!ConfigEntry.ALLOW_STRUCTURE_BLOCKS.getBoolean())
|
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
@ -77,7 +77,7 @@ public class BlockBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
case JIGSAW:
|
case JIGSAW:
|
||||||
{
|
{
|
||||||
if (!ConfigEntry.ALLOW_JIGSAWS.getBoolean())
|
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
|
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
@ -85,6 +85,16 @@ public class BlockBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case REPEATING_COMMAND_BLOCK:
|
||||||
|
case CHAIN_COMMAND_BLOCK:
|
||||||
|
case COMMAND_BLOCK:
|
||||||
|
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
|
||||||
|
{
|
||||||
|
player.sendMessage(ChatColor.GRAY + "Command blocks are disabled.");
|
||||||
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case GRINDSTONE:
|
case GRINDSTONE:
|
||||||
{
|
{
|
||||||
if (!ConfigEntry.ALLOW_GRINDSTONES.getBoolean())
|
if (!ConfigEntry.ALLOW_GRINDSTONES.getBoolean())
|
||||||
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
import io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent;
|
import io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
@ -119,6 +119,28 @@ public class EventBlocker extends FreedomService
|
|||||||
event.setYield(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue());
|
event.setYield(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void onBlockExplode(BlockExplodeEvent event)
|
||||||
|
{
|
||||||
|
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setYield(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void onMasterBlockFire(MasterBlockFireEvent event)
|
||||||
|
{
|
||||||
|
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getAt().getBlock().setType(Material.CAKE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntityCombust(EntityCombustEvent event)
|
public void onEntityCombust(EntityCombustEvent event)
|
||||||
{
|
{
|
||||||
@ -150,12 +172,9 @@ public class EventBlocker extends FreedomService
|
|||||||
if (ConfigEntry.ENABLE_PET_PROTECT.getBoolean())
|
if (ConfigEntry.ENABLE_PET_PROTECT.getBoolean())
|
||||||
{
|
{
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity instanceof Tameable)
|
if (entity instanceof Tameable tameable && tameable.isTamed())
|
||||||
{
|
{
|
||||||
if (((Tameable)entity).isTamed())
|
event.setCancelled(true);
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,24 +69,17 @@ public class InteractBlocker extends FreedomService
|
|||||||
private void handleRightClick(PlayerInteractEvent event)
|
private void handleRightClick(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
final Block clickedBlock = event.getClickedBlock();
|
||||||
|
|
||||||
if (event.getClickedBlock() != null)
|
if (clickedBlock != null && clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean())
|
||||||
{
|
{
|
||||||
if (event.getClickedBlock().getType().equals(Material.STRUCTURE_BLOCK) || event.getClickedBlock().getType().equals(Material.JIGSAW) || event.getClickedBlock().getType().equals(Material.RESPAWN_ANCHOR))
|
event.setCancelled(true);
|
||||||
{
|
return;
|
||||||
event.setCancelled(true);
|
|
||||||
event.getPlayer().closeInventory();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Groups.SPAWN_EGGS.contains(event.getMaterial()))
|
if (Groups.SPAWN_EGGS.contains(event.getMaterial()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Block clickedBlock = event.getClickedBlock();
|
|
||||||
if (clickedBlock == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EntityType eggType = null;
|
EntityType eggType = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -104,7 +97,7 @@ public class InteractBlocker extends FreedomService
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
if (eggType != null)
|
if (eggType != null && clickedBlock != null)
|
||||||
{
|
{
|
||||||
clickedBlock.getWorld().spawnEntity(clickedBlock.getLocation().add(event.getBlockFace().getDirection()).add(0.5, 0.5, 0.5), eggType);
|
clickedBlock.getWorld().spawnEntity(clickedBlock.getLocation().add(event.getBlockFace().getDirection()).add(0.5, 0.5, 0.5), eggType);
|
||||||
}
|
}
|
||||||
@ -178,6 +171,11 @@ public class InteractBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
case WRITTEN_BOOK:
|
case WRITTEN_BOOK:
|
||||||
{
|
{
|
||||||
|
if (ConfigEntry.ALLOW_BOOKS.getBoolean())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
player.getInventory().clear(player.getInventory().getHeldItemSlot());
|
player.getInventory().clear(player.getInventory().getHeldItemSlot());
|
||||||
player.sendMessage(ChatColor.GRAY + "Books are currently disabled.");
|
player.sendMessage(ChatColor.GRAY + "Books are currently disabled.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
|
||||||
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
|
|
||||||
public class Command_logs extends FreedomCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
LogsRegistrationMode mode = LogsRegistrationMode.ADD;
|
|
||||||
if (args.length == 1 && "off".equalsIgnoreCase(args[0]))
|
|
||||||
{
|
|
||||||
mode = LogsRegistrationMode.DELETE;
|
|
||||||
}
|
|
||||||
plugin.lv.updateLogsRegistration(sender, playerSender, mode);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,7 +19,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
private final List<String> toggles = Arrays.asList(
|
private final List<String> toggles = Arrays.asList(
|
||||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
|
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
|
||||||
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "structureblocks", "jigsaws", "grindstones",
|
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "masterblocks", "books", "grindstones",
|
||||||
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
|
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
|
||||||
"landmines", "tossmob", "gravity");
|
"landmines", "tossmob", "gravity");
|
||||||
|
|
||||||
@ -193,15 +193,15 @@ public class Command_toggle extends FreedomCommand
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "structureblocks":
|
case "masterblocks":
|
||||||
{
|
{
|
||||||
toggle("Structure blocks are", ConfigEntry.ALLOW_STRUCTURE_BLOCKS);
|
toggle("Master blocks are", ConfigEntry.ALLOW_MASTERBLOCKS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "jigsaws":
|
case "books":
|
||||||
{
|
{
|
||||||
toggle("Jigsaws are", ConfigEntry.ALLOW_JIGSAWS);
|
toggle("Books are", ConfigEntry.ALLOW_BOOKS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@ public enum ConfigEntry
|
|||||||
ALLOW_BELLS(Boolean.class, "allow.bells"),
|
ALLOW_BELLS(Boolean.class, "allow.bells"),
|
||||||
ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"),
|
ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"),
|
||||||
ALLOW_MINECARTS(Boolean.class, "allow.minecarts"),
|
ALLOW_MINECARTS(Boolean.class, "allow.minecarts"),
|
||||||
ALLOW_STRUCTURE_BLOCKS(Boolean.class, "allow.structureblocks"),
|
|
||||||
ALLOW_JIGSAWS(Boolean.class, "allow.jigsaws"),
|
|
||||||
ALLOW_GRINDSTONES(Boolean.class, "allow.grindstones"),
|
ALLOW_GRINDSTONES(Boolean.class, "allow.grindstones"),
|
||||||
ALLOW_JUKEBOXES(Boolean.class, "allow.jukeboxes"),
|
ALLOW_JUKEBOXES(Boolean.class, "allow.jukeboxes"),
|
||||||
ALLOW_SPAWNERS(Boolean.class, "allow.spawners"),
|
ALLOW_SPAWNERS(Boolean.class, "allow.spawners"),
|
||||||
@ -35,6 +33,8 @@ public enum ConfigEntry
|
|||||||
AUTO_TP(Boolean.class, "allow.auto_tp"),
|
AUTO_TP(Boolean.class, "allow.auto_tp"),
|
||||||
AUTO_CLEAR(Boolean.class, "allow.auto_clear"),
|
AUTO_CLEAR(Boolean.class, "allow.auto_clear"),
|
||||||
ALLOW_GRAVITY(Boolean.class, "allow.gravity"),
|
ALLOW_GRAVITY(Boolean.class, "allow.gravity"),
|
||||||
|
ALLOW_MASTERBLOCKS(Boolean.class, "allow.masterblocks"),
|
||||||
|
ALLOW_BOOKS(Boolean.class, "allow.books"),
|
||||||
//
|
//
|
||||||
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
||||||
//
|
//
|
||||||
@ -140,9 +140,6 @@ public enum ConfigEntry
|
|||||||
AUTOKICK_THRESHOLD(Double.class, "autokick.threshold"),
|
AUTOKICK_THRESHOLD(Double.class, "autokick.threshold"),
|
||||||
AUTOKICK_TIME(Integer.class, "autokick.time"),
|
AUTOKICK_TIME(Integer.class, "autokick.time"),
|
||||||
//
|
//
|
||||||
LOGS_SECRET(String.class, "logs.secret"),
|
|
||||||
LOGS_URL(String.class, "logs.url"),
|
|
||||||
//
|
|
||||||
FLATLANDS_GENERATE(Boolean.class, "flatlands.generate"),
|
FLATLANDS_GENERATE(Boolean.class, "flatlands.generate"),
|
||||||
FLATLANDS_GENERATE_PARAMS(String.class, "flatlands.generate_params"),
|
FLATLANDS_GENERATE_PARAMS(String.class, "flatlands.generate_params"),
|
||||||
//
|
//
|
||||||
|
@ -20,7 +20,6 @@ import me.totalfreedom.totalfreedommod.httpd.module.Module_indefbans;
|
|||||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_index;
|
import me.totalfreedom.totalfreedommod.httpd.module.Module_index;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_list;
|
import me.totalfreedom.totalfreedommod.httpd.module.Module_list;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_logfile;
|
import me.totalfreedom.totalfreedommod.httpd.module.Module_logfile;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_logs;
|
|
||||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_players;
|
import me.totalfreedom.totalfreedommod.httpd.module.Module_players;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_punishments;
|
import me.totalfreedom.totalfreedommod.httpd.module.Module_punishments;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_schematic;
|
import me.totalfreedom.totalfreedommod.httpd.module.Module_schematic;
|
||||||
@ -96,7 +95,6 @@ public class HTTPDaemon extends FreedomService
|
|||||||
module("help", Module_help.class, false);
|
module("help", Module_help.class, false);
|
||||||
module("list", Module_list.class, false);
|
module("list", Module_list.class, false);
|
||||||
module("logfile", Module_logfile.class, true);
|
module("logfile", Module_logfile.class, true);
|
||||||
module("logs", Module_logs.class, true);
|
|
||||||
module("indefbans", Module_indefbans.class, true);
|
module("indefbans", Module_indefbans.class, true);
|
||||||
module("players", Module_players.class, false);
|
module("players", Module_players.class, false);
|
||||||
module("punishments", Module_punishments.class, true);
|
module("punishments", Module_punishments.class, true);
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.httpd.module;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
||||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
|
|
||||||
public class Module_logs extends Module_file
|
|
||||||
{
|
|
||||||
|
|
||||||
public Module_logs(NanoHTTPD.HTTPSession session)
|
|
||||||
{
|
|
||||||
super(session);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NanoHTTPD.Response getResponse()
|
|
||||||
{
|
|
||||||
if (ConfigEntry.LOGS_SECRET.getString().equals(params.get("password")) && !ConfigEntry.LOGS_SECRET.getString().isEmpty())
|
|
||||||
{
|
|
||||||
FLog.info(session.getSocket().getInetAddress() + " is downloading latest.log.");
|
|
||||||
return serveFile("latest.log", params, new File("./logs"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.FORBIDDEN, NanoHTTPD.MIME_PLAINTEXT, "Incorrect password.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,10 +20,8 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class FPlayer
|
public class FPlayer
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final long AUTO_PURGE_TICKS = 5L * 60L * 20L;
|
public static final long AUTO_PURGE_TICKS = 5L * 60L * 20L;
|
||||||
|
|
||||||
|
|
||||||
private final TotalFreedomMod plugin;
|
private final TotalFreedomMod plugin;
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -40,8 +38,6 @@ public class FPlayer
|
|||||||
private int messageCount = 0;
|
private int messageCount = 0;
|
||||||
private int totalBlockDestroy = 0;
|
private int totalBlockDestroy = 0;
|
||||||
private int totalBlockPlace = 0;
|
private int totalBlockPlace = 0;
|
||||||
private int freecamDestroyCount = 0;
|
|
||||||
private int freecamPlaceCount = 0;
|
|
||||||
private boolean isOrbiting = false;
|
private boolean isOrbiting = false;
|
||||||
private double orbitStrength = 10.0;
|
private double orbitStrength = 10.0;
|
||||||
private boolean mobThrowerEnabled = false;
|
private boolean mobThrowerEnabled = false;
|
||||||
@ -52,11 +48,9 @@ public class FPlayer
|
|||||||
private boolean mp44Firing = false;
|
private boolean mp44Firing = false;
|
||||||
private BukkitTask lockupScheduleTask = null;
|
private BukkitTask lockupScheduleTask = null;
|
||||||
private boolean lockedUp = false;
|
private boolean lockedUp = false;
|
||||||
private String lastMessage = "";
|
|
||||||
private boolean inAdminchat = false;
|
private boolean inAdminchat = false;
|
||||||
private boolean allCommandsBlocked = false;
|
private boolean allCommandsBlocked = false;
|
||||||
private String lastCommand = "";
|
private String lastCommand = "";
|
||||||
private boolean cmdspyEnabled = false;
|
|
||||||
private String tag = null;
|
private String tag = null;
|
||||||
private int warningCount = 0;
|
private int warningCount = 0;
|
||||||
|
|
||||||
@ -82,11 +76,6 @@ public class FPlayer
|
|||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getAutoPurgeTicks()
|
|
||||||
{
|
|
||||||
return AUTO_PURGE_TICKS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer()
|
public Player getPlayer()
|
||||||
{
|
{
|
||||||
if (player != null && !player.isOnline())
|
if (player != null && !player.isOnline())
|
||||||
@ -110,7 +99,6 @@ public class FPlayer
|
|||||||
// Ensure admins don't have admin functionality when removed (FS-222)
|
// Ensure admins don't have admin functionality when removed (FS-222)
|
||||||
public void removeAdminFunctionality()
|
public void removeAdminFunctionality()
|
||||||
{
|
{
|
||||||
this.setCommandSpy(false);
|
|
||||||
this.setAdminChat(false);
|
this.setAdminChat(false);
|
||||||
this.setFuckoffRadius(0);
|
this.setFuckoffRadius(0);
|
||||||
}
|
}
|
||||||
@ -120,11 +108,6 @@ public class FPlayer
|
|||||||
return isOrbiting;
|
return isOrbiting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrbiting(boolean orbiting)
|
|
||||||
{
|
|
||||||
isOrbiting = orbiting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startOrbiting(double strength)
|
public void startOrbiting(double strength)
|
||||||
{
|
{
|
||||||
this.isOrbiting = true;
|
this.isOrbiting = true;
|
||||||
@ -186,26 +169,6 @@ public class FPlayer
|
|||||||
this.totalBlockPlace = 0;
|
this.totalBlockPlace = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int incrementAndGetFreecamDestroyCount()
|
|
||||||
{
|
|
||||||
return this.freecamDestroyCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetFreecamDestroyCount()
|
|
||||||
{
|
|
||||||
this.freecamDestroyCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int incrementAndGetFreecamPlaceCount()
|
|
||||||
{
|
|
||||||
return this.freecamPlaceCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetFreecamPlaceCount()
|
|
||||||
{
|
|
||||||
this.freecamPlaceCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void enableMobThrower(EntityType mobThrowerCreature, double mobThrowerSpeed)
|
public void enableMobThrower(EntityType mobThrowerCreature, double mobThrowerSpeed)
|
||||||
{
|
{
|
||||||
this.mobThrowerEnabled = true;
|
this.mobThrowerEnabled = true;
|
||||||
@ -350,16 +313,6 @@ public class FPlayer
|
|||||||
this.lockedUp = lockedUp;
|
this.lockedUp = lockedUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastMessage()
|
|
||||||
{
|
|
||||||
return lastMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastMessage(String message)
|
|
||||||
{
|
|
||||||
this.lastMessage = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdminChat(boolean inAdminchat)
|
public void setAdminChat(boolean inAdminchat)
|
||||||
{
|
{
|
||||||
this.inAdminchat = inAdminchat;
|
this.inAdminchat = inAdminchat;
|
||||||
@ -390,16 +343,6 @@ public class FPlayer
|
|||||||
this.lastCommand = lastCommand;
|
this.lastCommand = lastCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommandSpy(boolean enabled)
|
|
||||||
{
|
|
||||||
this.cmdspyEnabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean cmdspyEnabled()
|
|
||||||
{
|
|
||||||
return cmdspyEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTag()
|
public String getTag()
|
||||||
{
|
{
|
||||||
return this.tag;
|
return this.tag;
|
||||||
@ -417,16 +360,6 @@ public class FPlayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWarningCount()
|
|
||||||
{
|
|
||||||
return this.warningCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWarningCount(int warningCount)
|
|
||||||
{
|
|
||||||
this.warningCount = warningCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void incrementWarnings(boolean quiet)
|
public void incrementWarnings(boolean quiet)
|
||||||
{
|
{
|
||||||
this.warningCount++;
|
this.warningCount++;
|
||||||
@ -459,16 +392,6 @@ public class FPlayer
|
|||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitTask getUnmuteTask()
|
|
||||||
{
|
|
||||||
return unmuteTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnmuteTask(BukkitTask unmuteTask)
|
|
||||||
{
|
|
||||||
this.unmuteTask = unmuteTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FreezeData getFreezeData()
|
public FreezeData getFreezeData()
|
||||||
{
|
{
|
||||||
return freezeData;
|
return freezeData;
|
||||||
@ -484,176 +407,11 @@ public class FPlayer
|
|||||||
this.fuckoffRadius = fuckoffRadius;
|
this.fuckoffRadius = fuckoffRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMessageCount()
|
|
||||||
{
|
|
||||||
return messageCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageCount(int messageCount)
|
|
||||||
{
|
|
||||||
this.messageCount = messageCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalBlockDestroy()
|
|
||||||
{
|
|
||||||
return totalBlockDestroy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalBlockDestroy(int totalBlockDestroy)
|
|
||||||
{
|
|
||||||
this.totalBlockDestroy = totalBlockDestroy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalBlockPlace()
|
|
||||||
{
|
|
||||||
return totalBlockPlace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalBlockPlace(int totalBlockPlace)
|
|
||||||
{
|
|
||||||
this.totalBlockPlace = totalBlockPlace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFreecamDestroyCount()
|
|
||||||
{
|
|
||||||
return freecamDestroyCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFreecamDestroyCount(int freecamDestroyCount)
|
|
||||||
{
|
|
||||||
this.freecamDestroyCount = freecamDestroyCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFreecamPlaceCount()
|
|
||||||
{
|
|
||||||
return freecamPlaceCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFreecamPlaceCount(int freecamPlaceCount)
|
|
||||||
{
|
|
||||||
this.freecamPlaceCount = freecamPlaceCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CageData getCageData()
|
public CageData getCageData()
|
||||||
{
|
{
|
||||||
return cageData;
|
return cageData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getOrbitStrength()
|
|
||||||
{
|
|
||||||
return orbitStrength;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrbitStrength(double orbitStrength)
|
|
||||||
{
|
|
||||||
this.orbitStrength = orbitStrength;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMobThrowerEnabled()
|
|
||||||
{
|
|
||||||
return mobThrowerEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobThrowerEnabled(boolean mobThrowerEnabled)
|
|
||||||
{
|
|
||||||
this.mobThrowerEnabled = mobThrowerEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityType getMobThrowerEntity()
|
|
||||||
{
|
|
||||||
return mobThrowerEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobThrowerEntity(EntityType mobThrowerEntity)
|
|
||||||
{
|
|
||||||
this.mobThrowerEntity = mobThrowerEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMobThrowerSpeed()
|
|
||||||
{
|
|
||||||
return mobThrowerSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobThrowerSpeed(double mobThrowerSpeed)
|
|
||||||
{
|
|
||||||
this.mobThrowerSpeed = mobThrowerSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<LivingEntity> getMobThrowerQueue()
|
|
||||||
{
|
|
||||||
return mobThrowerQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BukkitTask getMp44ScheduleTask()
|
|
||||||
{
|
|
||||||
return mp44ScheduleTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMp44ScheduleTask(BukkitTask mp44ScheduleTask)
|
|
||||||
{
|
|
||||||
this.mp44ScheduleTask = mp44ScheduleTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMp44Armed()
|
|
||||||
{
|
|
||||||
return mp44Armed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMp44Armed(boolean mp44Armed)
|
|
||||||
{
|
|
||||||
this.mp44Armed = mp44Armed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMp44Firing()
|
|
||||||
{
|
|
||||||
return mp44Firing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMp44Firing(boolean mp44Firing)
|
|
||||||
{
|
|
||||||
this.mp44Firing = mp44Firing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BukkitTask getLockupScheduleTask()
|
|
||||||
{
|
|
||||||
return lockupScheduleTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLockupScheduleTask(BukkitTask lockupScheduleTask)
|
|
||||||
{
|
|
||||||
this.lockupScheduleTask = lockupScheduleTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInAdminchat()
|
|
||||||
{
|
|
||||||
return inAdminchat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInAdminchat(boolean inAdminchat)
|
|
||||||
{
|
|
||||||
this.inAdminchat = inAdminchat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAllCommandsBlocked()
|
|
||||||
{
|
|
||||||
return allCommandsBlocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAllCommandsBlocked(boolean allCommandsBlocked)
|
|
||||||
{
|
|
||||||
this.allCommandsBlocked = allCommandsBlocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCmdspyEnabled()
|
|
||||||
{
|
|
||||||
return cmdspyEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCmdspyEnabled(boolean cmdspyEnabled)
|
|
||||||
{
|
|
||||||
this.cmdspyEnabled = cmdspyEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEditBlocked()
|
public boolean isEditBlocked()
|
||||||
{
|
{
|
||||||
return editBlocked;
|
return editBlocked;
|
||||||
|
@ -211,8 +211,6 @@ allow:
|
|||||||
minecarts: true
|
minecarts: true
|
||||||
clearonjoin: false
|
clearonjoin: false
|
||||||
tpronjoin: false
|
tpronjoin: false
|
||||||
structureblocks: false
|
|
||||||
jigsaws: false
|
|
||||||
grindstones: true
|
grindstones: true
|
||||||
jukeboxes: true
|
jukeboxes: true
|
||||||
spawners: false
|
spawners: false
|
||||||
@ -221,6 +219,8 @@ allow:
|
|||||||
auto_tp: false
|
auto_tp: false
|
||||||
auto_clear: false
|
auto_clear: false
|
||||||
gravity: false
|
gravity: false
|
||||||
|
masterblocks: false
|
||||||
|
books: true
|
||||||
|
|
||||||
blocked_commands:
|
blocked_commands:
|
||||||
#
|
#
|
||||||
@ -598,11 +598,6 @@ first_join_info:
|
|||||||
petprotect:
|
petprotect:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# Logviewer
|
|
||||||
logs:
|
|
||||||
url: ''
|
|
||||||
secret: ''
|
|
||||||
|
|
||||||
# Mojang service checker
|
# Mojang service checker
|
||||||
service_checker_url: http://status.mojang.com/check
|
service_checker_url: http://status.mojang.com/check
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user