SteamWar/BauSystem
Archiviert
13
0

Add TPSLimit for FallingBlock (Sand, Anvil, Concrete, etc.)

Dieser Commit ist enthalten in:
jojo 2020-12-22 20:27:27 +01:00
Ursprung f2acd26835
Commit cc33517e6b
3 geänderte Dateien mit 12 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -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<Packet<?>> 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);

Datei anzeigen

@ -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<Packet<?>> 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);

Datei anzeigen

@ -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);
}
}