mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-24 12:16:36 +01:00
Use proper adapter for EntityType.END_CRYSTAL
This commit is contained in:
parent
49eb176ee6
commit
fa1de08c0d
@ -288,4 +288,14 @@ public class BukkitAdapter implements BukkitInterface {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getEntityType(Material material) {
|
||||
switch (material) {
|
||||
case END_CRYSTAL:
|
||||
return EntityType.valueOf("ENDER_CRYSTAL");
|
||||
default:
|
||||
return EntityType.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,4 +87,6 @@ public interface BukkitInterface {
|
||||
|
||||
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack);
|
||||
|
||||
public EntityType getEntityType(Material material);
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package net.coreprotect.bukkit;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
|
||||
@ -22,4 +23,14 @@ public class Bukkit_v1_21 extends Bukkit_v1_20 implements BukkitInterface {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getEntityType(Material material) {
|
||||
switch (material) {
|
||||
case END_CRYSTAL:
|
||||
return EntityType.valueOf("END_CRYSTAL");
|
||||
default:
|
||||
return EntityType.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -649,14 +649,7 @@ public class Rollback extends RollbackUtil {
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
EntityType END_CRYSTAL = null;
|
||||
try {
|
||||
END_CRYSTAL = EntityType.valueOf("END_CRYSTAL"); // 1.21+
|
||||
}
|
||||
catch (Exception e) {
|
||||
END_CRYSTAL = EntityType.valueOf("ENDER_CRYSTAL"); // <= 1.20
|
||||
}
|
||||
Entity entity = block.getLocation().getWorld().spawnEntity(location1, END_CRYSTAL);
|
||||
Entity entity = block.getLocation().getWorld().spawnEntity(location1, BukkitAdapter.ADAPTER.getEntityType(Material.END_CRYSTAL));
|
||||
EnderCrystal enderCrystal = (EnderCrystal) entity;
|
||||
enderCrystal.setShowingBottom((rowData != 0));
|
||||
PaperAdapter.ADAPTER.teleportAsync(entity, location1);
|
||||
|
Loading…
Reference in New Issue
Block a user