Added support for MC 1.21 block/entity types
This commit is contained in:
parent
3e8083becf
commit
3d32320a33
9 changed files with 50 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
25
src/main/java/net/coreprotect/bukkit/Bukkit_v1_21.java
Normal file
25
src/main/java/net/coreprotect/bukkit/Bukkit_v1_21.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -835,6 +835,12 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
|||
|
||||
if (event.useItemInHand() != Event.Result.DENY) {
|
||||
List<Material> entityBlockTypes = Arrays.asList(Material.ARMOR_STAND, Material.END_CRYSTAL, Material.BOW, Material.CROSSBOW, Material.TRIDENT, Material.EXPERIENCE_BOTTLE, Material.SPLASH_POTION, Material.LINGERING_POTION, Material.ENDER_PEARL, Material.FIREWORK_ROCKET, Material.EGG, Material.SNOWBALL);
|
||||
try {
|
||||
entityBlockTypes.add(Material.valueOf("WIND_CHARGE"));
|
||||
}
|
||||
catch (Exception e) {
|
||||
// not running MC 1.21+
|
||||
}
|
||||
ItemStack handItem = null;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public class PaperAdapter implements PaperInterface {
|
|||
public static final int PAPER_V1_18 = BukkitAdapter.BUKKIT_V1_18;
|
||||
public static final int PAPER_V1_19 = BukkitAdapter.BUKKIT_V1_19;
|
||||
public static final int PAPER_V1_20 = BukkitAdapter.BUKKIT_V1_20;
|
||||
public static final int PAPER_V1_21 = BukkitAdapter.BUKKIT_V1_21;
|
||||
|
||||
public static void loadAdapter() {
|
||||
int paperVersion = ConfigHandler.SERVER_VERSION;
|
||||
|
|
@ -48,6 +49,7 @@ public class PaperAdapter implements PaperInterface {
|
|||
PaperAdapter.ADAPTER = new Paper_v1_17();
|
||||
break;
|
||||
case PAPER_V1_20:
|
||||
case PAPER_V1_21:
|
||||
default:
|
||||
PaperAdapter.ADAPTER = new Paper_v1_20();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public class SpigotAdapter implements SpigotInterface {
|
|||
public static final int SPIGOT_V1_18 = BukkitAdapter.BUKKIT_V1_18;
|
||||
public static final int SPIGOT_V1_19 = BukkitAdapter.BUKKIT_V1_19;
|
||||
public static final int SPIGOT_V1_20 = BukkitAdapter.BUKKIT_V1_20;
|
||||
public static final int SPIGOT_V1_21 = BukkitAdapter.BUKKIT_V1_21;
|
||||
|
||||
public static void loadAdapter() {
|
||||
int spigotVersion = ConfigHandler.SERVER_VERSION;
|
||||
|
|
@ -42,6 +43,7 @@ public class SpigotAdapter implements SpigotInterface {
|
|||
case SPIGOT_V1_18:
|
||||
case SPIGOT_V1_19:
|
||||
case SPIGOT_V1_20:
|
||||
case SPIGOT_V1_21:
|
||||
default:
|
||||
SpigotAdapter.ADAPTER = new Spigot_v1_16();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -942,6 +942,8 @@ public class Util extends Queue {
|
|||
return Material.EGG;
|
||||
case "SNOWBALL":
|
||||
return Material.SNOWBALL;
|
||||
case "WIND_CHARGE":
|
||||
return Material.valueOf("WIND_CHARGE");
|
||||
default:
|
||||
return BukkitAdapter.ADAPTER.getFrameType(type);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue