Added support for MC 1.21 block/entity types

This commit is contained in:
Intelli 2024-06-17 18:31:33 -06:00
parent 3e8083becf
commit 3d32320a33
9 changed files with 50 additions and 9 deletions

View file

@ -42,6 +42,7 @@ public class BukkitAdapter implements BukkitInterface {
public static final int BUKKIT_V1_18 = 18;
public static final int BUKKIT_V1_19 = 19;
public static final int BUKKIT_V1_20 = 20;
public static final int BUKKIT_V1_21 = 21;
public static void loadAdapter() {
switch (ConfigHandler.SERVER_VERSION) {
@ -63,9 +64,12 @@ public class BukkitAdapter implements BukkitInterface {
BukkitAdapter.ADAPTER = new Bukkit_v1_19();
break;
case BUKKIT_V1_20:
default:
BukkitAdapter.ADAPTER = new Bukkit_v1_20();
break;
case BUKKIT_V1_21:
default:
BukkitAdapter.ADAPTER = new Bukkit_v1_21();
break;
}
}

View file

@ -0,0 +1,25 @@
package net.coreprotect.bukkit;
import org.bukkit.Material;
import org.bukkit.Tag;
import net.coreprotect.model.BlockGroup;
public class Bukkit_v1_21 extends Bukkit_v1_20 implements BukkitInterface {
public Bukkit_v1_21() {
for (Material value : Tag.TRAPDOORS.getValues()) {
if (value == Material.IRON_TRAPDOOR) {
continue;
}
if (!BlockGroup.INTERACT_BLOCKS.contains(value)) {
BlockGroup.INTERACT_BLOCKS.add(value);
}
if (!BlockGroup.SAFE_INTERACT_BLOCKS.contains(value)) {
BlockGroup.SAFE_INTERACT_BLOCKS.add(value);
}
}
}
}