SteamWar/BauSystem2.0
Archiviert
12
0

Add count to TNTClickListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-07-05 17:18:31 +02:00
Ursprung eb7dcbcdd4
Commit 096ee8d586
3 geänderte Dateien mit 5 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -1222,6 +1222,7 @@ TNT_CLICK_POSITION_Z = §7Position §eZ§8: §e{0}
TNT_CLICK_VELOCITY_X = §7Velocity §eX§8: §e{0}
TNT_CLICK_VELOCITY_Y = §7Velocity §eY§8: §e{0}
TNT_CLICK_VELOCITY_Z = §7Velocity §eZ§8: §e{0}
TNT_CLICK_COUNT = §7Count §8: §e{0}
SELECT_ITEM_CHOOSE_EXTENSION = Choose extension
SELECT_ITEM_CHOOSE_SELECTION = Choose selection

Datei anzeigen

@ -1202,6 +1202,7 @@ TNT_CLICK_POSITION_Z = §7Position §eZ§8: §e{0}
TNT_CLICK_VELOCITY_X = §7Velocity §eX§8: §e{0}
TNT_CLICK_VELOCITY_Y = §7Velocity §eY§8: §e{0}
TNT_CLICK_VELOCITY_Z = §7Velocity §eZ§8: §e{0}
TNT_CLICK_COUNT = §7Anzahl §8: §e{0}
SELECT_ITEM_CHOOSE_EXTENSION = Extension auswählen
SELECT_ITEM_CHOOSE_SELECTION = Auswahl auswählen

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
@ -40,6 +41,7 @@ public class TNTClickListener implements Listener {
Entity entity = event.getRightClicked();
if (event.getRightClicked() instanceof TNTPrimed) {
TNTPrimed tntPrimed = (TNTPrimed) entity;
long count = Bukkit.getWorlds().get(0).getEntitiesByClass(TNTPrimed.class).stream().filter(e -> e.getLocation().equals(tntPrimed.getLocation())).count();
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", event.getPlayer());
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ORDER", event.getPlayer(), getOrder(tntPrimed));
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_FUSE_TIME", event.getPlayer(), tntPrimed.getFuseTicks());
@ -49,6 +51,7 @@ public class TNTClickListener implements Listener {
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", event.getPlayer(), tntPrimed.getVelocity().getX() + "");
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", event.getPlayer(), tntPrimed.getVelocity().getX() + "");
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", event.getPlayer(), tntPrimed.getVelocity().getX() + "");
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_COUNT", event.getPlayer(), count + "");
}
}