SteamWar/BauSystem2.0
Archiviert
12
0

Add Detonator click back
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-02-23 17:58:29 +01:00
Ursprung bb5312ee92
Commit fe82e38a0d
2 geänderte Dateien mit 7 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -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);

Datei anzeigen

@ -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));