mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Fix all the bugs
This commit is contained in:
parent
d67189e170
commit
9cb96e81ac
18
.idea/codeStyles/Project.xml
generated
18
.idea/codeStyles/Project.xml
generated
@ -9,6 +9,24 @@
|
|||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</JavaCodeStyleSettings>
|
</JavaCodeStyleSettings>
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
|
<value>
|
||||||
|
<package name="java.util" alias="false" withSubpackages="false" />
|
||||||
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||||
|
<value>
|
||||||
|
<package name="" alias="false" withSubpackages="true" />
|
||||||
|
<package name="java" alias="false" withSubpackages="true" />
|
||||||
|
<package name="javax" alias="false" withSubpackages="true" />
|
||||||
|
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||||
|
<package name="" alias="true" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
<option name="BRACE_STYLE" value="2" />
|
<option name="BRACE_STYLE" value="2" />
|
||||||
<option name="CLASS_BRACE_STYLE" value="2" />
|
<option name="CLASS_BRACE_STYLE" value="2" />
|
||||||
|
7
pom.xml
7
pom.xml
@ -414,6 +414,12 @@
|
|||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<minimizeJar>true</minimizeJar>
|
<minimizeJar>true</minimizeJar>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>io.papermc.lib</pattern>
|
||||||
|
<shadedPattern>me.totalfreedom.totalfreedommod.paperlib</shadedPattern> <!-- Replace this -->
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>commons-io:commons-io</include>
|
<include>commons-io:commons-io</include>
|
||||||
@ -422,6 +428,7 @@
|
|||||||
<include>org.reflections:reflections</include>
|
<include>org.reflections:reflections</include>
|
||||||
<include>javassist:javassist</include>
|
<include>javassist:javassist</include>
|
||||||
<include>me.rayzr522:jsonmessage</include>
|
<include>me.rayzr522:jsonmessage</include>
|
||||||
|
<include>io.papermc:paperlib</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -47,7 +47,7 @@ public class Monitors extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.sl.messageAllStaff(ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.",
|
plugin.sl.potionSpyMessage(ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.",
|
||||||
player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(),
|
player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(),
|
||||||
latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : "")));
|
latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : "")));
|
||||||
}
|
}
|
||||||
|
@ -82,15 +82,15 @@ public class Command_list extends FreedomCommand
|
|||||||
|
|
||||||
List<String> n = new ArrayList<>();
|
List<String> n = new ArrayList<>();
|
||||||
|
|
||||||
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.sl.isStaff(sender) && plugin.sl.getAdmin(sender).getRank().isAtLeast(Rank.MOD))
|
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.sl.isStaff(sender) && plugin.sl.getAdmin(playerSender).getRank().isAtLeast(Rank.MOD))
|
||||||
{
|
{
|
||||||
List<StaffMember> connectedStaffMembers = plugin.btb.getConnectedAdmins();
|
List<StaffMember> connectedStaffMembers = plugin.btb.getConnectedAdmins();
|
||||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedStaffMembers.size())
|
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedStaffMembers.size())
|
||||||
.append(ChatColor.BLUE)
|
.append(ChatColor.BLUE)
|
||||||
.append(" staff connected to telnet.");
|
.append(" staff members connected to telnet.");
|
||||||
for (StaffMember staffMember : connectedStaffMembers)
|
for (StaffMember staffMember : connectedStaffMembers)
|
||||||
{
|
{
|
||||||
n.add(plugin.rm.getDisplay(staffMember).getColoredTag() + staffMember.getName());
|
n.add(staffMember.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -139,13 +139,11 @@ public class Command_list extends FreedomCommand
|
|||||||
.append(": ")
|
.append(": ")
|
||||||
.append(StringUtils.join(n, ChatColor.WHITE + ", "));
|
.append(StringUtils.join(n, ChatColor.WHITE + ", "));
|
||||||
if (senderIsConsole)
|
if (senderIsConsole)
|
||||||
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
||||||
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString()));
|
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(onlineStats.toString());
|
sender.sendMessage(onlineStats.toString());
|
||||||
sender.sendMessage(onlineUsers.toString());
|
sender.sendMessage(onlineUsers.toString());
|
||||||
|
@ -19,7 +19,7 @@ public class Command_setlimit extends FreedomCommand
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
amount = Math.max(1, Math.min(plugin.web.getMaxLimit(), Integer.parseInt(args[0])));
|
amount = Math.max(-1, Math.min(plugin.web.getMaxLimit(), Integer.parseInt(args[0])));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException ex)
|
catch (NumberFormatException ex)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
||||||
|
@CommandParameters(description = "Sets a specific player's WorldEdit block modification limit to the default limit or to a custom limit.", usage = "/<command> <player> [limit]", aliases = "setpl,spl")
|
||||||
|
public class Command_setplayerlimit extends FreedomCommand
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
int amount;
|
||||||
|
if (args.length > 0)
|
||||||
|
{
|
||||||
|
Player player = Bukkit.getPlayer(args[0]);
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage(PLAYER_NOT_FOUND);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length == 2)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
amount = Math.max(-1, Math.min(plugin.web.getMaxLimit(), Integer.parseInt(args[1])));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex)
|
||||||
|
{
|
||||||
|
msg("Invalid number: " + args[1], ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
amount = plugin.web.getDefaultLimit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean success = false;
|
||||||
|
Player player = Bukkit.getPlayer(args[0]);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
plugin.web.setLimit(player, amount);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
catch (NoClassDefFoundError | NullPointerException ex)
|
||||||
|
{
|
||||||
|
msg("WorldEdit is not enabled on this server.");
|
||||||
|
}
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
FUtil.staffAction(sender.getName(), "Setting " + player.getName() + "'s WorldEdit block modification limit to " + amount + ".", true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.rank;
|
package me.totalfreedom.totalfreedommod.rank;
|
||||||
|
|
||||||
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
|
@ -233,7 +233,7 @@ public class SQLite extends FreedomService
|
|||||||
}
|
}
|
||||||
else if (value instanceof Boolean)
|
else if (value instanceof Boolean)
|
||||||
{
|
{
|
||||||
result = resultSet.getBoolean(key);
|
result = resultSet.getObject(key);
|
||||||
}
|
}
|
||||||
else if (value instanceof Long)
|
else if (value instanceof Long)
|
||||||
{
|
{
|
||||||
@ -261,7 +261,7 @@ public class SQLite extends FreedomService
|
|||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
FLog.severe("Failed to add staff member: " + e.getMessage());
|
FLog.severe("Failed to add staff member: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ public class SQLite extends FreedomService
|
|||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
FLog.severe("Failed to add player: " + e.getMessage());
|
FLog.severe("Failed to add player: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ public class SQLite extends FreedomService
|
|||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
FLog.severe("Failed to get staff member by name: " + e.getMessage());
|
FLog.severe("Failed to get staff member by name: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -323,7 +323,7 @@ public class SQLite extends FreedomService
|
|||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
FLog.severe("Failed to get player by name: " + e.getMessage());
|
FLog.severe("Failed to get player by name: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -337,7 +337,7 @@ public class SQLite extends FreedomService
|
|||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
FLog.severe("Failed to get Master Builders: " + e.getMessage());
|
FLog.severe("Failed to get Master Builders: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -79,6 +79,18 @@ public class StaffList extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void potionSpyMessage(String message)
|
||||||
|
{
|
||||||
|
for (Player player : server.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
StaffMember staffMember = getAdmin(player.getPlayer());
|
||||||
|
if (isStaff(player) && staffMember.getPotionSpy())
|
||||||
|
{
|
||||||
|
player.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized boolean isStaffSync(CommandSender sender)
|
public synchronized boolean isStaffSync(CommandSender sender)
|
||||||
{
|
{
|
||||||
return isStaff(sender);
|
return isStaff(sender);
|
||||||
|
@ -7,6 +7,7 @@ import java.io.FileFilter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -26,7 +27,6 @@ import java.util.TimeZone;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
@ -257,7 +257,7 @@ public class FUtil
|
|||||||
public static String sendRequest(String endpoint, String method, List<String>headers, String body) throws IOException
|
public static String sendRequest(String endpoint, String method, List<String>headers, String body) throws IOException
|
||||||
{
|
{
|
||||||
URL url = new URL(endpoint);
|
URL url = new URL(endpoint);
|
||||||
HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
|
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
|
||||||
connection.setRequestMethod(method);
|
connection.setRequestMethod(method);
|
||||||
for (String header : headers)
|
for (String header : headers)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user