diff --git a/FightSystem_8/src/de/steamwar/fightsystem/utils/BlockIdWrapper8.java b/FightSystem_8/src/de/steamwar/fightsystem/utils/BlockIdWrapper8.java index bb8bae2..06956c8 100644 --- a/FightSystem_8/src/de/steamwar/fightsystem/utils/BlockIdWrapper8.java +++ b/FightSystem_8/src/de/steamwar/fightsystem/utils/BlockIdWrapper8.java @@ -32,6 +32,9 @@ public class BlockIdWrapper8 implements BlockIdWrapper { @Override @SuppressWarnings("deprecation") public void setBlock(World world, int x, int y, int z, int blockState) { + if((blockState >> 4) > 256) // Illegal blockstate / corrupted replay + blockState = 0; + world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false); } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java index 734883e..6883199 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java @@ -45,6 +45,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.scheduler.BukkitTask; import java.io.EOFException; +import java.io.FilterInputStream; import java.io.IOException; import java.util.*; import java.util.logging.Level; @@ -217,7 +218,11 @@ public class PacketProcessor { float yaw = source.readFloat() + (rotateZ ? 180 : 0); byte headYaw = (byte)((source.readByte() + (rotateZ ? 128 : 0)) % 256); - execSync(() -> REntity.getEntity(entityId).move(locX, locY, locZ, pitch, yaw, headYaw)); + execSync(() -> { + REntity entity = REntity.getEntity(entityId); + if(entity != null) + entity.move(locX, locY, locZ, pitch, yaw, headYaw); + }); } private void entityDespawns() throws IOException { @@ -410,7 +415,12 @@ public class PacketProcessor { private void pasteEmbeddedSchem(FightTeam team) throws IOException { int schemId = source.readInt(); - Clipboard clipboard = SchematicNode.clipboardFromStream(source, Core.getVersion() > 12); + Clipboard clipboard = SchematicNode.clipboardFromStream(new FilterInputStream(source) { + @Override + public void close() { + // FAWE 1.12 calls close... + } + }, Core.getVersion() > 12); execSync(() -> team.pasteSchem(schemId, clipboard)); }