Added private constructors to utility classes

This commit is contained in:
Intelli 2021-07-26 17:20:33 -06:00
parent a7eb6a48c9
commit f6f9c27f08
33 changed files with 130 additions and 7 deletions

View file

@ -14,6 +14,10 @@ import net.coreprotect.utility.Util;
public class BlockBreakLogger {
private BlockBreakLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int type, int data, List<Object> meta, String blockData) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null || location == null) {

View file

@ -21,6 +21,10 @@ import net.coreprotect.utility.Util;
public class BlockPlaceLogger {
private BlockPlaceLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, BlockState block, int replacedType, int replacedData, Material forceType, int forceData, boolean force, List<Object> meta, String blockData, String replaceBlockData) {
try {
if (user == null || ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -11,6 +11,10 @@ import net.coreprotect.utility.Util;
public class ChatLogger {
private ChatLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, int time, Location location, String user, String message) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -11,6 +11,10 @@ import net.coreprotect.utility.Util;
public class CommandLogger {
private CommandLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, int time, Location location, String user, String message) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -12,6 +12,10 @@ import net.coreprotect.utility.Util;
public class ContainerBreakLogger {
private ContainerBreakLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String player, Location l, Material type, ItemStack[] oldInventory) {
try {
Util.mergeItems(type, oldInventory);

View file

@ -21,6 +21,10 @@ import net.coreprotect.utility.serialize.ItemMetaHandler;
public class ContainerLogger extends Queue {
private ContainerLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmtContainer, PreparedStatement preparedStmtItems, int batchCount, String player, Material type, Object container, Location location) {
try {
ItemStack[] contents = null;

View file

@ -14,6 +14,10 @@ import net.coreprotect.utility.Util;
public class EntityKillLogger {
private EntityKillLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, PreparedStatement preparedStmt2, int batchCount, String user, BlockState block, List<Object> data, int type) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -23,6 +23,10 @@ public class ItemLogger {
public static final int ITEM_REMOVE_ENDER = 4;
public static final int ITEM_ADD_ENDER = 5;
private ItemLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, Location location, String user) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -12,6 +12,10 @@ import net.coreprotect.utility.Util;
public class PlayerInteractLogger {
private PlayerInteractLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, BlockState block) {
try {
int type = Util.getBlockId(block.getType().name(), true);

View file

@ -12,6 +12,10 @@ import net.coreprotect.utility.Util;
public class PlayerKillLogger {
private PlayerKillLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, BlockState block, String player) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -11,6 +11,10 @@ import net.coreprotect.utility.Util;
public class PlayerSessionLogger {
private PlayerSessionLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int time, int action) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -11,6 +11,10 @@ import net.coreprotect.utility.Util;
public class SignTextLogger {
private SignTextLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int action, int color, int data, String line1, String line2, String line3, String line4, int timeOffset) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -13,6 +13,10 @@ import net.coreprotect.utility.Util;
public class SkullBreakLogger {
private SkullBreakLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, PreparedStatement preparedStmt2, int batchCount, String user, BlockState block) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null || block == null) {

View file

@ -13,6 +13,10 @@ import net.coreprotect.database.statement.SkullStatement;
public class SkullPlaceLogger {
private SkullPlaceLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, PreparedStatement preparedStmt2, int batchCount, String user, BlockState block, int replaceType, int replaceData) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null || block == null) {

View file

@ -9,6 +9,10 @@ import net.coreprotect.config.ConfigHandler;
public class UsernameLogger {
private UsernameLogger() {
throw new IllegalStateException("Database class");
}
public static void log(Connection connection, String user, String uuid, int configUsernames, int time) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {

View file

@ -7,6 +7,10 @@ import net.coreprotect.utility.Util;
public class BlockStatement {
private BlockStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int id, int wid, int x, int y, int z, int type, int data, List<Object> meta, String blockData, int action, int rolledBack) {
try {
byte[] bBlockData = Util.stringToByteData(blockData, type);

View file

@ -4,6 +4,10 @@ import java.sql.PreparedStatement;
public class ChatStatement {
private ChatStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int user, int wid, int x, int y, int z, String message) {
try {
preparedStmt.setInt(1, time);

View file

@ -4,6 +4,10 @@ import java.sql.PreparedStatement;
public class CommandStatement {
private CommandStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int user, int wid, int x, int y, int z, String message) {
try {
preparedStmt.setInt(1, time);

View file

@ -6,6 +6,10 @@ import net.coreprotect.utility.Util;
public class ContainerStatement {
private ContainerStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int id, int wid, int x, int y, int z, int type, int data, int amount, Object metadata, int action, int rolledBack) {
try {
byte[] byteData = Util.convertByteData(metadata);

View file

@ -14,6 +14,10 @@ import org.bukkit.util.io.BukkitObjectOutputStream;
public class EntityStatement {
private EntityStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int time, List<Object> data) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();

View file

@ -6,6 +6,10 @@ import net.coreprotect.utility.Util;
public class ItemStatement {
private ItemStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int id, int wid, int x, int y, int z, int type, Object data, int amount, int action) {
try {
byte[] byteData = Util.convertByteData(data);

View file

@ -6,6 +6,10 @@ import java.sql.Statement;
public class MaterialStatement {
private MaterialStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int id, String name) {
try {
preparedStmt.setInt(1, id);

View file

@ -4,6 +4,10 @@ import java.sql.PreparedStatement;
public class SessionStatement {
private SessionStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int user, int wid, int x, int y, int z, int action) {
try {
preparedStmt.setInt(1, time);

View file

@ -13,6 +13,10 @@ import net.coreprotect.bukkit.BukkitAdapter;
public class SignStatement {
private SignStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int id, int wid, int x, int y, int z, int action, int color, int data, String line1, String line2, String line3, String line4) {
try {
preparedStmt.setInt(1, time);

View file

@ -11,6 +11,10 @@ import org.bukkit.block.Skull;
public class SkullStatement {
private SkullStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int time, String owner) {
try {
preparedStmt.setInt(1, time);

View file

@ -11,6 +11,10 @@ import net.coreprotect.config.ConfigHandler;
public class UserStatement {
private UserStatement() {
throw new IllegalStateException("Database class");
}
public static int insert(Connection connection, String user) {
int id = -1;

View file

@ -4,6 +4,10 @@ import java.sql.PreparedStatement;
public class WorldStatement {
private WorldStatement() {
throw new IllegalStateException("Database class");
}
public static void insert(PreparedStatement preparedStmt, int batchCount, int id, String world) {
try {
preparedStmt.setInt(1, id);