diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 9898a0e5..86bb373f 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -9,6 +9,24 @@
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 8355eb2f..97dbd6cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -414,6 +414,12 @@
true
+
+
+ io.papermc.lib
+ me.totalfreedom.totalfreedommod.paperlib
+
+
commons-io:commons-io
@@ -422,6 +428,7 @@
org.reflections:reflections
javassist:javassist
me.rayzr522:jsonmessage
+ io.papermc:paperlib
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java b/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java
index eef73c7e..bcdda87d 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java
@@ -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(),
latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : "")));
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java
index cee405ee..37c68726 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java
@@ -82,15 +82,15 @@ public class Command_list extends FreedomCommand
List 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 connectedStaffMembers = plugin.btb.getConnectedAdmins();
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedStaffMembers.size())
.append(ChatColor.BLUE)
- .append(" staff connected to telnet.");
+ .append(" staff members connected to telnet.");
for (StaffMember staffMember : connectedStaffMembers)
{
- n.add(plugin.rm.getDisplay(staffMember).getColoredTag() + staffMember.getName());
+ n.add(staffMember.getName());
}
}
else
@@ -139,13 +139,11 @@ public class Command_list extends FreedomCommand
.append(": ")
.append(StringUtils.join(n, ChatColor.WHITE + ", "));
if (senderIsConsole)
-
{
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString()));
}
else
-
{
sender.sendMessage(onlineStats.toString());
sender.sendMessage(onlineUsers.toString());
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlimit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlimit.java
index 7d6e5c6e..9fd7ddf6 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlimit.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlimit.java
@@ -19,7 +19,7 @@ public class Command_setlimit extends FreedomCommand
{
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)
{
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setplayerlimit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setplayerlimit.java
new file mode 100644
index 00000000..f8f62e06
--- /dev/null
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setplayerlimit.java
@@ -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 = "/ [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;
+ }
+}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
index 36ce1c83..cb49d0e9 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
@@ -1,5 +1,6 @@
package me.totalfreedom.totalfreedommod.rank;
+import me.libraryaddict.disguise.DisguiseAPI;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java b/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java
index 5e2690a8..40fa7683 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java
@@ -233,7 +233,7 @@ public class SQLite extends FreedomService
}
else if (value instanceof Boolean)
{
- result = resultSet.getBoolean(key);
+ result = resultSet.getObject(key);
}
else if (value instanceof Long)
{
@@ -261,7 +261,7 @@ public class SQLite extends FreedomService
}
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)
{
- 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)
{
- FLog.severe("Failed to get staff member by name: " + e.getMessage());
+ FLog.severe("Failed to get staff member by name: " + e);
}
return null;
@@ -323,7 +323,7 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
- FLog.severe("Failed to get player by name: " + e.getMessage());
+ FLog.severe("Failed to get player by name: " + e);
}
return null;
@@ -337,7 +337,7 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
- FLog.severe("Failed to get Master Builders: " + e.getMessage());
+ FLog.severe("Failed to get Master Builders: " + e);
}
return null;
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/staff/StaffList.java b/src/main/java/me/totalfreedom/totalfreedommod/staff/StaffList.java
index 2aa4bfcb..bbad57bd 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/staff/StaffList.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/staff/StaffList.java
@@ -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)
{
return isStaff(sender);
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
index 1b36fcae..4ed80e76 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
@@ -7,6 +7,7 @@ import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
+import java.net.HttpURLConnection;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -26,7 +27,6 @@ import java.util.TimeZone;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.net.ssl.HttpsURLConnection;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import org.apache.commons.io.FileUtils;
@@ -257,7 +257,7 @@ public class FUtil
public static String sendRequest(String endpoint, String method, Listheaders, String body) throws IOException
{
URL url = new URL(endpoint);
- HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod(method);
for (String header : headers)
{