mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-12-30 18:08:24 +01:00
Added MC 1.21 support
This commit is contained in:
parent
371e496351
commit
37fc9af300
@ -271,7 +271,7 @@ public class BukkitAdapter implements BukkitInterface {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack) {
|
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack) {
|
||||||
PotionData data = arrow.getBasePotionData();
|
PotionData data = arrow.getBasePotionData();
|
||||||
if (data.getType() != PotionType.UNCRAFTABLE) {
|
if (data.getType() != PotionType.valueOf("UNCRAFTABLE")) {
|
||||||
itemStack = new ItemStack(Material.TIPPED_ARROW);
|
itemStack = new ItemStack(Material.TIPPED_ARROW);
|
||||||
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
|
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
|
||||||
meta.setBasePotionData(data);
|
meta.setBasePotionData(data);
|
||||||
|
@ -649,7 +649,14 @@ public class Rollback extends RollbackUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
Entity entity = block.getLocation().getWorld().spawnEntity(location1, EntityType.ENDER_CRYSTAL);
|
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);
|
||||||
EnderCrystal enderCrystal = (EnderCrystal) entity;
|
EnderCrystal enderCrystal = (EnderCrystal) entity;
|
||||||
enderCrystal.setShowingBottom((rowData != 0));
|
enderCrystal.setShowingBottom((rowData != 0));
|
||||||
PaperAdapter.ADAPTER.teleportAsync(entity, location1);
|
PaperAdapter.ADAPTER.teleportAsync(entity, location1);
|
||||||
|
@ -7,7 +7,6 @@ import java.util.Map;
|
|||||||
import org.bukkit.FireworkEffect;
|
import org.bukkit.FireworkEffect;
|
||||||
import org.bukkit.FireworkEffect.Builder;
|
import org.bukkit.FireworkEffect.Builder;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Tag;
|
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.attribute.AttributeModifier;
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
import org.bukkit.block.Jukebox;
|
import org.bukkit.block.Jukebox;
|
||||||
@ -93,7 +92,7 @@ public class RollbackUtil extends Lookup {
|
|||||||
else if (type != null && type.equals(Material.JUKEBOX)) {
|
else if (type != null && type.equals(Material.JUKEBOX)) {
|
||||||
Jukebox jukebox = (Jukebox) container;
|
Jukebox jukebox = (Jukebox) container;
|
||||||
if (jukebox != null) {
|
if (jukebox != null) {
|
||||||
if (action == 1 && Tag.ITEMS_MUSIC_DISCS.isTagged(itemstack.getType())) {
|
if (action == 1 && itemstack.getType().name().startsWith("MUSIC_DISC")) {
|
||||||
itemstack.setAmount(1);
|
itemstack.setAmount(1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -11,7 +11,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Tag;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
@ -684,10 +683,10 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
|||||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||||
|
|
||||||
if (event.getHand().equals(EquipmentSlot.HAND) && mainHand != null && Tag.ITEMS_MUSIC_DISCS.isTagged(mainHand.getType())) {
|
if (event.getHand().equals(EquipmentSlot.HAND) && mainHand != null && mainHand.getType().name().startsWith("MUSIC_DISC")) {
|
||||||
handItem = mainHand;
|
handItem = mainHand;
|
||||||
}
|
}
|
||||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND) && offHand != null && Tag.ITEMS_MUSIC_DISCS.isTagged(offHand.getType())) {
|
else if (event.getHand().equals(EquipmentSlot.OFF_HAND) && offHand != null && offHand.getType().name().startsWith("MUSIC_DISC")) {
|
||||||
handItem = offHand;
|
handItem = offHand;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -917,26 +917,30 @@ public class Util extends Queue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Material getEntityMaterial(EntityType type) {
|
public static Material getEntityMaterial(EntityType type) {
|
||||||
switch (type) {
|
switch (type.name()) {
|
||||||
case ARMOR_STAND:
|
case "ARMOR_STAND":
|
||||||
return Material.ARMOR_STAND;
|
return Material.ARMOR_STAND;
|
||||||
case ITEM_FRAME:
|
case "ITEM_FRAME":
|
||||||
return Material.ITEM_FRAME;
|
return Material.ITEM_FRAME;
|
||||||
case ENDER_CRYSTAL:
|
case "END_CRYSTAL":
|
||||||
|
case "ENDER_CRYSTAL":
|
||||||
return Material.END_CRYSTAL;
|
return Material.END_CRYSTAL;
|
||||||
case ENDER_PEARL:
|
case "ENDER_PEARL":
|
||||||
return Material.ENDER_PEARL;
|
return Material.ENDER_PEARL;
|
||||||
case SPLASH_POTION:
|
case "POTION":
|
||||||
|
case "SPLASH_POTION":
|
||||||
return Material.SPLASH_POTION;
|
return Material.SPLASH_POTION;
|
||||||
case THROWN_EXP_BOTTLE:
|
case "EXPERIENCE_BOTTLE":
|
||||||
|
case "THROWN_EXP_BOTTLE":
|
||||||
return Material.EXPERIENCE_BOTTLE;
|
return Material.EXPERIENCE_BOTTLE;
|
||||||
case TRIDENT:
|
case "TRIDENT":
|
||||||
return Material.TRIDENT;
|
return Material.TRIDENT;
|
||||||
case FIREWORK:
|
case "FIREWORK_ROCKET":
|
||||||
|
case "FIREWORK":
|
||||||
return Material.FIREWORK_ROCKET;
|
return Material.FIREWORK_ROCKET;
|
||||||
case EGG:
|
case "EGG":
|
||||||
return Material.EGG;
|
return Material.EGG;
|
||||||
case SNOWBALL:
|
case "SNOWBALL":
|
||||||
return Material.SNOWBALL;
|
return Material.SNOWBALL;
|
||||||
default:
|
default:
|
||||||
return BukkitAdapter.ADAPTER.getFrameType(type);
|
return BukkitAdapter.ADAPTER.getFrameType(type);
|
||||||
|
@ -211,4 +211,10 @@ public final class WorldEditBlockState implements BlockState {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState copy(Location location) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user