Tracer-entity #147
@ -8,8 +8,11 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
|
public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||||
|
|
||||||
|
private TNTPosition position;
|
||||||
|
|
||||||
public TNTEntity_12(World world, TNTPosition position, Player player) {
|
public TNTEntity_12(World world, TNTPosition position, Player player) {
|
||||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
this.ticksLived = -12000;
|
this.ticksLived = -12000;
|
||||||
@ -27,6 +30,9 @@ public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntit
|
|||||||
@Override
|
@Override
|
||||||
public AbstractTNTEntity display(Player player) {
|
public AbstractTNTEntity display(Player player) {
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
|
||||||
|
ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getLocation().getX());
|
||||||
|
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getLocation().getY());
|
||||||
|
ReflectionUtils.setValue("e", packetPlayOutSpawnEntity, position.getLocation().getZ());
|
||||||
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
|
||||||
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
|
||||||
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
||||||
|
@ -8,8 +8,12 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
|
public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||||
|
|
||||||
|
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||||
|
private TNTPosition position;
|
||||||
|
|
||||||
public TNTEntity_15(World world, TNTPosition position, Player player) {
|
public TNTEntity_15(World world, TNTPosition position, Player player) {
|
||||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
this.ticksLived = -12000;
|
this.ticksLived = -12000;
|
||||||
@ -26,17 +30,9 @@ public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntit
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractTNTEntity display(Player player) {
|
public AbstractTNTEntity display(Player player) {
|
||||||
// System.out.println("SHOW: " + player + " " + locX() + " " + locY() + " " + locZ());
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(Blocks.TNT.getBlockData()), ZERO);
|
||||||
|
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this);
|
|
||||||
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
|
|
||||||
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
|
|
||||||
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
||||||
|
|
||||||
PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityTeleport);
|
|
||||||
|
|
||||||
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
|
||||||
|
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package de.steamwar.bausystem.tracer;
|
package de.steamwar.bausystem.tracer;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class ReflectionUtils {
|
public class ReflectionUtils {
|
||||||
|
|
||||||
|
@SuppressWarnings({"java:S3011"})
|
||||||
static void setValue(String field, Object object, Object value) {
|
static void setValue(String field, Object object, Object value) {
|
||||||
try {
|
try {
|
||||||
object.getClass().getDeclaredField(field).set(object, value);
|
Field f = object.getClass().getDeclaredField(field);
|
||||||
|
f.setAccessible(true);
|
||||||
|
f.set(object, value);
|
||||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!permissionCheck(player)) return false;
|
// if (!permissionCheck(player)) return false;
|
||||||
|
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "start":
|
case "start":
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren