Remove UpdateEntity_12.java
Remove UpdateEntity_15.java Simplify TraceEntity_12 Simplify TraceEntity_15
Dieser Commit ist enthalten in:
Ursprung
f8d69deaa3
Commit
c54980399a
@ -26,12 +26,8 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class TNTTracer_12 {
|
||||
|
||||
public static AbstractTraceEntity createTNT(World world, Vector tntPosition, Player player, boolean exploded) {
|
||||
return new TraceEntity_12(world, tntPosition, player, exploded);
|
||||
}
|
||||
|
||||
public static AbstractTraceEntity createUpdatePoint(World world, Vector tntPosition, Player player) {
|
||||
return new UpdateEntity_12(world, tntPosition, player);
|
||||
public static AbstractTraceEntity create(World world, Vector tntPosition, Player player, boolean exploded, boolean tnt) {
|
||||
return new TraceEntity_12(world, tntPosition, player, exploded, tnt);
|
||||
}
|
||||
|
||||
public static boolean inWater(World world, TNTPosition tntPosition) {
|
||||
|
@ -30,8 +30,8 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||
|
||||
private Vector position;
|
||||
|
||||
public TraceEntity_12(World world, Vector position, Player player, boolean exploded) {
|
||||
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.TNT.getBlockData());
|
||||
public TraceEntity_12(World world, Vector position, Player player, boolean exploded, boolean tnt) {
|
||||
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), tnt ? Blocks.TNT.getBlockData() : Blocks.STAINED_GLASS.getBlockData());
|
||||
this.position = position;
|
||||
|
||||
this.setNoGravity(true);
|
||||
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* /
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.tracer;
|
||||
|
||||
import net.minecraft.server.v1_12_R1.*;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
class UpdateEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||
|
||||
private Vector position;
|
||||
|
||||
public UpdateEntity_12(World world, Vector position, Player player) {
|
||||
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.STAINED_GLASS.getBlockData());
|
||||
this.position = position;
|
||||
|
||||
this.setNoGravity(true);
|
||||
this.ticksLived = -12000;
|
||||
this.dropItem = false;
|
||||
this.setCustomNameVisible(true);
|
||||
|
||||
display(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(EnumMoveType enummovetype, double dx, double dy, double dz) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTraceEntity display(Player player) {
|
||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
|
||||
ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getX());
|
||||
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getY());
|
||||
ReflectionUtils.setValue("e", packetPlayOutSpawnEntity, position.getZ());
|
||||
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
|
||||
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
|
||||
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
||||
|
||||
PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityTeleport);
|
||||
|
||||
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTraceEntity hide(Player player) {
|
||||
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(new int[]{getId()});
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
killEntity();
|
||||
}
|
||||
|
||||
}
|
@ -26,12 +26,8 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class TNTTracer_15 {
|
||||
|
||||
public static AbstractTraceEntity createTNT(World world, Vector tntPosition, Player player, boolean exploded) {
|
||||
return new TraceEntity_15(world, tntPosition, player, exploded);
|
||||
}
|
||||
|
||||
public static AbstractTraceEntity createUpdatePoint(World world, Vector tntPosition, Player player) {
|
||||
return new UpdateEntity_15(world, tntPosition, player);
|
||||
public static AbstractTraceEntity create(World world, Vector tntPosition, Player player, boolean exploded, boolean tnt) {
|
||||
return new TraceEntity_15(world, tntPosition, player, exploded, tnt);
|
||||
}
|
||||
|
||||
public static boolean inWater(World world, TNTPosition tntPosition) {
|
||||
|
@ -31,8 +31,8 @@ class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||
private Vector position;
|
||||
|
||||
public TraceEntity_15(World world, Vector position, Player player, boolean exploded) {
|
||||
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.TNT.getBlockData());
|
||||
public TraceEntity_15(World world, Vector position, Player player, boolean exploded, boolean tnt) {
|
||||
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), tnt ? Blocks.TNT.getBlockData() : Blocks.WHITE_STAINED_GLASS.getBlockData());
|
||||
this.position = position;
|
||||
|
||||
this.setNoGravity(true);
|
||||
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* /
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.tracer;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.*;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
class UpdateEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||
|
||||
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||
private Vector position;
|
||||
|
||||
public UpdateEntity_15(World world, Vector position, Player player) {
|
||||
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.TNT.getBlockData());
|
||||
this.position = position;
|
||||
|
||||
this.setNoGravity(true);
|
||||
this.ticksLived = -12000;
|
||||
this.dropItem = false;
|
||||
this.setCustomNameVisible(true);
|
||||
|
||||
display(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTraceEntity display(Player player) {
|
||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(Blocks.WHITE_STAINED_GLASS.getBlockData()), ZERO);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
||||
|
||||
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTraceEntity hide(Player player) {
|
||||
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(new int[]{getId()});
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
killEntity();
|
||||
}
|
||||
|
||||
}
|
@ -30,7 +30,7 @@ public class ReflectionUtils {
|
||||
f.setAccessible(true);
|
||||
f.set(object, value);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,16 +61,16 @@ public class Advanced extends Basic {
|
||||
if (updateEntityMap.containsKey(updatePointPosition)) {
|
||||
return;
|
||||
}
|
||||
updateEntityMap.put(updatePointPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.createUpdatePoint(player.getWorld(), updatePointY, player), 8),
|
||||
new VersionedCallable<>(() -> TNTTracer_15.createUpdatePoint(player.getWorld(), updatePointY, player), 14)));
|
||||
updateEntityMap.put(updatePointPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.create(player.getWorld(), updatePointY, player, false, false), 8),
|
||||
new VersionedCallable<>(() -> TNTTracer_15.create(player.getWorld(), updatePointY, player, false, false), 14)));
|
||||
}
|
||||
if (!position.getLocation().equals(updatePointXZ)) {
|
||||
RoundedTNTPosition updatePointPosition = new RoundedTNTPosition(updatePointXZ);
|
||||
if (updateEntityMap.containsKey(updatePointPosition)) {
|
||||
return;
|
||||
}
|
||||
updateEntityMap.put(updatePointPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.createUpdatePoint(player.getWorld(), updatePointXZ, player), 8),
|
||||
new VersionedCallable<>(() -> TNTTracer_15.createUpdatePoint(player.getWorld(), updatePointXZ, player), 14)));
|
||||
updateEntityMap.put(updatePointPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.create(player.getWorld(), updatePointXZ, player, false, false), 8),
|
||||
new VersionedCallable<>(() -> TNTTracer_15.create(player.getWorld(), updatePointXZ, player, false, false), 14)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package de.steamwar.bausystem.tracer.show.mode;
|
||||
|
||||
import de.steamwar.bausystem.tracer.*;
|
||||
import de.steamwar.bausystem.tracer.show.ShowMode;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.VersionedCallable;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -25,8 +24,8 @@ public class Basic implements ShowMode {
|
||||
if (tntEntityMap.containsKey(roundedTNTPosition)) {
|
||||
return;
|
||||
}
|
||||
tntEntityMap.put(roundedTNTPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.createTNT(player.getWorld(), position.getLocation(), player, position.isExploded()), 8),
|
||||
new VersionedCallable<>(() -> TNTTracer_15.createTNT(player.getWorld(), position.getLocation(), player, position.isExploded()), 14)));
|
||||
tntEntityMap.put(roundedTNTPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.create(player.getWorld(), position.getLocation(), player, position.isExploded(), true), 8),
|
||||
new VersionedCallable<>(() -> TNTTracer_15.create(player.getWorld(), position.getLocation(), player, position.isExploded(), true), 14)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren