REntity #148
@ -25,8 +25,6 @@ import de.steamwar.bausystem.configplayer.Config;
|
|||||||
import de.steamwar.bausystem.features.autostart.AutostartListener;
|
import de.steamwar.bausystem.features.autostart.AutostartListener;
|
||||||
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
|
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
|
||||||
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
|
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
|
||||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
|
||||||
import de.steamwar.entity.REntity;
|
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
import de.steamwar.entity.RFallingBlockEntity;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
@ -57,6 +55,11 @@ public class Detonator {
|
|||||||
public static void showDetonator(Player p, List<Location> locs) {
|
public static void showDetonator(Player p, List<Location> locs) {
|
||||||
if (ENTITIES_MAP.containsKey(p)) return;
|
if (ENTITIES_MAP.containsKey(p)) return;
|
||||||
REntityServer entities = new REntityServer();
|
REntityServer entities = new REntityServer();
|
||||||
|
entities.setCallback((player, rEntity, entityAction) -> {
|
||||||
|
Vector vector = new Vector(rEntity.getX(), rEntity.getY(), rEntity.getZ());
|
||||||
|
DetonatorListener.addLocationToDetonator(vector.toLocation(player.getWorld()), player);
|
||||||
|
DetonatorListener.HAS_UPDATED.add(player);
|
||||||
|
});
|
||||||
entities.addPlayer(p);
|
entities.addPlayer(p);
|
||||||
ENTITIES_MAP.put(p, entities);
|
ENTITIES_MAP.put(p, entities);
|
||||||
|
|
||||||
|
@ -41,9 +41,9 @@ import java.util.Set;
|
|||||||
@Linked
|
@Linked
|
||||||
public class DetonatorListener implements Listener {
|
public class DetonatorListener implements Listener {
|
||||||
|
|
||||||
private static final Set<Player> HAS_UPDATED = new HashSet<>();
|
static final Set<Player> HAS_UPDATED = new HashSet<>();
|
||||||
|
|
||||||
private static void addLocationToDetonator(Location location, Player p) {
|
static void addLocationToDetonator(Location location, Player p) {
|
||||||
Detoblock detoblock = Detonator.getBlock(location.getBlock());
|
Detoblock detoblock = Detonator.getBlock(location.getBlock());
|
||||||
if (detoblock == Detoblock.INVALID) {
|
if (detoblock == Detoblock.INVALID) {
|
||||||
SWUtils.sendToActionbar(p, BauSystem.MESSAGE.parse("DETONATOR_INVALID_BLOCK", p));
|
SWUtils.sendToActionbar(p, BauSystem.MESSAGE.parse("DETONATOR_INVALID_BLOCK", p));
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren