Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,37 @@
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
</transformers>
<!-- The shaded plugin is not a JPMS module. -->
<filters>
<!-- Keep the plugin manifest; dependency manifests describe separate JARs. -->
<filter>
<artifact>org.bstats:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
<filter>
<artifact>com.zaxxer:HikariCP</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
<filter>
<artifact>com.clickhouse:clickhouse-jdbc</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>module-info.class</exclude>
<exclude>META-INF/versions/**/module-info.class</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*:*:*</artifact>
<excludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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 {
Expand All @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,16 @@ 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);
// return RegistryAccess.registryAccess().getRegistry(RegistryKey.CAT_VARIANT).get((NamespacedKey)value);
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 {
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/tfminecraft/coreprotect/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ private static Map<String, byte[]> 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<String, byte[]> data) {
if (!Bukkit.isPrimaryThread()) {
// we call reloads asynchronously
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/net/tfminecraft/coreprotect/consumer/Queue.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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<Object> 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());
}
Expand Down Expand Up @@ -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<BlockState> blockStates = new ArrayList<>();
if (relative != null) {
Expand All @@ -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());
}
Expand All @@ -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());
Expand Down Expand Up @@ -589,6 +603,8 @@ public static synchronized void queueEntityRetriesFirst(List<EntityContainerRoll
}
}

// These auxiliary queues still hold distinct legacy payloads consumed by the matching processors.
@SuppressWarnings("deprecation")
private static synchronized void queueRollbackUpdates(String user, Location location, List<Object[]> rows, int table, int action, boolean inventoryRollback) {
Objects.requireNonNull(rows, "rows");
if (rows.isEmpty()) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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<BlockState> 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Integer, String> strings = Consumer.consumerStrings.get(processId);
Expand Down
Loading