diff --git a/pom.xml b/pom.xml index 6b2c0bf..68e0aea 100755 --- a/pom.xml +++ b/pom.xml @@ -260,7 +260,37 @@ shade + + + + + + + org.bstats:* + + META-INF/MANIFEST.MF + + + + com.zaxxer:HikariCP + + META-INF/MANIFEST.MF + + + + com.clickhouse:clickhouse-jdbc + + META-INF/MANIFEST.MF + + + + *:* + + module-info.class + META-INF/versions/**/module-info.class + + *:*:*:* diff --git a/src/main/java/net/tfminecraft/coreprotect/bukkit/BukkitAdapter.java b/src/main/java/net/tfminecraft/coreprotect/bukkit/BukkitAdapter.java index ffed5af..670c80f 100644 --- a/src/main/java/net/tfminecraft/coreprotect/bukkit/BukkitAdapter.java +++ b/src/main/java/net/tfminecraft/coreprotect/bukkit/BukkitAdapter.java @@ -271,6 +271,8 @@ public ItemStack adjustIngredient(MerchantRecipe recipe, ItemStack itemStack) { return null; } + // Pre-1.20.2 fallback; newer adapters use the base potion type API. + @SuppressWarnings("removal") @Override public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack) { PotionData data = arrow.getBasePotionData(); @@ -418,6 +420,8 @@ public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractE // -------------------- Sign handling methods -------------------- + // Legacy Bukkit sign API for servers without sign sides or Adventure components. + @SuppressWarnings("deprecation") @Override public String getLine(Sign sign, int line) { if (line < 4) { @@ -428,6 +432,8 @@ public String getLine(Sign sign, int line) { } } + // Legacy Bukkit sign API preserves stored text on older servers. + @SuppressWarnings("deprecation") @Override public void setLine(Sign sign, int line, String string) { if (string == null) { @@ -470,6 +476,8 @@ public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) { // Base implementation does nothing } + // Legacy Bukkit sign API for servers without sign sides. + @SuppressWarnings("deprecation") @Override public void setColor(Sign sign, boolean isFront, int color) { if (!isFront) { @@ -484,6 +492,8 @@ public void setWaxed(Sign sign, boolean isWaxed) { // Base implementation does nothing } + // Legacy Bukkit sign API for servers without sign sides. + @SuppressWarnings("deprecation") @Override public int getColor(Sign sign, boolean isFront) { if (isFront) { @@ -505,6 +515,8 @@ public Object getRegistryValue(String key, Object tClass) { return null; } + // Legacy enum naming fallback; newer adapters use the art registry. + @SuppressWarnings("removal") @Override public String getPaintingArtKey(Painting painting) { try { @@ -515,6 +527,8 @@ public String getPaintingArtKey(Painting painting) { } } + // Legacy art lookup fallback; newer adapters use the art registry. + @SuppressWarnings("deprecation") @Override public Art getPaintingArt(String name) { if (name == null || name.isBlank()) { diff --git a/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_17.java b/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_17.java index 243b3f2..a12d746 100644 --- a/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_17.java +++ b/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_17.java @@ -232,6 +232,8 @@ public Class getFrameClass(Material material) { return (material == Material.GLOW_ITEM_FRAME) ? GlowItemFrame.class : ItemFrame.class; } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public boolean isGlowing(Sign sign, boolean isFront) { if (!isFront) { @@ -241,6 +243,8 @@ public boolean isGlowing(Sign sign, boolean isFront) { return sign.isGlowingText(); } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) { if (!isFront) { diff --git a/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_20.java b/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_20.java index 99f3bd9..be262f6 100644 --- a/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_20.java +++ b/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_20.java @@ -213,6 +213,8 @@ public boolean isBookshelfBook(Material material) { return Tag.ITEMS_BOOKSHELF_BOOKS.isTagged(material); } + // Capability-checked Bukkit 1.20.1 API retained for older servers. + @SuppressWarnings("deprecation") @Override public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event) { try { @@ -237,6 +239,8 @@ else if (Boolean.FALSE.equals(hasClickedPosition)) { } } + // Bukkit 1.20 compatibility boundary preserves legacy sign text without Paper components. + @SuppressWarnings("deprecation") @Override public String getLine(Sign sign, int line) { if (line < 4) { @@ -247,6 +251,8 @@ public String getLine(Sign sign, int line) { } } + // Bukkit 1.20 compatibility boundary restores legacy sign text without Paper components. + @SuppressWarnings("deprecation") @Override public void setLine(Sign sign, int line, String string) { string = string == null ? "" : string; diff --git a/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_21.java b/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_21.java index e44fd39..e6486c0 100644 --- a/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_21.java +++ b/src/main/java/net/tfminecraft/coreprotect/bukkit/Bukkit_v1_21.java @@ -198,7 +198,7 @@ public Object getRegistryKey(Object value) { * The class of the registry * @return The registry value */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"deprecation", "rawtypes", "unchecked"}) @Override public Object getRegistryValue(String key, Object tClass) { NamespacedKey namespacedKey = NamespacedKey.fromString(key); @@ -206,6 +206,8 @@ public Object getRegistryValue(String key, Object tClass) { return Bukkit.getRegistry((Class) tClass).get(namespacedKey); } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public String getPaintingArtKey(Painting painting) { try { @@ -220,6 +222,8 @@ public String getPaintingArtKey(Painting painting) { return normalizePaintingArtKey(super.getPaintingArtKey(painting)); } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public Art getPaintingArt(String name) { NamespacedKey key = NamespacedKey.fromString(normalizePaintingArtLookupKey(name)); diff --git a/src/main/java/net/tfminecraft/coreprotect/command/StatusCommand.java b/src/main/java/net/tfminecraft/coreprotect/command/StatusCommand.java index 37a5183..b14e292 100755 --- a/src/main/java/net/tfminecraft/coreprotect/command/StatusCommand.java +++ b/src/main/java/net/tfminecraft/coreprotect/command/StatusCommand.java @@ -31,6 +31,8 @@ protected static void runCommand(CommandSender player, boolean permission, Strin } class BasicThread implements Runnable { + // Plugin description access also supports older Bukkit and third-party Plugin implementations. + @SuppressWarnings("deprecation") @Override public void run() { try { diff --git a/src/main/java/net/tfminecraft/coreprotect/command/WorldEditHandler.java b/src/main/java/net/tfminecraft/coreprotect/command/WorldEditHandler.java index 83b28c3..669a0e1 100755 --- a/src/main/java/net/tfminecraft/coreprotect/command/WorldEditHandler.java +++ b/src/main/java/net/tfminecraft/coreprotect/command/WorldEditHandler.java @@ -25,9 +25,9 @@ protected static Integer[] runWorldEditCommand(CommandSender user) { Region region = session.getSelection(world); if (region != null && world.getName().equals(((Player) user).getWorld().getName())) { BlockVector3 block = region.getMinimumPoint(); - int x = block.getBlockX(); - int y = block.getBlockY(); - int z = block.getBlockZ(); + int x = block.x(); + int y = block.y(); + int z = block.z(); int width = region.getWidth(); int height = region.getHeight(); int length = region.getLength(); diff --git a/src/main/java/net/tfminecraft/coreprotect/config/Config.java b/src/main/java/net/tfminecraft/coreprotect/config/Config.java index 53be081..86e5957 100644 --- a/src/main/java/net/tfminecraft/coreprotect/config/Config.java +++ b/src/main/java/net/tfminecraft/coreprotect/config/Config.java @@ -447,6 +447,8 @@ private static Map loadFiles(String fileName) throws IOException } // this should only be called on the main thread + // Preserve fatal ThreadDeath propagation while reporting ordinary configuration errors. + @SuppressWarnings({"deprecation", "removal"}) private static void parseConfig(final Map data) { if (!Bukkit.isPrimaryThread()) { // we call reloads asynchronously diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/Queue.java b/src/main/java/net/tfminecraft/coreprotect/consumer/Queue.java index e50bacd..06f2719 100755 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/Queue.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/Queue.java @@ -327,10 +327,14 @@ protected static void queueBlockPlaceValidate(final String user, final BlockStat }, blockLocation.getLocation(), ticks); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void queueContainerBreak(String user, Location location, Material type, ItemStack[] oldInventory) { queueStandardData(new Object[] { null, Process.CONTAINER_BREAK, type, 0, null, 0, 0, null }, new String[] { user, null }, location, false, Consumer.consumerContainers, oldInventory, Consumer.reserveConsumer()); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static synchronized void queueContainerTransaction(String user, Location location, Material type, Object inventory, int chestId) { queueStandardData(new Object[] { null, Process.CONTAINER_TRANSACTION, type, 0, null, 0, chestId, null }, new String[] { user, null }, location, false, Consumer.consumerInventories, inventory, Consumer.reserveConsumer()); } @@ -402,6 +406,8 @@ protected static void queueEntityInsert(int id, String name) { queueStandardData(new Object[] { null, Process.ENTITY_INSERT, null, 0, null, 0, id, null }, new String[] { null, null }, name, false, Consumer.reserveConsumer()); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void queueEntityKill(String user, Location location, List data, EntityType type) { queueStandardData(new Object[] { null, Process.ENTITY_KILL, null, 0, null, 0, 0 }, new String[] { user, null }, new Object[] { getBlockLocation(location), type, null }, false, Consumer.consumerObjectList, data, Consumer.reserveConsumer()); } @@ -475,6 +481,8 @@ protected static void queueBlockDataInsert(int id, String data) { queueStandardData(new Object[] { null, Process.BLOCKDATA_INSERT, null, 0, null, 0, id, null }, new String[] { null, null }, data, false, Consumer.reserveConsumer()); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void queueNaturalBlockBreak(String user, BlockState block, Block relative, Material type, String blockData, int data) { List blockStates = new ArrayList<>(); if (relative != null) { @@ -484,10 +492,14 @@ protected static void queueNaturalBlockBreak(String user, BlockState block, Bloc queueStandardData(new Object[] { null, Process.NATURAL_BLOCK_BREAK, type, data, null, 0, 0, blockData }, new String[] { user, null }, block, false, Consumer.consumerBlockList, blockStates, Consumer.reserveConsumer()); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void queuePlayerChat(Player player, String message, long timestamp) { queueStandardData(new Object[] { null, Process.PLAYER_CHAT, null, 0, null, 0, 0, null }, new String[] { player.getName(), null }, new Object[] { timestamp, player.getLocation().clone() }, false, Consumer.consumerStrings, message, Consumer.reserveConsumer()); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void queuePlayerCommand(Player player, String message, long timestamp) { queueStandardData(new Object[] { null, Process.PLAYER_COMMAND, null, 0, null, 0, 0, null }, new String[] { player.getName(), null }, new Object[] { timestamp, player.getLocation().clone() }, false, Consumer.consumerStrings, message, Consumer.reserveConsumer()); } @@ -500,6 +512,8 @@ protected static void queuePlayerKill(String user, Location location, String pla queueStandardData(new Object[] { null, Process.PLAYER_KILL, null, 0, null, 0, 0, null }, new String[] { user, null }, new Object[] { getBlockLocation(location), player }, false, Consumer.reserveConsumer()); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void queuePlayerLogin(Player player, int time, int configSessions, int configUsernames) { String uuid = player.getUniqueId().toString(); queueStandardData(new Object[] { null, Process.PLAYER_LOGIN, null, configSessions, null, configUsernames, time, null }, new String[] { player.getName(), uuid }, player.getLocation().clone(), false, Consumer.consumerStrings, uuid, Consumer.reserveConsumer()); @@ -589,6 +603,8 @@ public static synchronized void queueEntityRetriesFirst(List rows, int table, int action, boolean inventoryRollback) { Objects.requireNonNull(rows, "rows"); if (rows.isEmpty()) { @@ -640,6 +656,8 @@ private static synchronized void queueRollbackUpdates(String user, Location loca } } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void queueSignText(String user, Location location, int action, int color, int colorSecondary, boolean frontGlowing, boolean backGlowing, boolean isWaxed, boolean isFront, String line1, String line2, String line3, String line4, String line5, String line6, String line7, String line8, int offset) { /* if (line1.length() == 0 && line2.length() == 0 && line3.length() == 0 && line4.length() == 0) { @@ -658,6 +676,8 @@ protected static void queueSkullUpdate(String user, BlockState block, int rowId) queueStandardData(new Object[] { null, Process.SKULL_UPDATE, null, 0, null, 0, rowId, null }, new String[] { user, null }, block, false, Consumer.reserveConsumer()); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void queueStructureGrow(String user, BlockState block, List blockList, int replacedListSize) { queueStandardData(new Object[] { null, Process.STRUCTURE_GROWTH, null, 0, null, 0, replacedListSize, null }, new String[] { user, null }, block, false, Consumer.consumerBlockList, blockList, Consumer.reserveConsumer()); } diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/ContainerBreakProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/ContainerBreakProcess.java index a01412c..665d39f 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/ContainerBreakProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/ContainerBreakProcess.java @@ -13,6 +13,8 @@ class ContainerBreakProcess { + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(ConsumerWriteBatch preparedStmt, int batchCount, int processId, int id, Material type, String user, Object object) { if (object instanceof Location) { Location location = (Location) object; diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/ContainerTransactionProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/ContainerTransactionProcess.java index af83858..7664e96 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/ContainerTransactionProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/ContainerTransactionProcess.java @@ -41,6 +41,8 @@ static boolean processEntity(ConsumerWriteBatch preparedStmtContainer, int batch return true; } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(ConsumerWriteBatch preparedStmtContainer, ConsumerWriteBatch preparedStmtItems, int batchCount, int processId, int id, Material type, int forceData, String user, Object object) { if (!(object instanceof Location)) { return; diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/EntityKillProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/EntityKillProcess.java index 7e9fcbb..6a99906 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/EntityKillProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/EntityKillProcess.java @@ -14,6 +14,8 @@ class EntityKillProcess { + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(ConsumerWriteBatch preparedStmt, ConsumerWriteBatch preparedStmtEntities, ConsumerWriteBatch preparedStmtEntityKillLinks, int batchCount, int processId, int id, Object object, String user) { if (object instanceof Object[]) { Object[] values = (Object[]) object; diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/NaturalBlockBreakProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/NaturalBlockBreakProcess.java index 3fafbda..e1c196b 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/NaturalBlockBreakProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/NaturalBlockBreakProcess.java @@ -15,6 +15,8 @@ class NaturalBlockBreakProcess { + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(Statement statement, ConsumerWriteBatch preparedStmt, int batchCount, int processId, int id, String user, Object object, Material blockType, int blockData, String overrideData) { if (object instanceof BlockState) { BlockState block = (BlockState) object; diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerChatProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerChatProcess.java index fa220d5..5d6f30f 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerChatProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerChatProcess.java @@ -10,6 +10,8 @@ class PlayerChatProcess { + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(ConsumerWriteBatch preparedStmt, int batchCount, int processId, int id, Object object, String user) { if (!(object instanceof Object[])) { return; diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerCommandProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerCommandProcess.java index 1a7c5ca..dd9c5d6 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerCommandProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerCommandProcess.java @@ -10,6 +10,8 @@ class PlayerCommandProcess { + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(ConsumerWriteBatch preparedStmt, int batchCount, int processId, int id, Object object, String user) { if (!(object instanceof Object[])) { return; diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerLoginProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerLoginProcess.java index 97dd6cd..aa14fa1 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerLoginProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/PlayerLoginProcess.java @@ -12,6 +12,8 @@ class PlayerLoginProcess { + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(ConsumerWriteBatch batch, int batchCount, int processId, int id, Object object, int configSessions, int configUsernames, int time, String user) { if (object instanceof Location) { Map strings = Consumer.consumerStrings.get(processId); diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/Process.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/Process.java index a64d0a8..23577f5 100755 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/Process.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/Process.java @@ -117,6 +117,8 @@ protected static void updateLockTable(ConsumerWriteBatch batch, int locked) { } } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") protected static void processConsumer(int processId, boolean lastRun) { List pendingEntitySpawnLogs = new ArrayList<>(); Map entitySpawnIdentities = new LinkedHashMap<>(); @@ -858,6 +860,8 @@ private static void invalidateUserCaches(Map users) { } } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") private static void discardProcessedConsumerData(int processId, ArrayList consumerData, Map users, Map consumerObject, int count) { int processed = Math.min(count, consumerData.size()); for (int index = 0; index < processed; index++) { diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/RollbackUpdateProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/RollbackUpdateProcess.java index ae159f5..10a2f35 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/RollbackUpdateProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/RollbackUpdateProcess.java @@ -17,6 +17,8 @@ static void process(ConsumerWriteBatch batch, int processId, int id, int action, process(batch, processId, id, action, table, RollbackUpdateTargets.usesInventoryRollbackState(table)); } + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(ConsumerWriteBatch batch, int processId, int id, int action, int table, boolean inventoryRollback) throws Exception { Map> updateLists = Consumer.consumerObjectArrayList.get(processId); if (updateLists.get(id) != null) { diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/SignTextProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/SignTextProcess.java index 5f50e93..c8037fc 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/SignTextProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/SignTextProcess.java @@ -10,6 +10,8 @@ class SignTextProcess { + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(ConsumerWriteBatch preparedStmt, int batchCount, int processId, int id, int forceData, String user, Object object, int action, int color) { if (object instanceof Location) { Location location = (Location) object; diff --git a/src/main/java/net/tfminecraft/coreprotect/consumer/process/StructureGrowthProcess.java b/src/main/java/net/tfminecraft/coreprotect/consumer/process/StructureGrowthProcess.java index 39357bb..f702d89 100644 --- a/src/main/java/net/tfminecraft/coreprotect/consumer/process/StructureGrowthProcess.java +++ b/src/main/java/net/tfminecraft/coreprotect/consumer/process/StructureGrowthProcess.java @@ -15,6 +15,8 @@ class StructureGrowthProcess { + // These auxiliary queues still hold distinct legacy payloads consumed by the matching processors. + @SuppressWarnings("deprecation") static void process(Statement statement, ConsumerWriteBatch preparedStmt, int batchCount, int processId, int id, String user, Object object, int replaceBlockCount) { if (object instanceof BlockState) { BlockState block = (BlockState) object; diff --git a/src/main/java/net/tfminecraft/coreprotect/database/clickhouse/ClickHouseRowBinaryBuffer.java b/src/main/java/net/tfminecraft/coreprotect/database/clickhouse/ClickHouseRowBinaryBuffer.java index 71039b6..d5c098e 100644 --- a/src/main/java/net/tfminecraft/coreprotect/database/clickhouse/ClickHouseRowBinaryBuffer.java +++ b/src/main/java/net/tfminecraft/coreprotect/database/clickhouse/ClickHouseRowBinaryBuffer.java @@ -162,6 +162,8 @@ private void requireActiveRow() { } } + // Retain the existing ClickHouse RowBinary wire encoding until a byte-compatible client migration. + @SuppressWarnings("deprecation") private void writeValue(String declaredType, Object value) throws IOException { String type = declaredType; if (type.startsWith("Nullable(") && type.endsWith(")")) { diff --git a/src/main/java/net/tfminecraft/coreprotect/database/rollback/RollbackItemHandler.java b/src/main/java/net/tfminecraft/coreprotect/database/rollback/RollbackItemHandler.java index 84f4345..e794c74 100644 --- a/src/main/java/net/tfminecraft/coreprotect/database/rollback/RollbackItemHandler.java +++ b/src/main/java/net/tfminecraft/coreprotect/database/rollback/RollbackItemHandler.java @@ -22,6 +22,8 @@ public class RollbackItemHandler { * The metadata as a byte array * @return Object array containing [slot, facing, itemstack] */ + // Existing database records use this legacy metadata representation; preserve read/write compatibility. + @SuppressWarnings("deprecation") public static Object[] populateItemStack(ItemStack itemstack, byte[] metadata) { if (metadata != null) { try { diff --git a/src/main/java/net/tfminecraft/coreprotect/database/rollback/RollbackUtil.java b/src/main/java/net/tfminecraft/coreprotect/database/rollback/RollbackUtil.java index c4aeb26..03d0a8e 100644 --- a/src/main/java/net/tfminecraft/coreprotect/database/rollback/RollbackUtil.java +++ b/src/main/java/net/tfminecraft/coreprotect/database/rollback/RollbackUtil.java @@ -44,6 +44,8 @@ public class RollbackUtil extends Lookup { + // Existing database records use this legacy metadata representation; preserve read/write compatibility. + @SuppressWarnings("deprecation") protected static int modifyContainerItems(Material type, Object container, int slot, ItemStack itemstack, int action) { int modifiedArmor = -1; try { @@ -286,7 +288,7 @@ else if ((rowType == Material.FIREWORK_STAR)) { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({"deprecation", "unchecked"}) public static Object[] populateItemStack(ItemStack itemstack, Object list) { int slot = 0; String faceData = ""; @@ -486,6 +488,8 @@ else if ((rowType == Material.SUSPICIOUS_STEW)) { return new Object[] { slot, faceData, itemstack }; } + // Existing database records use this legacy metadata representation; preserve read/write compatibility. + @SuppressWarnings("deprecation") public static Object[] populateItemStack(ItemStack itemstack, byte[] metadata) { if (metadata != null) { try { diff --git a/src/main/java/net/tfminecraft/coreprotect/database/statement/BlockStatement.java b/src/main/java/net/tfminecraft/coreprotect/database/statement/BlockStatement.java index 8754dc2..38b561e 100644 --- a/src/main/java/net/tfminecraft/coreprotect/database/statement/BlockStatement.java +++ b/src/main/java/net/tfminecraft/coreprotect/database/statement/BlockStatement.java @@ -104,6 +104,8 @@ private static byte[] serializeMetadataStrict(List metadata, DatabaseTyp return result; } + // Existing database records use this legacy metadata representation; preserve read/write compatibility. + @SuppressWarnings("deprecation") private static List deserializeMetadataStrict(byte[] metadata) throws Exception { if (BlockMetaCodec.isEncoded(metadata)) { return BlockMetaCodec.decode(metadata); diff --git a/src/main/java/net/tfminecraft/coreprotect/database/statement/EntityStatement.java b/src/main/java/net/tfminecraft/coreprotect/database/statement/EntityStatement.java index 5b74abe..39b23c0 100644 --- a/src/main/java/net/tfminecraft/coreprotect/database/statement/EntityStatement.java +++ b/src/main/java/net/tfminecraft/coreprotect/database/statement/EntityStatement.java @@ -95,6 +95,8 @@ private static byte[] serializeDataStrict(List data, Kind kind, Database return serializeLegacyData(sanitizeData(data)); } + // Existing database records use this legacy metadata representation; preserve read/write compatibility. + @SuppressWarnings("deprecation") private static byte[] serializeLegacyData(List data) throws Exception { try (ByteArrayOutputStream output = new ByteArrayOutputStream(); BukkitObjectOutputStream objectOutput = new BukkitObjectOutputStream(output)) { objectOutput.writeObject(data); @@ -211,6 +213,8 @@ public static List readData(ResultSet resultSet, String column, Kind kin return deserializeData(DatabaseUtils.getBytes(resultSet, column), kind); } + // Existing database records use this legacy metadata representation; preserve read/write compatibility. + @SuppressWarnings("deprecation") private static List deserializeDataStrict(byte[] data, Kind kind) throws Exception { if (EntityDataCodec.isEncoded(data)) { return EntityDataCodec.decode(kind, data); diff --git a/src/main/java/net/tfminecraft/coreprotect/language/Language.java b/src/main/java/net/tfminecraft/coreprotect/language/Language.java index 86cd0c1..1895c90 100644 --- a/src/main/java/net/tfminecraft/coreprotect/language/Language.java +++ b/src/main/java/net/tfminecraft/coreprotect/language/Language.java @@ -22,6 +22,8 @@ protected static String getTranslatedPhrase(Phrase phrase) { return translatedPhrases.get(phrase); } + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") protected static void setUserPhrase(Phrase phrase, String value) { if (value != null) { value = ChatColor.translateAlternateColorCodes('&', value); @@ -29,6 +31,8 @@ protected static void setUserPhrase(Phrase phrase, String value) { userPhrases.put(phrase, value); } + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") protected static void setTranslatedPhrase(Phrase phrase, String value) { if (value != null) { value = ChatColor.translateAlternateColorCodes('&', value); diff --git a/src/main/java/net/tfminecraft/coreprotect/listener/entity/EntityDeathListener.java b/src/main/java/net/tfminecraft/coreprotect/listener/entity/EntityDeathListener.java index f6a7521..469f6b9 100644 --- a/src/main/java/net/tfminecraft/coreprotect/listener/entity/EntityDeathListener.java +++ b/src/main/java/net/tfminecraft/coreprotect/listener/entity/EntityDeathListener.java @@ -129,6 +129,8 @@ public static void parseEntityKills(String message) { } } + // Entity rollback data retains legacy names and age/boat fields for existing records. + @SuppressWarnings("deprecation") protected static void logEntityDeath(LivingEntity entity, String e) { if (!Config.getConfig(entity.getWorld()).ENTITY_KILLS) { return; @@ -625,6 +627,8 @@ private static List serializeMemoryLocation(Location location) { return data; } + // Entity rollback data retains legacy names and age/boat fields for existing records. + @SuppressWarnings("deprecation") private static boolean shouldSuppressEntityKill(String user, LivingEntity entity, DamageCause cause) { if (user == null || !user.startsWith("#") || "#command".equals(user)) { return false; diff --git a/src/main/java/net/tfminecraft/coreprotect/listener/player/CraftItemListener.java b/src/main/java/net/tfminecraft/coreprotect/listener/player/CraftItemListener.java index bdda13d..2f6d9e9 100644 --- a/src/main/java/net/tfminecraft/coreprotect/listener/player/CraftItemListener.java +++ b/src/main/java/net/tfminecraft/coreprotect/listener/player/CraftItemListener.java @@ -66,6 +66,8 @@ else if (action == ItemLogger.ITEM_CREATE) { Queue.queueItemTransaction(user, location.clone(), time, 0, itemId); } + // Audit records store legacy ingredient stacks, rather than recipe-choice alternatives. + @SuppressWarnings("deprecation") protected static void playerCraftItem(InventoryClickEvent event, boolean isTrade) { if (event.getResult() == Result.DENY || event.getSlotType() != SlotType.RESULT) { return; diff --git a/src/main/java/net/tfminecraft/coreprotect/listener/player/PlayerChatListener.java b/src/main/java/net/tfminecraft/coreprotect/listener/player/PlayerChatListener.java index a285420..269aa77 100644 --- a/src/main/java/net/tfminecraft/coreprotect/listener/player/PlayerChatListener.java +++ b/src/main/java/net/tfminecraft/coreprotect/listener/player/PlayerChatListener.java @@ -11,6 +11,8 @@ public final class PlayerChatListener extends Queue implements Listener { + // Bukkit chat fallback remains supported; the Paper chat listener handles Adventure events. + @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.MONITOR) public void onPlayerChat(AsyncPlayerChatEvent event) { String message = event.getMessage(); diff --git a/src/main/java/net/tfminecraft/coreprotect/listener/player/SignChangeListener.java b/src/main/java/net/tfminecraft/coreprotect/listener/player/SignChangeListener.java index e1094cb..0170182 100644 --- a/src/main/java/net/tfminecraft/coreprotect/listener/player/SignChangeListener.java +++ b/src/main/java/net/tfminecraft/coreprotect/listener/player/SignChangeListener.java @@ -17,6 +17,8 @@ public final class SignChangeListener extends Queue implements Listener { + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.MONITOR) protected void onSignChange(SignChangeEvent event) { Block block = event.getBlock(); diff --git a/src/main/java/net/tfminecraft/coreprotect/listener/player/inspector/BlockInspector.java b/src/main/java/net/tfminecraft/coreprotect/listener/player/inspector/BlockInspector.java index 8f31136..069d274 100644 --- a/src/main/java/net/tfminecraft/coreprotect/listener/player/inspector/BlockInspector.java +++ b/src/main/java/net/tfminecraft/coreprotect/listener/player/inspector/BlockInspector.java @@ -16,6 +16,8 @@ public class BlockInspector extends BaseInspector { public void performBlockLookup(final Player player, final BlockState blockState) { class BasicThread implements Runnable { + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") @Override public void run() { try { diff --git a/src/main/java/net/tfminecraft/coreprotect/model/BlockGroup.java b/src/main/java/net/tfminecraft/coreprotect/model/BlockGroup.java index 39c2414..6482f63 100644 --- a/src/main/java/net/tfminecraft/coreprotect/model/BlockGroup.java +++ b/src/main/java/net/tfminecraft/coreprotect/model/BlockGroup.java @@ -72,7 +72,7 @@ public static void initialize() { TRACK_ANY.addAll(BUTTONS); TRACK_TOP.addAll(DOORS); TRACK_TOP.addAll(PRESSURE_PLATES); - TRACK_TOP.addAll(Tag.CARPETS.getValues()); + TRACK_TOP.addAll(Tag.WOOL_CARPETS.getValues()); TRACK_TOP_BOTTOM.addAll(LANTERNS); LIGHTABLES.addAll(CANDLES); INTERACT_BLOCKS.addAll(DOORS); diff --git a/src/main/java/net/tfminecraft/coreprotect/paper/PaperAdapter.java b/src/main/java/net/tfminecraft/coreprotect/paper/PaperAdapter.java index 32847e5..2872652 100644 --- a/src/main/java/net/tfminecraft/coreprotect/paper/PaperAdapter.java +++ b/src/main/java/net/tfminecraft/coreprotect/paper/PaperAdapter.java @@ -136,6 +136,8 @@ public boolean setEntityMeta(Entity entity, Object value, int count) { return false; } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public String getSkullOwner(Skull skull) { OfflinePlayer player = skull.getOwningPlayer(); @@ -146,6 +148,8 @@ public String getSkullOwner(Skull skull) { return player.getUniqueId().toString(); } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public void setSkullOwner(Skull skull, String owner) { if (owner != null && owner.length() >= 32 && owner.contains("-")) { diff --git a/src/main/java/net/tfminecraft/coreprotect/paper/Paper_v1_17.java b/src/main/java/net/tfminecraft/coreprotect/paper/Paper_v1_17.java index 956b328..1655236 100644 --- a/src/main/java/net/tfminecraft/coreprotect/paper/Paper_v1_17.java +++ b/src/main/java/net/tfminecraft/coreprotect/paper/Paper_v1_17.java @@ -6,6 +6,8 @@ public class Paper_v1_17 extends PaperHandler { + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public String getLine(Sign sign, int line) { if (line >= 4) { diff --git a/src/main/java/net/tfminecraft/coreprotect/paper/Paper_v1_20.java b/src/main/java/net/tfminecraft/coreprotect/paper/Paper_v1_20.java index 50c3655..f4cb02e 100644 --- a/src/main/java/net/tfminecraft/coreprotect/paper/Paper_v1_20.java +++ b/src/main/java/net/tfminecraft/coreprotect/paper/Paper_v1_20.java @@ -29,6 +29,8 @@ public String getLine(Sign sign, int line) { } } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public String getSkullOwner(Skull skull) { PlayerProfile playerProfile = skull.getPlayerProfile(); @@ -47,6 +49,8 @@ else if (Config.getGlobal().MYSQL && owner != null && owner.length() > 255) { return owner; } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public void setSkullOwner(Skull skull, String owner) { if (owner == null || owner.length() == 0) { @@ -61,6 +65,8 @@ public void setSkullOwner(Skull skull, String owner) { } } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public String getSkullSkin(Skull skull) { PlayerProfile playerProfile = skull.getPlayerProfile(); @@ -76,6 +82,8 @@ public String getSkullSkin(Skull skull) { return skin.toString(); } + // Version-specific adapter: retain the API available on the older servers handled here. + @SuppressWarnings("deprecation") @Override public void setSkullSkin(Skull skull, String skin) { try { diff --git a/src/main/java/net/tfminecraft/coreprotect/paper/listener/LegacyTNTPrimeListener.java b/src/main/java/net/tfminecraft/coreprotect/paper/listener/LegacyTNTPrimeListener.java index 74a708b..7109e20 100644 --- a/src/main/java/net/tfminecraft/coreprotect/paper/listener/LegacyTNTPrimeListener.java +++ b/src/main/java/net/tfminecraft/coreprotect/paper/listener/LegacyTNTPrimeListener.java @@ -14,6 +14,8 @@ public final class LegacyTNTPrimeListener extends Queue implements Listener { + // Compatibility fallback for Paper versions predating Bukkit's TNTPrimeEvent. + @SuppressWarnings({ "deprecation", "removal" }) @EventHandler(priority = EventPriority.MONITOR) protected void onTNTPrime(TNTPrimeEvent event) { Block block = event.getBlock(); diff --git a/src/main/java/net/tfminecraft/coreprotect/patch/Patch.java b/src/main/java/net/tfminecraft/coreprotect/patch/Patch.java index 1a0b0c8..db8cdca 100755 --- a/src/main/java/net/tfminecraft/coreprotect/patch/Patch.java +++ b/src/main/java/net/tfminecraft/coreprotect/patch/Patch.java @@ -278,6 +278,8 @@ public void run() { } } class runPatch implements Runnable { + // Historical database migrations must keep their original server data interpretation. + @SuppressWarnings("deprecation") @Override public void run() { try { diff --git a/src/main/java/net/tfminecraft/coreprotect/patch/script/__2_11_0.java b/src/main/java/net/tfminecraft/coreprotect/patch/script/__2_11_0.java index 08039b7..7e65a9e 100755 --- a/src/main/java/net/tfminecraft/coreprotect/patch/script/__2_11_0.java +++ b/src/main/java/net/tfminecraft/coreprotect/patch/script/__2_11_0.java @@ -13,6 +13,8 @@ public class __2_11_0 { + // Historical database migration must preserve the original numeric Bukkit IDs. + @SuppressWarnings({ "deprecation", "removal" }) protected static boolean patch(Statement statement) { try { if (Config.getGlobal().MYSQL) { diff --git a/src/main/java/net/tfminecraft/coreprotect/patch/script/__2_18_0.java b/src/main/java/net/tfminecraft/coreprotect/patch/script/__2_18_0.java index 9afe4a4..a9c9da6 100644 --- a/src/main/java/net/tfminecraft/coreprotect/patch/script/__2_18_0.java +++ b/src/main/java/net/tfminecraft/coreprotect/patch/script/__2_18_0.java @@ -23,6 +23,8 @@ public class __2_18_0 { protected static boolean createIndexes = true; + // Historical database migrations must keep their original server data interpretation. + @SuppressWarnings("deprecation") protected static boolean patch(Statement statement) { try { diff --git a/src/main/java/net/tfminecraft/coreprotect/services/PluginInitializationService.java b/src/main/java/net/tfminecraft/coreprotect/services/PluginInitializationService.java index 4339b96..5e520e2 100644 --- a/src/main/java/net/tfminecraft/coreprotect/services/PluginInitializationService.java +++ b/src/main/java/net/tfminecraft/coreprotect/services/PluginInitializationService.java @@ -119,6 +119,8 @@ private static void createDataDirectory() { * @param plugin * The CoreProtect plugin instance */ + // Plugin description access also supports older Bukkit and third-party Plugin implementations. + @SuppressWarnings("deprecation") private static void displayStartupMessages(JavaPlugin plugin) { PluginDescriptionFile pluginDescription = plugin.getDescription(); ChatUtils.sendConsoleComponentStartup(Bukkit.getServer().getConsoleSender(), Phrase.build(Phrase.ENABLE_SUCCESS, ConfigHandler.EDITION_NAME)); diff --git a/src/main/java/net/tfminecraft/coreprotect/services/ShutdownService.java b/src/main/java/net/tfminecraft/coreprotect/services/ShutdownService.java index 70cd8b8..27cac60 100644 --- a/src/main/java/net/tfminecraft/coreprotect/services/ShutdownService.java +++ b/src/main/java/net/tfminecraft/coreprotect/services/ShutdownService.java @@ -42,6 +42,8 @@ private ShutdownService() { * @param plugin * The CoreProtect plugin instance */ + // Plugin description access also supports older Bukkit and third-party Plugin implementations. + @SuppressWarnings("deprecation") public static void safeShutdown(Plugin plugin) { try { Consumer.blockDatabaseReloadForShutdown(); diff --git a/src/main/java/net/tfminecraft/coreprotect/spigot/SpigotHandler.java b/src/main/java/net/tfminecraft/coreprotect/spigot/SpigotHandler.java index 5b53561..45059e9 100644 --- a/src/main/java/net/tfminecraft/coreprotect/spigot/SpigotHandler.java +++ b/src/main/java/net/tfminecraft/coreprotect/spigot/SpigotHandler.java @@ -25,12 +25,18 @@ public class SpigotHandler extends SpigotAdapter implements SpigotInterface { + // Spigot fallback retains Bungee colors; the Paper adapter uses Adventure. + @SuppressWarnings("deprecation") public static ChatColor DARK_AQUA = ChatColor.of("#31b0e8"); + // Spigot fallback uses Bungee components; Adventure handling lives in the Paper adapter. + @SuppressWarnings("deprecation") public SpigotHandler() { Color.DARK_AQUA = SpigotHandler.DARK_AQUA.toString(); } + // Spigot fallback uses Bungee components; Adventure handling lives in the Paper adapter. + @SuppressWarnings("deprecation") @Override public void addHoverComponent(Object message, String[] data) { try { @@ -86,6 +92,8 @@ public void addHoverComponent(Object message, String[] data) { } } + // Spigot fallback uses Bungee components; Adventure handling lives in the Paper adapter. + @SuppressWarnings("deprecation") @Override public void setHoverEvent(Object component, String text) { if (Config.getGlobal().HOVER_EVENTS) { @@ -93,6 +101,8 @@ public void setHoverEvent(Object component, String text) { } } + // Spigot fallback uses Bungee components; Adventure handling lives in the Paper adapter. + @SuppressWarnings("deprecation") @Override public void sendComponent(CommandSender sender, String string, String bypass) { TextComponent message = new TextComponent(); @@ -180,6 +190,8 @@ public void setVillagerGossipDecayTime(Villager villager, Object value) { } } + // Spigot fallback uses Bungee components; Adventure handling lives in the Paper adapter. + @SuppressWarnings("deprecation") private static void addBuilder(TextComponent message, StringBuilder builder) { String[] splitBuilder = builder.toString().split(SpigotHandler.DARK_AQUA.toString()); for (int i = 0; i < splitBuilder.length; i++) { diff --git a/src/main/java/net/tfminecraft/coreprotect/thread/NetworkHandler.java b/src/main/java/net/tfminecraft/coreprotect/thread/NetworkHandler.java index a4d039f..65ecd27 100755 --- a/src/main/java/net/tfminecraft/coreprotect/thread/NetworkHandler.java +++ b/src/main/java/net/tfminecraft/coreprotect/thread/NetworkHandler.java @@ -70,7 +70,7 @@ public void run() { boolean keyValidated = true; String keyConfig = Config.getGlobal().DONATION_KEY.trim(); if (keyConfig.length() > 0) { - URL url = new URL("http://coreprotect.net/license/" + keyConfig); + URL url = java.net.URI.create("http://coreprotect.net/license/" + keyConfig).toURL(); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Accept-Charset", "UTF-8"); @@ -197,7 +197,7 @@ else if (Files.isReadable(licensePath)) { int postDataLength = postData.length; try { - URL url = new URL("http://coreprotect.net/translate/"); + URL url = java.net.URI.create("http://coreprotect.net/translate/").toURL(); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Accept-Charset", "UTF-8"); @@ -295,7 +295,7 @@ else if (Files.isReadable(licensePath)) { try { // CoreProtect Community Edition - URL url = new URL("http://update.coreprotect.net/version/"); + URL url = java.net.URI.create("http://update.coreprotect.net/version/").toURL(); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Accept-Charset", "UTF-8"); @@ -307,7 +307,7 @@ else if (Files.isReadable(licensePath)) { status = connection.getResponseCode(); // CoreProtect Edge - url = new URL("http://update.coreprotect.net/version-edge/"); + url = java.net.URI.create("http://update.coreprotect.net/version-edge/").toURL(); connectionEdge = (HttpURLConnection) url.openConnection(); connectionEdge.setRequestMethod("GET"); connectionEdge.setRequestProperty("Accept-Charset", "UTF-8"); @@ -383,7 +383,7 @@ else if (Files.isReadable(licensePath)) { /* Stat gathering */ int port = Bukkit.getServer().getPort(); String stats = port + ":" + (donationKey != null ? donationKey : "") + ":" + version + ConfigHandler.EDITION_BRANCH; - URL url = new URL("http://stats.coreprotect.net/u/?data=" + stats); + URL url = java.net.URI.create("http://stats.coreprotect.net/u/?data=" + stats).toURL(); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Accept-Charset", "UTF-8"); diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/Chat.java b/src/main/java/net/tfminecraft/coreprotect/utility/Chat.java index aeabe22..6cda6a8 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/Chat.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/Chat.java @@ -23,6 +23,8 @@ private Chat() { throw new IllegalStateException("Utility class"); } + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") public static String translateColorCodes(String text) { if (text == null) { return null; @@ -39,6 +41,8 @@ public static void sendComponent(CommandSender sender, String string) { sendComponent(sender, string, null); } + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") public static void sendMessage(CommandSender sender, String message) { message = translateColorCodes(message); if (sender instanceof ConsoleCommandSender) { diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/ChatMessage.java b/src/main/java/net/tfminecraft/coreprotect/utility/ChatMessage.java index 1b2b0cd..b23a8c8 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/ChatMessage.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/ChatMessage.java @@ -99,6 +99,8 @@ public String build(boolean tag, String separator, String color, String style) { return build(); } + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") public static String parseQuotes(String string, String textColor) { int indexFirst = string.indexOf("\""); int indexLast = string.lastIndexOf("\""); @@ -110,6 +112,8 @@ public static String parseQuotes(String string, String textColor) { return string; } + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") private static String createSpaces(String string, boolean seperatorOffset, boolean createSpaces) { String result = ""; if (!createSpaces) { diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/Color.java b/src/main/java/net/tfminecraft/coreprotect/utility/Color.java index f703075..3eb0317 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/Color.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/Color.java @@ -1,6 +1,5 @@ package net.tfminecraft.coreprotect.utility; -import org.bukkit.ChatColor; public final class Color { @@ -10,112 +9,112 @@ public final class Color { /** * Represents black. */ - public static final String BLACK = ChatColor.BLACK.toString(); + public static final String BLACK = "\u00a70"; /** * Represents dark blue. */ - public static final String DARK_BLUE = ChatColor.DARK_BLUE.toString(); + public static final String DARK_BLUE = "\u00a71"; /** * Represents dark green. */ - public static final String DARK_GREEN = ChatColor.DARK_GREEN.toString(); + public static final String DARK_GREEN = "\u00a72"; /** * Represents dark blue (aqua). */ - public static String DARK_AQUA = ChatColor.DARK_AQUA.toString(); + public static String DARK_AQUA = "\u00a73"; /** * Represents dark red. */ - public static final String DARK_RED = ChatColor.DARK_RED.toString(); + public static final String DARK_RED = "\u00a74"; /** * Represents dark purple. */ - public static final String DARK_PURPLE = ChatColor.DARK_PURPLE.toString(); + public static final String DARK_PURPLE = "\u00a75"; /** * Represents gold. */ - public static final String GOLD = ChatColor.GOLD.toString(); + public static final String GOLD = "\u00a76"; /** * Represents grey. */ - public static final String GREY = ChatColor.GRAY.toString(); + public static final String GREY = "\u00a77"; /** * Represents dark grey. */ - public static final String DARK_GREY = ChatColor.DARK_GRAY.toString(); + public static final String DARK_GREY = "\u00a78"; /** * Represents blue. */ - public static final String BLUE = ChatColor.BLUE.toString(); + public static final String BLUE = "\u00a79"; /** * Represents green. */ - public static final String GREEN = ChatColor.GREEN.toString(); + public static final String GREEN = "\u00a7a"; /** * Represents aqua. */ - public static final String AQUA = ChatColor.AQUA.toString(); + public static final String AQUA = "\u00a7b"; /** * Represents red. */ - public static final String RED = ChatColor.RED.toString(); + public static final String RED = "\u00a7c"; /** * Represents light purple. */ - public static final String LIGHT_PURPLE = ChatColor.LIGHT_PURPLE.toString(); + public static final String LIGHT_PURPLE = "\u00a7d"; /** * Represents yellow. */ - public static final String YELLOW = ChatColor.YELLOW.toString(); + public static final String YELLOW = "\u00a7e"; /** * Represents white. */ - public static final String WHITE = ChatColor.WHITE.toString(); + public static final String WHITE = "\u00a7f"; /** * Represents magical characters that change around randomly. */ - public static final String MAGIC = ChatColor.COLOR_CHAR + "k"; + public static final String MAGIC = "\u00a7k"; /** * Makes the text bold. */ - public static final String BOLD = ChatColor.COLOR_CHAR + "l"; + public static final String BOLD = "\u00a7l"; /** * Makes a line appear through the text. */ - public static final String STRIKETHROUGH = ChatColor.COLOR_CHAR + "m"; + public static final String STRIKETHROUGH = "\u00a7m"; /** * Makes the text appear underlined. */ - public static final String UNDERLINE = ChatColor.COLOR_CHAR + "n"; + public static final String UNDERLINE = "\u00a7n"; /** * Makes the text italic. */ - public static final String ITALIC = ChatColor.COLOR_CHAR + "o"; + public static final String ITALIC = "\u00a7o"; /** * Resets all previous chat colors or formats. */ - public static final String RESET = ChatColor.COLOR_CHAR + "r"; + public static final String RESET = "\u00a7r"; private Color() { throw new IllegalStateException("Utility class"); diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/EntitySpawnTracking.java b/src/main/java/net/tfminecraft/coreprotect/utility/EntitySpawnTracking.java index 00e7546..42fe095 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/EntitySpawnTracking.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/EntitySpawnTracking.java @@ -941,6 +941,8 @@ public static void confirmDatabaseLocation(UUID uuid, Location location, long ep } } + // Entity rollback data retains legacy names and age/boat fields for existing records. + @SuppressWarnings({"deprecation", "removal"}) public static List serializeState(Entity entity) { List state = new ArrayList<>(); state.add(entity.getCustomName()); @@ -982,6 +984,8 @@ public static List serializeState(Entity entity) { return state; } + // Entity rollback data retains legacy names and age/boat fields for existing records. + @SuppressWarnings("deprecation") public static List serializeKillData(Entity entity) { List data = new ArrayList<>(); data.add(new ArrayList<>()); @@ -1040,6 +1044,8 @@ public static ItemStack[] deserializeInventoryState(List state) { return contents; } + // Entity rollback data retains legacy names and age/boat fields for existing records. + @SuppressWarnings({"deprecation", "removal"}) public static void restoreState(Entity entity, List state) { if (state == null || state.isEmpty()) { return; diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/ErrorReporter.java b/src/main/java/net/tfminecraft/coreprotect/utility/ErrorReporter.java index 4bed82d..8f3532c 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/ErrorReporter.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/ErrorReporter.java @@ -283,7 +283,7 @@ private static void sendHttp(JSONObject report) throws Exception { HttpURLConnection connection = null; try { - URL url = new URL(REPORT_URL); + URL url = java.net.URI.create(REPORT_URL).toURL(); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Accept-Charset", "UTF-8"); diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/ItemUtils.java b/src/main/java/net/tfminecraft/coreprotect/utility/ItemUtils.java index 7c39990..02b9642 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/ItemUtils.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/ItemUtils.java @@ -472,6 +472,8 @@ public static byte[] convertByteData(Object data) { return null; } + // Existing database records use this legacy metadata representation; preserve read/write compatibility. + @SuppressWarnings("deprecation") private static byte[] serializeByteData(Object data) throws Exception { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); BukkitObjectOutputStream objectStream = new BukkitObjectOutputStream(byteStream)) { objectStream.writeObject(data); @@ -687,6 +689,8 @@ public static ItemStack getItemStack(byte[] metadata, int type, int amount) { return item; } + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") public static String getEnchantments(byte[] metadata, int type, int amount) { var item = getItemStack(metadata, type, amount); if (item == null) return ""; diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/MaterialUtils.java b/src/main/java/net/tfminecraft/coreprotect/utility/MaterialUtils.java index e7031af..6ea13a8 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/MaterialUtils.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/MaterialUtils.java @@ -151,7 +151,7 @@ public static Material getType(int id) { name = net.tfminecraft.coreprotect.bukkit.BukkitAdapter.ADAPTER.parseLegacyName(name); material = Material.getMaterial(name); - if (material == null && Material.getMaterial(Material.LEGACY_PREFIX + name) != null) { + if (material == null && Material.getMaterial("LEGACY_" + name) != null) { material = Material.getMaterial(name, true); } } diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/VersionUtils.java b/src/main/java/net/tfminecraft/coreprotect/utility/VersionUtils.java index 19e167a..757e51b 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/VersionUtils.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/VersionUtils.java @@ -18,6 +18,8 @@ private VersionUtils() { throw new IllegalStateException("Utility class"); } + // Plugin description access also supports older Bukkit and third-party Plugin implementations. + @SuppressWarnings("deprecation") public static String getPluginVersion() { String version = CoreProtect.getInstance().getDescription().getVersion(); if (version.contains("-")) { @@ -45,6 +47,8 @@ public static Integer[] getInternalPluginVersion() { return new Integer[] { major, minor, revision }; } + // Plugin description access also supports older Bukkit and third-party Plugin implementations. + @SuppressWarnings("deprecation") public static String getPluginName() { CoreProtect instance = CoreProtect.getInstance(); // Return default name if instance is null @@ -185,6 +189,8 @@ public static boolean newVersion(String oldVersion, String currentVersion) { return newVersion(StringUtils.convertArray(oldVersionSplit), StringUtils.convertArray(currentVersionSplit)); } + // Plugin description access also supports older Bukkit and third-party Plugin implementations. + @SuppressWarnings("deprecation") public static void loadWorldEdit() { try { Plugin worldEdit = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"); @@ -262,6 +268,8 @@ else if (version.contains(".")) { return validVersion; } + // Plugin description access also supports older Bukkit and third-party Plugin implementations. + @SuppressWarnings("deprecation") private static boolean isFastAsyncWorldEdit(Plugin plugin) { return plugin != null && plugin.getDescription() != null && "FastAsyncWorldEdit".equals(plugin.getDescription().getName()); } diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/entity/EntityUtil.java b/src/main/java/net/tfminecraft/coreprotect/utility/entity/EntityUtil.java index 48d2d1b..4e54f32 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/entity/EntityUtil.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/entity/EntityUtil.java @@ -98,6 +98,8 @@ public static CompletableFuture restoreEntity(final Location blockLocati return scheduleEntitySpawn(blockLocation, type, list, false); } + // Entity rollback data retains legacy names and age/boat fields for existing records. + @SuppressWarnings("deprecation") private static CompletableFuture scheduleEntitySpawn(final Location blockLocation, final EntityType type, final List list, final boolean legacyTransition) { CompletableFuture completion = new CompletableFuture<>(); if (type == null) { diff --git a/src/main/java/net/tfminecraft/coreprotect/utility/serialize/ItemMetaHandler.java b/src/main/java/net/tfminecraft/coreprotect/utility/serialize/ItemMetaHandler.java index b69233f..3605499 100644 --- a/src/main/java/net/tfminecraft/coreprotect/utility/serialize/ItemMetaHandler.java +++ b/src/main/java/net/tfminecraft/coreprotect/utility/serialize/ItemMetaHandler.java @@ -95,6 +95,8 @@ private static Map getEnchantments(ItemMeta itemMeta) { return itemMeta.getEnchants(); } + // Keep the existing legacy text representation, formatting, and exact-string comparisons. + @SuppressWarnings("deprecation") public static List getEnchantments(ItemStack item, String displayName) { List result = new ArrayList<>(); ItemMeta itemMeta = item.getItemMeta(); diff --git a/src/main/java/net/tfminecraft/coreprotect/worldedit/CoreProtectLogger.java b/src/main/java/net/tfminecraft/coreprotect/worldedit/CoreProtectLogger.java index 989ada5..3cb1581 100755 --- a/src/main/java/net/tfminecraft/coreprotect/worldedit/CoreProtectLogger.java +++ b/src/main/java/net/tfminecraft/coreprotect/worldedit/CoreProtectLogger.java @@ -36,12 +36,14 @@ protected CoreProtectLogger(Actor actor, World world, Extent extent) { this.eventExtent = extent; } + // Retain the legacy WorldEdit logging contract and NBT representation. + @SuppressWarnings("deprecation") @Override public > boolean setBlock(BlockVector3 position, T block) throws WorldEditException { org.bukkit.World world = BukkitAdapter.adapt(eventWorld); if (!Config.getConfig(world).WORLDEDIT) { if (CoreProtectEditSessionEvent.isFAWE()) { - return eventExtent.setBlock(position.getX(), position.getY(), position.getZ(), block); + return eventExtent.setBlock(position.x(), position.y(), position.z(), block); } else { return eventExtent.setBlock(position, block); @@ -50,7 +52,7 @@ public > boolean setBlock(BlockVector3 position, T BlockState oldBlock = eventExtent.getBlock(position); Material oldType = BukkitAdapter.adapt(oldBlock.getBlockType()); - Location location = new Location(world, position.getBlockX(), position.getBlockY(), position.getBlockZ()); + Location location = new Location(world, position.x(), position.y(), position.z()); BaseBlock baseBlock = WorldEditLogger.getBaseBlock(eventExtent, position, location, oldType, oldBlock); // No clear way to get container content data from within the WorldEdit API @@ -59,7 +61,7 @@ public > boolean setBlock(BlockVector3 position, T ItemStack[] containerData = CoreProtectEditSessionEvent.isFAWE() ? null : ItemUtils.getContainerContents(oldType, null, location); if (CoreProtectEditSessionEvent.isFAWE()) { - if (eventExtent.setBlock(position.getX(), position.getY(), position.getZ(), block)) { + if (eventExtent.setBlock(position.x(), position.y(), position.z(), block)) { WorldEditLogger.postProcess(eventExtent, eventActor, position, location, block, baseBlock, oldType, oldBlock, containerData); return true; } @@ -118,7 +120,7 @@ private void processPatternToBlocks(org.bukkit.World world, Set vs for (BlockVector3 position : vset) { BlockState oldBlock = eventExtent.getBlock(position); Material oldType = BukkitAdapter.adapt(oldBlock.getBlockType()); - Location location = new Location(world, position.getBlockX(), position.getBlockY(), position.getBlockZ()); + Location location = new Location(world, position.x(), position.y(), position.z()); BaseBlock baseBlock = WorldEditLogger.getBaseBlock(eventExtent, position, location, oldType, oldBlock); // No clear way to get container content data from within the WorldEdit API @@ -133,7 +135,7 @@ private void processPatternToBlocks(org.bukkit.World world, Region region, Patte for (BlockVector3 position : region.clone()) { BlockState oldBlock = eventExtent.getBlock(position); Material oldType = BukkitAdapter.adapt(oldBlock.getBlockType()); - Location location = new Location(world, position.getBlockX(), position.getBlockY(), position.getBlockZ()); + Location location = new Location(world, position.x(), position.y(), position.z()); BaseBlock baseBlock = WorldEditLogger.getBaseBlock(eventExtent, position, location, oldType, oldBlock); // No clear way to get container content data from within the WorldEdit API diff --git a/src/main/java/net/tfminecraft/coreprotect/worldedit/WorldEditBlockState.java b/src/main/java/net/tfminecraft/coreprotect/worldedit/WorldEditBlockState.java index 73f2f27..98b569e 100644 --- a/src/main/java/net/tfminecraft/coreprotect/worldedit/WorldEditBlockState.java +++ b/src/main/java/net/tfminecraft/coreprotect/worldedit/WorldEditBlockState.java @@ -32,11 +32,15 @@ public WorldEditBlockState(Location loc, Material type, BlockData data) { blockData = data; } + // BlockState requires these legacy interface methods for the WorldEdit wrapper. + @SuppressWarnings("deprecation") @Override public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { } + // BlockState requires these legacy interface methods for the WorldEdit wrapper. + @SuppressWarnings("deprecation") @Override public List getMetadata(String metadataKey) { return null; @@ -57,6 +61,8 @@ public Block getBlock() { return null; } + // BlockState requires these legacy interface methods for the WorldEdit wrapper. + @SuppressWarnings({"deprecation", "removal"}) @Override public MaterialData getData() { return null; @@ -121,6 +127,8 @@ public Chunk getChunk() { return null; } + // BlockState requires these legacy interface methods for the WorldEdit wrapper. + @SuppressWarnings({"deprecation", "removal"}) @Override public void setData(MaterialData data) { @@ -151,11 +159,15 @@ public boolean update(boolean force, boolean applyPhysics) { return false; } + // BlockState requires these legacy interface methods for the WorldEdit wrapper. + @SuppressWarnings({"deprecation", "removal"}) @Override public byte getRawData() { return 0; } + // BlockState requires these legacy interface methods for the WorldEdit wrapper. + @SuppressWarnings({"deprecation", "removal"}) @Override public void setRawData(byte data) { diff --git a/src/main/java/net/tfminecraft/coreprotect/worldedit/WorldEditLogger.java b/src/main/java/net/tfminecraft/coreprotect/worldedit/WorldEditLogger.java index 4695e22..50ced64 100644 --- a/src/main/java/net/tfminecraft/coreprotect/worldedit/WorldEditLogger.java +++ b/src/main/java/net/tfminecraft/coreprotect/worldedit/WorldEditLogger.java @@ -54,6 +54,8 @@ protected static BaseBlock getBaseBlock(Extent extent, BlockVector3 position, Lo return null; } + // Retain the legacy WorldEdit logging contract and NBT representation. + @SuppressWarnings("deprecation") protected static void postProcess(Extent extent, Actor actor, BlockVector3 position, Location location, BlockStateHolder blockStateHolder, BaseBlock baseBlock, Material oldType, com.sk89q.worldedit.world.block.BlockState oldBlockState, ItemStack[] containerContents) { BlockData oldBlockData = BukkitAdapter.adapt(oldBlockState); BlockData newBlockData = BukkitAdapter.adapt(blockStateHolder.toImmutableState()); @@ -160,6 +162,8 @@ else if (oldBlockData instanceof Bisected) { } } + // Retain the legacy WorldEdit logging contract and NBT representation. + @SuppressWarnings("deprecation") private static String getMobType(BaseBlock fullBlock) { String mobType = null; try {