Simplify version dependant
Dieser Commit ist enthalten in:
Ursprung
19ee52aee5
Commit
2ecd71baeb
24
BauSystem_12/src/de/steamwar/bausystem/tracer/TNTEntity_12.java
Normale Datei
24
BauSystem_12/src/de/steamwar/bausystem/tracer/TNTEntity_12.java
Normale Datei
@ -0,0 +1,24 @@
|
|||||||
|
package de.steamwar.bausystem.tracer;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_12_R1.*;
|
||||||
|
|
||||||
|
public class TNTEntity_12 extends EntityFallingBlock {
|
||||||
|
|
||||||
|
private TNTPosition position;
|
||||||
|
|
||||||
|
public TNTEntity_12(World world, TNTPosition position) {
|
||||||
|
super(world, position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
|
this.setNoGravity(true);
|
||||||
|
this.ticksLived = -12000;
|
||||||
|
this.dropItem = false;
|
||||||
|
this.setCustomNameVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void move(EnumMoveType enummovetype, double dx, double dy, double dz) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,53 +0,0 @@
|
|||||||
package de.steamwar.bausystem.tracer;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy;
|
|
||||||
import net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity;
|
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class TraceTNT_12 {
|
|
||||||
|
|
||||||
// public PacketPlayOutSpawnEntity(Entity var1, int var2, int var3) {
|
|
||||||
// this.a = var1.getId();
|
|
||||||
// this.b = var1.getUniqueID();
|
|
||||||
// this.c = var1.locX;
|
|
||||||
// this.d = var1.locY;
|
|
||||||
// this.e = var1.locZ;
|
|
||||||
// this.i = MathHelper.d(var1.pitch * 256.0F / 360.0F);
|
|
||||||
// this.j = MathHelper.d(var1.yaw * 256.0F / 360.0F);
|
|
||||||
// this.k = var2;
|
|
||||||
// this.l = var3;
|
|
||||||
// double var4 = 3.9D;
|
|
||||||
// this.f = (int)(MathHelper.a(var1.motX, -3.9D, 3.9D) * 8000.0D);
|
|
||||||
// this.g = (int)(MathHelper.a(var1.motY, -3.9D, 3.9D) * 8000.0D);
|
|
||||||
// this.h = (int)(MathHelper.a(var1.motZ, -3.9D, 3.9D) * 8000.0D);
|
|
||||||
// }
|
|
||||||
|
|
||||||
static void showTNT(int entityID, Player player, float... position) {
|
|
||||||
PacketPlayOutSpawnEntity spawnEntity = new PacketPlayOutSpawnEntity();
|
|
||||||
ReflectionsUtils.setField("a", spawnEntity, entityID);
|
|
||||||
ReflectionsUtils.setField("b", spawnEntity, UUID.randomUUID());
|
|
||||||
ReflectionsUtils.setField("c", spawnEntity, position[0]);
|
|
||||||
ReflectionsUtils.setField("d", spawnEntity, position[1]);
|
|
||||||
ReflectionsUtils.setField("e", spawnEntity, position[2]);
|
|
||||||
ReflectionsUtils.setField("i", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("j", spawnEntity, 0);
|
|
||||||
// EntityType
|
|
||||||
ReflectionsUtils.setField("k", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("l", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("f", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("g", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("h", spawnEntity, 0);
|
|
||||||
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(spawnEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void hideTNT(int entityID, Player player, float... position) {
|
|
||||||
PacketPlayOutEntityDestroy deleteEntity = new PacketPlayOutEntityDestroy(entityID);
|
|
||||||
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(deleteEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
24
BauSystem_15/src/de/steamwar/bausystem/tracer/TNTEntity_15.java
Normale Datei
24
BauSystem_15/src/de/steamwar/bausystem/tracer/TNTEntity_15.java
Normale Datei
@ -0,0 +1,24 @@
|
|||||||
|
package de.steamwar.bausystem.tracer;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_15_R1.*;
|
||||||
|
|
||||||
|
public class TNTEntity_15 extends EntityFallingBlock {
|
||||||
|
|
||||||
|
private TNTPosition position;
|
||||||
|
|
||||||
|
public TNTEntity_15(World world, TNTPosition position) {
|
||||||
|
super(world, position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
|
this.setNoGravity(true);
|
||||||
|
this.ticksLived = -12000;
|
||||||
|
this.dropItem = false;
|
||||||
|
this.setCustomNameVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,37 +0,0 @@
|
|||||||
package de.steamwar.bausystem.tracer;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
|
||||||
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityDestroy;
|
|
||||||
import net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntity;
|
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class TraceTNT_15 {
|
|
||||||
|
|
||||||
static void showTNT(int entityID, Player player, float... position) {
|
|
||||||
PacketPlayOutSpawnEntity spawnEntity = new PacketPlayOutSpawnEntity();
|
|
||||||
ReflectionsUtils.setField("a", spawnEntity, entityID);
|
|
||||||
ReflectionsUtils.setField("b", spawnEntity, UUID.randomUUID());
|
|
||||||
ReflectionsUtils.setField("c", spawnEntity, position[0]);
|
|
||||||
ReflectionsUtils.setField("d", spawnEntity, position[1]);
|
|
||||||
ReflectionsUtils.setField("e", spawnEntity, position[2]);
|
|
||||||
ReflectionsUtils.setField("i", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("j", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("k", spawnEntity, EntityTypes.FALLING_BLOCK);
|
|
||||||
ReflectionsUtils.setField("l", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("f", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("g", spawnEntity, 0);
|
|
||||||
ReflectionsUtils.setField("h", spawnEntity, 0);
|
|
||||||
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(spawnEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void hideTNT(int entityID, Player player, float... position) {
|
|
||||||
PacketPlayOutEntityDestroy deleteEntity = new PacketPlayOutEntityDestroy(entityID);
|
|
||||||
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(deleteEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package de.steamwar.bausystem.tracer;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ReflectionsUtils {
|
|
||||||
|
|
||||||
private static Map<String, Field> fieldMap = new LinkedHashMap<String, Field>() {
|
|
||||||
@Override
|
|
||||||
protected boolean removeEldestEntry(Map.Entry<String, Field> eldest) {
|
|
||||||
return size() > 100;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@SuppressWarnings({"java:S3011"})
|
|
||||||
static void setField(String fieldName, Object object, Object fieldValue) {
|
|
||||||
String cacheName = object.getClass().getTypeName() + ":" + fieldName;
|
|
||||||
Field field;
|
|
||||||
if (fieldMap.containsKey(cacheName)) {
|
|
||||||
field = fieldMap.get(cacheName);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
field = object.getClass().getDeclaredField(fieldName);
|
|
||||||
} catch (NoSuchFieldException e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fieldMap.put(cacheName, field);
|
|
||||||
}
|
|
||||||
|
|
||||||
field.setAccessible(true);
|
|
||||||
try {
|
|
||||||
field.set(object, fieldValue);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
32
BauSystem_API/src/de/steamwar/bausystem/tracer/TNTPosition.java
Normale Datei
32
BauSystem_API/src/de/steamwar/bausystem/tracer/TNTPosition.java
Normale Datei
@ -0,0 +1,32 @@
|
|||||||
|
package de.steamwar.bausystem.tracer;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class TNTPosition {
|
||||||
|
|
||||||
|
private Vector location;
|
||||||
|
private Vector vector;
|
||||||
|
|
||||||
|
public TNTPosition(Entity entity) {
|
||||||
|
location = entity.getLocation().toVector();
|
||||||
|
vector = entity.getVelocity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector getVector() {
|
||||||
|
return vector;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Position{" +
|
||||||
|
"location=" + location +
|
||||||
|
", vector=" + vector +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -22,7 +22,6 @@ package de.steamwar.bausystem.commands;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.tracer.record.RecordManager;
|
import de.steamwar.bausystem.tracer.record.RecordManager;
|
||||||
import de.steamwar.bausystem.tracer.TraceManager;
|
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -78,10 +77,10 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
RecordManager.commandAuto();
|
RecordManager.commandAuto();
|
||||||
break;
|
break;
|
||||||
case "show":
|
case "show":
|
||||||
TraceManager.commandShow(player);
|
// TraceManager.commandShow(player);
|
||||||
break;
|
break;
|
||||||
case "hide":
|
case "hide":
|
||||||
TraceManager.commandHide(player);
|
// TraceManager.commandHide(player);
|
||||||
break;
|
break;
|
||||||
case "toggleshow":
|
case "toggleshow":
|
||||||
case "interpolate":
|
case "interpolate":
|
||||||
|
@ -1,39 +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 de.steamwar.bausystem.tracer.record.RecordManager;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
||||||
|
|
||||||
public class ExplodeListener implements Listener {
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
|
||||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
|
||||||
|
|
||||||
RecordManager.tntExplode();
|
|
||||||
TraceManager.tntExplode((TNTPrimed) event.getEntity());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +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 org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
public class Position {
|
|
||||||
|
|
||||||
private Vector location;
|
|
||||||
private Vector vector;
|
|
||||||
|
|
||||||
public Position(Entity entity) {
|
|
||||||
location = entity.getLocation().toVector();
|
|
||||||
vector = entity.getVelocity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector getLocation() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector getVector() {
|
|
||||||
return vector;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Position{" +
|
|
||||||
"location=" + location +
|
|
||||||
", vector=" + vector +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +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 org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class TraceManager {
|
|
||||||
|
|
||||||
private static Map<TNTPrimed, TraceTNT> traceTNTMap = new HashMap<>();
|
|
||||||
private static Set<TraceTNT> traceTNTSet = new HashSet<>();
|
|
||||||
|
|
||||||
public static void recordStop() {
|
|
||||||
traceTNTMap.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void tntExplode(TNTPrimed tntPrimed) {
|
|
||||||
if (!traceTNTMap.containsKey(tntPrimed)) return;
|
|
||||||
traceTNTMap.remove(tntPrimed).explosion(tntPrimed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void tntAdd(TNTPrimed tntPrimed) {
|
|
||||||
TraceTNT traceTNT = new TraceTNT(tntPrimed);
|
|
||||||
traceTNTMap.put(tntPrimed, traceTNT);
|
|
||||||
traceTNTSet.add(traceTNT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void commandDelete() {
|
|
||||||
traceTNTMap.clear();
|
|
||||||
traceTNTSet.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getRecordSize() {
|
|
||||||
return traceTNTMap.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void commandShow(Player player) {
|
|
||||||
traceTNTSet.forEach(traceTNT -> traceTNT.showTrace(player));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void commandHide(Player player) {
|
|
||||||
traceTNTSet.forEach(traceTNT -> traceTNT.hideTrace(player));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,116 +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 de.steamwar.core.Core;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class TraceTNT {
|
|
||||||
|
|
||||||
private static int traceID = 0;
|
|
||||||
|
|
||||||
private int id = traceID++;
|
|
||||||
private float[] source = new float[3];
|
|
||||||
private float[] explosion = new float[3];
|
|
||||||
private int index = 0;
|
|
||||||
private float[] position = new float[240];
|
|
||||||
private float[] velocity = new float[240];
|
|
||||||
|
|
||||||
public TraceTNT(TNTPrimed tntPrimed) {
|
|
||||||
source[0] = (float) tntPrimed.getLocation().getX();
|
|
||||||
source[1] = (float) tntPrimed.getLocation().getY();
|
|
||||||
source[2] = (float) tntPrimed.getLocation().getZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void explosion(TNTPrimed tntPrimed) {
|
|
||||||
explosion[0] = (float) tntPrimed.getLocation().getX();
|
|
||||||
explosion[1] = (float) tntPrimed.getLocation().getY();
|
|
||||||
explosion[2] = (float) tntPrimed.getLocation().getZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(TNTPrimed tntPrimed) {
|
|
||||||
if (index > position.length) return;
|
|
||||||
position[index + 0] = (float) tntPrimed.getLocation().getX();
|
|
||||||
position[index + 1] = (float) tntPrimed.getLocation().getY();
|
|
||||||
position[index + 2] = (float) tntPrimed.getLocation().getZ();
|
|
||||||
velocity[index + 0] = (float) tntPrimed.getVelocity().getX();
|
|
||||||
velocity[index + 1] = (float) tntPrimed.getVelocity().getY();
|
|
||||||
velocity[index + 2] = (float) tntPrimed.getVelocity().getZ();
|
|
||||||
index += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long size() {
|
|
||||||
long size = 0;
|
|
||||||
|
|
||||||
// id:
|
|
||||||
size += 32;
|
|
||||||
|
|
||||||
// index:
|
|
||||||
size += 32;
|
|
||||||
|
|
||||||
// source:
|
|
||||||
size += source.length * 32;
|
|
||||||
|
|
||||||
// explosion:
|
|
||||||
size += explosion.length * 32;
|
|
||||||
|
|
||||||
// position:
|
|
||||||
size += position.length * 32;
|
|
||||||
|
|
||||||
// velocity:
|
|
||||||
size += velocity.length * 32;
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showTrace(Player player) {
|
|
||||||
int entityID = Integer.MAX_VALUE - id * 200;
|
|
||||||
|
|
||||||
tnt(entityID, player, source, TraceTNT_15::showTNT, TraceTNT_12::showTNT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hideTrace(Player player) {
|
|
||||||
int entityID = Integer.MAX_VALUE - id * 200;
|
|
||||||
|
|
||||||
tnt(entityID, player, source, TraceTNT_15::hideTNT, TraceTNT_12::hideTNT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tnt(int entityID, Player player, float[] position, VersionConsumer<Integer, Player, float[]> version15, VersionConsumer<Integer, Player, float[]> versionDefault) {
|
|
||||||
if (position.length != 3) return;
|
|
||||||
switch (Core.getVersion()) {
|
|
||||||
case 15:
|
|
||||||
version15.accept(entityID, player, position);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
versionDefault.accept(entityID, player, position);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private interface VersionConsumer<K, V, S> {
|
|
||||||
|
|
||||||
void accept(K k, V v, S s);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -51,7 +51,6 @@ public class ExplodeListener implements Listener {
|
|||||||
static void explode(TNTPrimed tntPrimed) {
|
static void explode(TNTPrimed tntPrimed) {
|
||||||
get(tntPrimed).explode(tntPrimed);
|
get(tntPrimed).explode(tntPrimed);
|
||||||
RecordTrace recordTrace = recordTraceMap.remove(tntPrimed);
|
RecordTrace recordTrace = recordTraceMap.remove(tntPrimed);
|
||||||
// System.out.println(recordTrace);
|
|
||||||
DataHolder.finished.add(recordTrace);
|
DataHolder.finished.add(recordTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ package de.steamwar.bausystem.tracer.record;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.commands.CommandTPSLimiter;
|
import de.steamwar.bausystem.commands.CommandTPSLimiter;
|
||||||
import de.steamwar.bausystem.tracer.RecordStatus;
|
import de.steamwar.bausystem.tracer.RecordStatus;
|
||||||
import de.steamwar.bausystem.tracer.TraceManager;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
@ -86,7 +85,8 @@ public class RecordManager {
|
|||||||
recorder.cancel();
|
recorder.cancel();
|
||||||
recorder = null;
|
recorder = null;
|
||||||
startTime = 0;
|
startTime = 0;
|
||||||
TraceManager.recordStop();
|
// TODO: fix
|
||||||
|
// TraceManager.recordStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void recordAutoStop() {
|
private static void recordAutoStop() {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.tracer.record;
|
package de.steamwar.bausystem.tracer.record;
|
||||||
|
|
||||||
import de.steamwar.bausystem.tracer.Position;
|
import de.steamwar.bausystem.tracer.TNTPosition;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -27,30 +27,30 @@ import java.util.List;
|
|||||||
|
|
||||||
public class RecordTrace {
|
public class RecordTrace {
|
||||||
|
|
||||||
private Position startPosition;
|
private TNTPosition startTNTPosition;
|
||||||
private Position explosionPosition;
|
private TNTPosition explosionTNTPosition;
|
||||||
private List<Position> positionList = new ArrayList<>(160);
|
private List<TNTPosition> TNTPositionList = new ArrayList<>(160);
|
||||||
|
|
||||||
public RecordTrace(TNTPrimed tntPrimed) {
|
public RecordTrace(TNTPrimed tntPrimed) {
|
||||||
startPosition = new Position(tntPrimed);
|
startTNTPosition = new TNTPosition(tntPrimed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordTrace add(TNTPrimed tntPrimed) {
|
public RecordTrace add(TNTPrimed tntPrimed) {
|
||||||
positionList.add(new Position(tntPrimed));
|
TNTPositionList.add(new TNTPosition(tntPrimed));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordTrace explode(TNTPrimed tntPrimed) {
|
public RecordTrace explode(TNTPrimed tntPrimed) {
|
||||||
explosionPosition = new Position(tntPrimed);
|
explosionTNTPosition = new TNTPosition(tntPrimed);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "RecordTrace{" +
|
return "RecordTrace{" +
|
||||||
"startPosition=" + startPosition +
|
"startPosition=" + startTNTPosition +
|
||||||
", explosionPosition=" + explosionPosition +
|
", explosionPosition=" + explosionTNTPosition +
|
||||||
", positionList=" + positionList +
|
", positionList=" + TNTPositionList +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package de.steamwar.bausystem.tracer.show;
|
package de.steamwar.bausystem.tracer.show;
|
||||||
|
|
||||||
import de.steamwar.bausystem.tracer.Position;
|
import de.steamwar.bausystem.tracer.TNTPosition;
|
||||||
import net.minecraft.server.v1_15_R1.*;
|
import net.minecraft.server.v1_15_R1.*;
|
||||||
|
|
||||||
public class TNTEntity extends EntityFallingBlock {
|
public class TNTEntity extends EntityFallingBlock {
|
||||||
|
|
||||||
private Position position;
|
private TNTPosition TNTPosition;
|
||||||
|
|
||||||
public TNTEntity(World world, Position position) {
|
public TNTEntity(World world, TNTPosition TNTPosition) {
|
||||||
super(world, position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
super(world, TNTPosition.getLocation().getX(), TNTPosition.getLocation().getY(), TNTPosition.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||||
this.position = position;
|
this.TNTPosition = TNTPosition;
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
this.ticksLived = -12000;
|
this.ticksLived = -12000;
|
||||||
|
@ -22,11 +22,8 @@ package de.steamwar.bausystem.world;
|
|||||||
import de.steamwar.bausystem.commands.CommandFreeze;
|
import de.steamwar.bausystem.commands.CommandFreeze;
|
||||||
import de.steamwar.bausystem.commands.CommandTNT;
|
import de.steamwar.bausystem.commands.CommandTNT;
|
||||||
import de.steamwar.bausystem.commands.CommandTPSLimiter;
|
import de.steamwar.bausystem.commands.CommandTPSLimiter;
|
||||||
import de.steamwar.bausystem.tracer.record.DataHolder;
|
|
||||||
import de.steamwar.bausystem.tracer.record.ExplodeListener;
|
import de.steamwar.bausystem.tracer.record.ExplodeListener;
|
||||||
import de.steamwar.bausystem.tracer.record.RecordManager;
|
import de.steamwar.bausystem.tracer.record.RecordManager;
|
||||||
import de.steamwar.bausystem.tracer.TraceManager;
|
|
||||||
import de.steamwar.bausystem.tracer.record.RecordTrace;
|
|
||||||
import de.steamwar.core.TPSWatcher;
|
import de.steamwar.core.TPSWatcher;
|
||||||
import de.steamwar.scoreboard.SWScoreboard;
|
import de.steamwar.scoreboard.SWScoreboard;
|
||||||
import de.steamwar.scoreboard.ScoreboardCallback;
|
import de.steamwar.scoreboard.ScoreboardCallback;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren