Tracer-entity #147
@ -19,13 +19,23 @@
|
||||
|
||||
package de.steamwar.bausystem.tracer;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TNTEntityFactory_15 {
|
||||
public class TNTTracer_12 {
|
||||
|
||||
public static AbstractTNTEntity create(World world, TNTPosition tntPosition, Player player) {
|
||||
return new TNTEntity_15(world, tntPosition, player);
|
||||
public static AbstractTraceEntity createTNT(World world, TNTPosition tntPosition, Player player) {
|
||||
return new TraceEntity_12(world, tntPosition, player);
|
||||
}
|
||||
|
||||
public static AbstractTraceEntity createUpdatePoint(World world, TNTPosition tntPosition, Player player) {
|
||||
return new UpdateEntity_12(world, tntPosition, player);
|
||||
}
|
||||
|
||||
public static boolean inWater(World world, TNTPosition tntPosition) {
|
||||
Material material = tntPosition.getLocation().toLocation(world).getBlock().getType();
|
||||
return material == Material.WATER || material == Material.STATIONARY_WATER;
|
||||
}
|
||||
|
||||
}
|
@ -25,11 +25,11 @@ import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||
class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||
|
||||
private TNTPosition position;
|
||||
|
||||
public TNTEntity_12(World world, TNTPosition position, Player player) {
|
||||
public TraceEntity_12(World world, TNTPosition position, Player player) {
|
||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||
this.position = position;
|
||||
|
||||
@ -47,7 +47,7 @@ class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTNTEntity display(Player player) {
|
||||
public AbstractTraceEntity display(Player player) {
|
||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
|
||||
ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getLocation().getX());
|
||||
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getLocation().getY());
|
||||
@ -67,7 +67,7 @@ class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTNTEntity hide(Player player) {
|
||||
public AbstractTraceEntity hide(Player player) {
|
||||
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(new int[]{getId()});
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
|
||||
|
84
BauSystem_12/src/de/steamwar/bausystem/tracer/UpdateEntity_12.java
Normale Datei
84
BauSystem_12/src/de/steamwar/bausystem/tracer/UpdateEntity_12.java
Normale Datei
@ -0,0 +1,84 @@
|
||||
/*
|
||||
*
|
||||
* 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;
|
||||
|
||||
class UpdateEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||
|
||||
private TNTPosition position;
|
||||
|
||||
public UpdateEntity_12(World world, TNTPosition position, Player player) {
|
||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().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.getLocation().getX());
|
||||
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getLocation().getY());
|
||||
ReflectionUtils.setValue("e", packetPlayOutSpawnEntity, position.getLocation().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();
|
||||
}
|
||||
|
||||
}
|
@ -19,13 +19,23 @@
|
||||
|
||||
package de.steamwar.bausystem.tracer;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TNTEntityFactory_12 {
|
||||
public class TNTTracer_15 {
|
||||
|
||||
public static AbstractTNTEntity create(World world, TNTPosition tntPosition, Player player) {
|
||||
return new TNTEntity_12(world, tntPosition, player);
|
||||
public static AbstractTraceEntity createTNT(World world, TNTPosition tntPosition, Player player) {
|
||||
return new TraceEntity_15(world, tntPosition, player);
|
||||
}
|
||||
|
||||
public static AbstractTraceEntity createUpdatePoint(World world, TNTPosition tntPosition, Player player) {
|
||||
return new UpdateEntity_15(world, tntPosition, player);
|
||||
}
|
||||
|
||||
|
||||
public static boolean inWater(World world, TNTPosition tntPosition) {
|
||||
Material material = tntPosition.getLocation().toLocation(world).getBlock().getType();
|
||||
return material == Material.WATER;
|
||||
}
|
||||
|
||||
}
|
@ -25,12 +25,12 @@ import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||
class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||
|
||||
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||
private TNTPosition position;
|
||||
|
||||
public TNTEntity_15(World world, TNTPosition position, Player player) {
|
||||
public TraceEntity_15(World world, TNTPosition position, Player player) {
|
||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||
this.position = position;
|
||||
|
||||
@ -48,7 +48,7 @@ class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTNTEntity display(Player player) {
|
||||
public AbstractTraceEntity display(Player player) {
|
||||
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);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
||||
|
||||
@ -59,7 +59,7 @@ class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTNTEntity hide(Player player) {
|
||||
public AbstractTraceEntity hide(Player player) {
|
||||
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(new int[]{getId()});
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
|
||||
|
76
BauSystem_15/src/de/steamwar/bausystem/tracer/UpdateEntity_15.java
Normale Datei
76
BauSystem_15/src/de/steamwar/bausystem/tracer/UpdateEntity_15.java
Normale Datei
@ -0,0 +1,76 @@
|
||||
/*
|
||||
*
|
||||
* 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;
|
||||
|
||||
class UpdateEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||
|
||||
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||
private TNTPosition position;
|
||||
|
||||
public UpdateEntity_15(World world, TNTPosition position, Player player) {
|
||||
super(((CraftWorld) world).getHandle(), 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);
|
||||
|
||||
display(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTraceEntity display(Player player) {
|
||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().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();
|
||||
}
|
||||
|
||||
}
|
@ -21,11 +21,11 @@ package de.steamwar.bausystem.tracer;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface AbstractTNTEntity {
|
||||
public interface AbstractTraceEntity {
|
||||
|
||||
AbstractTNTEntity display(Player player);
|
||||
AbstractTraceEntity display(Player player);
|
||||
|
||||
AbstractTNTEntity hide(Player player);
|
||||
AbstractTraceEntity hide(Player player);
|
||||
|
||||
void remove();
|
||||
|
@ -84,15 +84,11 @@ public class CommandTrace implements CommandExecutor {
|
||||
player.sendMessage(BauSystem.PREFIX + "§cAlle TNT-Positionen gelöscht");
|
||||
break;
|
||||
case "show":
|
||||
TraceShowManager.show(player);
|
||||
TraceShowManager.show(player, args);
|
||||
break;
|
||||
case "hide":
|
||||
TraceShowManager.hide(player);
|
||||
break;
|
||||
case "toggleshow":
|
||||
case "interpolate":
|
||||
case "distance":
|
||||
break;
|
||||
case "list":
|
||||
case "gui":
|
||||
break;
|
||||
|
@ -21,6 +21,8 @@ package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||
import de.steamwar.bausystem.tracer.record.RecordStatus;
|
||||
import de.steamwar.bausystem.tracer.show.mode.Basic;
|
||||
import de.steamwar.bausystem.tracer.show.mode.BasicNoWater;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
@ -47,21 +49,13 @@ public class CommandTraceTabCompleter implements TabCompleter {
|
||||
}
|
||||
tabComplete.add("toggleauto");
|
||||
tabComplete.add("auto");
|
||||
tabComplete.add("toggleshow");
|
||||
tabComplete.add("show");
|
||||
if (args[0].equalsIgnoreCase("show") && args.length == 2) {
|
||||
return manageList(new ArrayList<>(Arrays.asList("block", "particle")), args, 1);
|
||||
return manageList(new ArrayList<>(Arrays.asList("water", "nowater", "no_water", "removedwater", "removed_water", "basic", "default")), args, 1);
|
||||
}
|
||||
tabComplete.add("hide");
|
||||
tabComplete.add("delete");
|
||||
tabComplete.add("interpolate");
|
||||
if (args[0].equalsIgnoreCase("interpolate") && args.length == 2) {
|
||||
return manageList(new ArrayList<>(Arrays.asList("all", "yaxis", "none")), args, 1);
|
||||
}
|
||||
tabComplete.add("distance");
|
||||
if (args[0].equalsIgnoreCase("distance") && args.length == 2) {
|
||||
return manageList(new ArrayList<>(Arrays.asList("3", "4", "5", "6", "7", "8", "9", "10", "11", "default")), args, 1);
|
||||
}
|
||||
tabComplete.add("clear");
|
||||
//tabComplete.add("gui");
|
||||
//tabComplete.add("list");
|
||||
|
||||
|
@ -45,6 +45,11 @@ public class Recorder implements Listener {
|
||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
||||
task = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), this::run, 1, 1);
|
||||
record = new Record();
|
||||
|
||||
// To trace TNT initial positions with AutoTracer
|
||||
if (RecordStateMachine.getRecordStatus() == RecordStatus.IDLE_AUTO) {
|
||||
run();
|
||||
}
|
||||
}
|
||||
|
||||
void stopRecording() {
|
||||
|
@ -2,7 +2,8 @@ package de.steamwar.bausystem.tracer.show;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.tracer.TNTPosition;
|
||||
import de.steamwar.bausystem.tracer.show.mode.BasicShowMode;
|
||||
import de.steamwar.bausystem.tracer.show.mode.Basic;
|
||||
import de.steamwar.bausystem.tracer.show.mode.BasicNoWater;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -17,9 +18,30 @@ public class TraceShowManager implements Listener {
|
||||
|
||||
private static final Map<Player, ShowMode> showModes = new HashMap<>();
|
||||
|
||||
public static void show(Player player) {
|
||||
public static void show(Player player, String[] args) {
|
||||
hide(player);
|
||||
ShowMode showMode = new BasicShowMode(player);
|
||||
|
||||
ShowMode showMode;
|
||||
if (args.length < 2) {
|
||||
showMode = new Basic(player);
|
||||
} else {
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "water":
|
||||
case "nowater":
|
||||
case "no_water":
|
||||
case "removedwater":
|
||||
case "removed_water":
|
||||
showMode = new BasicNoWater(player);
|
||||
break;
|
||||
case "basic":
|
||||
case "default":
|
||||
default:
|
||||
showMode = new Basic(player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
showModes.put(player, showMode);
|
||||
StoredRecords.showAll(showMode);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
*
|
||||
* 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.show.mode;
|
||||
|
||||
public class Advanced {
|
||||
}
|
81
BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java
Normale Datei
81
BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java
Normale Datei
@ -0,0 +1,81 @@
|
||||
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 org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Basic implements ShowMode {
|
||||
|
||||
private final Player player;
|
||||
|
||||
private Map<RoundedTNTPosition, AbstractTraceEntity> tntEntityMap = new HashMap<>();
|
||||
|
||||
public Basic(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(TNTPosition position) {
|
||||
RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(position);
|
||||
if (tntEntityMap.containsKey(roundedTNTPosition)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Core.getVersion()) {
|
||||
case 12:
|
||||
tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createTNT(player.getWorld(), position, player));
|
||||
break;
|
||||
default:
|
||||
tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createTNT(player.getWorld(), position, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
tntEntityMap.forEach((roundedTNTPosition, abstractTNTEntity) -> {
|
||||
abstractTNTEntity.hide(player);
|
||||
abstractTNTEntity.remove();
|
||||
});
|
||||
tntEntityMap.clear();
|
||||
}
|
||||
|
||||
private static class RoundedTNTPosition {
|
||||
|
||||
private static final int factor = 10;
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
private RoundedTNTPosition(TNTPosition tntPosition) {
|
||||
this(tntPosition.getLocation().getX(), tntPosition.getLocation().getY(), tntPosition.getLocation().getZ());
|
||||
}
|
||||
|
||||
private RoundedTNTPosition(double x, double y, double z) {
|
||||
this.x = (int)(x * factor);
|
||||
this.y = (int)(y * factor);
|
||||
this.z = (int)(z * factor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof RoundedTNTPosition)) return false;
|
||||
RoundedTNTPosition that = (RoundedTNTPosition) o;
|
||||
return x == that.x &&
|
||||
y == that.y &&
|
||||
z == that.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
*
|
||||
* 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.show.mode;
|
||||
|
||||
import de.steamwar.bausystem.tracer.TNTPosition;
|
||||
import de.steamwar.bausystem.tracer.TNTTracer_12;
|
||||
import de.steamwar.bausystem.tracer.TNTTracer_15;
|
||||
import de.steamwar.core.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BasicNoWater extends Basic {
|
||||
|
||||
private static final World world = Bukkit.getWorlds().get(0);
|
||||
|
||||
public BasicNoWater(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(TNTPosition position) {
|
||||
boolean b;
|
||||
switch (Core.getVersion()) {
|
||||
case 12:
|
||||
b = TNTTracer_12.inWater(world, position);
|
||||
break;
|
||||
default:
|
||||
b = TNTTracer_15.inWater(world, position);
|
||||
break;
|
||||
}
|
||||
if (!b) {
|
||||
super.show(position);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
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 org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class BasicShowMode implements ShowMode {
|
||||
|
||||
private final Player player;
|
||||
|
||||
private Set<AbstractTNTEntity> tntEntitySet = new HashSet<>();
|
||||
|
||||
public BasicShowMode(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(TNTPosition position) {
|
||||
switch (Core.getVersion()) {
|
||||
case 12:
|
||||
tntEntitySet.add(TNTEntityFactory_12.create(player.getWorld(), position, player));
|
||||
break;
|
||||
default:
|
||||
tntEntitySet.add(TNTEntityFactory_15.create(player.getWorld(), position, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
tntEntitySet.forEach(abstractTNTEntity -> abstractTNTEntity.hide(player));
|
||||
tntEntitySet.forEach(AbstractTNTEntity::remove);
|
||||
tntEntitySet.clear();
|
||||
}
|
||||
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren
Hier scheint eine Überprüfung auf Waterlogged-Blöcke zu fehlen (vgl. FightSystem isWater)
Ist nun eingebaut