Fixed item frame & armor stand logging under Folia

This commit is contained in:
Intelli 2023-03-24 18:10:11 -06:00
parent 7170e29452
commit ace870b930
13 changed files with 95 additions and 75 deletions

View file

@ -90,6 +90,7 @@ import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.paper.PaperAdapter;
import net.coreprotect.thread.CacheHandler;
import net.coreprotect.thread.Scheduler;
import net.coreprotect.utility.Chat;
@ -650,7 +651,7 @@ public class Rollback extends Queue {
if (!exists) {
Entity entity = block.getLocation().getWorld().spawnEntity(location1, EntityType.ARMOR_STAND);
entity.teleport(location1);
PaperAdapter.ADAPTER.teleportAsync(entity, location1);
}
}
else if ((rowType == Material.END_CRYSTAL)) {
@ -671,7 +672,7 @@ public class Rollback extends Queue {
Entity entity = block.getLocation().getWorld().spawnEntity(location1, EntityType.ENDER_CRYSTAL);
EnderCrystal enderCrystal = (EnderCrystal) entity;
enderCrystal.setShowingBottom((rowData != 0));
entity.teleport(location1);
PaperAdapter.ADAPTER.teleportAsync(entity, location1);
}
}
else if ((rowType == Material.AIR) && ((oldTypeMaterial == Material.WATER))) {
@ -728,7 +729,7 @@ public class Rollback extends Queue {
}
entityLocation.setY(entityLocation.getY() - 1.99);
entity.teleport(entityLocation);
PaperAdapter.ADAPTER.teleportAsync(entity, entityLocation);
entity.remove();
}
}

View file

@ -9,8 +9,7 @@ import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ItemFrame;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.block.BlockFace;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@ -34,19 +33,12 @@ public class ContainerLogger extends Queue {
ItemStack[] contents = null;
String faceData = null;
if (type == Material.ARMOR_STAND) {
EntityEquipment equipment = (EntityEquipment) container;
if (equipment != null) {
contents = Util.getArmorStandContents(equipment);
}
if (type == Material.ITEM_FRAME) {
contents = (ItemStack[]) ((Object[]) container)[1];
faceData = ((BlockFace) ((Object[]) container)[2]).name();
}
else if (type == Material.ITEM_FRAME) {
ItemFrame itemFrame = (ItemFrame) container;
contents = Util.getItemFrameItem(itemFrame);
faceData = itemFrame.getFacing().name();
}
else if (type == Material.JUKEBOX) {
contents = new ItemStack[] { ((ItemStack[]) container)[1] };
else if (type == Material.JUKEBOX || type == Material.ARMOR_STAND) {
contents = (ItemStack[]) ((Object[]) container)[1];
}
else {
Inventory inventory = (Inventory) container;