SteamWar/BauSystem
Archiviert
13
0

Fix TNTSimulatorListener on 1.12

Dieser Commit ist enthalten in:
yoyosource 2021-04-03 21:05:23 +02:00
Ursprung ae8521b85e
Commit 2ea6c27d05

Datei anzeigen

@ -23,6 +23,7 @@ package de.steamwar.bausystem.world;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -63,7 +64,12 @@ public class TNTSimulatorListener implements Listener {
startSimulation(event.getPlayer()); startSimulation(event.getPlayer());
break; break;
case RIGHT_CLICK_BLOCK: case RIGHT_CLICK_BLOCK:
Vector location = event.getClickedBlock().getLocation().toVector().add(event.getBlockFace().getDirection()).add(HALF); BlockFace blockFace = event.getBlockFace();
Vector direction = new Vector(blockFace.getModX(), blockFace.getModY(), blockFace.getModZ());
if (blockFace.getModX() != 0 || blockFace.getModY() != 0 || blockFace.getModZ() != 0) {
direction.normalize();
}
Vector location = event.getClickedBlock().getLocation().toVector().add(direction).add(HALF);
TNTSpawn tntSpawn = new TNTSpawn(location); TNTSpawn tntSpawn = new TNTSpawn(location);
addTNT(event.getPlayer(), tntSpawn); addTNT(event.getPlayer(), tntSpawn);
editTNT(event.getPlayer(), tntSpawn); editTNT(event.getPlayer(), tntSpawn);