From 139bf287644c76addab5ac96e8d3120571e1435f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 27 Mar 2021 08:23:46 +0100 Subject: [PATCH] Add TPSLimit to any Entity except Player --- .../src/de/steamwar/bausystem/commands/TPSLimit_12.java | 4 ++-- .../src/de/steamwar/bausystem/commands/TPSLimit_15.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 b7e5272..cfe3928 100644 --- a/BauSystem_12/src/de/steamwar/bausystem/commands/TPSLimit_12.java +++ b/BauSystem_12/src/de/steamwar/bausystem/commands/TPSLimit_12.java @@ -24,7 +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.Player; import org.bukkit.entity.TNTPrimed; import java.util.ArrayList; @@ -36,7 +36,7 @@ class TPSLimit_12 { static void createTickCache(World world) { packets.clear(); - world.getEntitiesByClasses(TNTPrimed.class, FallingBlock.class).forEach(entity -> { + world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> { packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), 0, 0, 0)); packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle())); 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 04cd25c..344bcf9 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/commands/TPSLimit_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/commands/TPSLimit_15.java @@ -24,7 +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.Player; import org.bukkit.entity.TNTPrimed; import java.util.ArrayList; @@ -37,7 +37,7 @@ class TPSLimit_15 { static void createTickCache(World world) { packets.clear(); - world.getEntitiesByClasses(TNTPrimed.class, FallingBlock.class).forEach(entity -> { + world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> { packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion)); packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle())); -- 2.39.5