diff --git a/BauSystem_12/src/de/steamwar/bausystem/commands/TPSLimit_12.java b/BauSystem_12/src/de/steamwar/bausystem/commands/TPSLimit_12.java index d32d4cb..245e0a9 100644 --- a/BauSystem_12/src/de/steamwar/bausystem/commands/TPSLimit_12.java +++ b/BauSystem_12/src/de/steamwar/bausystem/commands/TPSLimit_12.java @@ -24,6 +24,7 @@ import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; +import org.bukkit.entity.FallingBlock; import org.bukkit.entity.TNTPrimed; import java.util.HashSet; @@ -35,7 +36,7 @@ class TPSLimit_12 { static void createVelocityPacketCache(World world) { velocityPackets.clear(); - world.getEntitiesByClasses(TNTPrimed.class).forEach(entity -> { + world.getEntitiesByClasses(TNTPrimed.class, FallingBlock.class).forEach(entity -> { velocityPackets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), 0, 0, 0)); }); } @@ -49,19 +50,17 @@ class TPSLimit_12 { world.getEntitiesByClasses(TNTPrimed.class).forEach(entity -> { net.minecraft.server.v1_12_R1.Entity serverEntity = ((CraftEntity) entity).getHandle(); - packets.add(new PacketPlayOutEntityMetadata(serverEntity.getId(), serverEntity.getDataWatcher(), true)); }); sendPacketsToPlayer(packets); } - static void sendTntData(World world) { + static void sendTeleports(World world) { Set> packets = new HashSet<>(); - world.getEntitiesByClasses(TNTPrimed.class).forEach(entity -> { - net.minecraft.server.v1_12_R1.Entity serverEntity = ((CraftEntity) entity).getHandle(); - packets.add(new PacketPlayOutEntityTeleport(serverEntity)); + world.getEntitiesByClasses(TNTPrimed.class, FallingBlock.class).forEach(entity -> { + packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle())); }); sendPacketsToPlayer(packets); diff --git a/BauSystem_15/src/de/steamwar/bausystem/commands/TPSLimit_15.java b/BauSystem_15/src/de/steamwar/bausystem/commands/TPSLimit_15.java index cb32794..1215955 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/commands/TPSLimit_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/commands/TPSLimit_15.java @@ -24,6 +24,7 @@ import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; +import org.bukkit.entity.FallingBlock; import org.bukkit.entity.TNTPrimed; import java.util.HashSet; @@ -36,7 +37,7 @@ class TPSLimit_15 { static void createVelocityPacketCache(World world) { velocityPackets.clear(); - world.getEntitiesByClasses(TNTPrimed.class).forEach(entity -> { + world.getEntitiesByClasses(TNTPrimed.class, FallingBlock.class).forEach(entity -> { velocityPackets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion)); }); } @@ -50,19 +51,17 @@ class TPSLimit_15 { world.getEntitiesByClasses(TNTPrimed.class).forEach(entity -> { net.minecraft.server.v1_15_R1.Entity serverEntity = ((CraftEntity) entity).getHandle(); - packets.add(new PacketPlayOutEntityMetadata(serverEntity.getId(), serverEntity.getDataWatcher(), true)); }); sendPacketsToPlayer(packets); } - static void sendTntData(World world) { + static void sendTeleports(World world) { Set> packets = new HashSet<>(); - world.getEntitiesByClasses(TNTPrimed.class).forEach(entity -> { - net.minecraft.server.v1_15_R1.Entity serverEntity = ((CraftEntity) entity).getHandle(); - packets.add(new PacketPlayOutEntityTeleport(serverEntity)); + world.getEntitiesByClasses(TNTPrimed.class, FallingBlock.class).forEach(entity -> { + packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle())); }); sendPacketsToPlayer(packets); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java index 94df329..3453e5a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java @@ -166,10 +166,10 @@ public class CommandTPSLimiter implements CommandExecutor { private void sendTntData() { switch (Core.getVersion()) { case 15: - TPSLimit_15.sendTntData(world); + TPSLimit_15.sendTeleports(world); break; default: - TPSLimit_12.sendTntData(world); + TPSLimit_12.sendTeleports(world); } }