SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'Fix TNTSimulatorListener on 1.12' (#227) from SimulatorFix into master

Reviewed-on: #227
Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
YoyoNow 2021-04-03 21:42:41 +02:00
Commit fa790a8489

Datei anzeigen

@ -23,6 +23,7 @@ package de.steamwar.bausystem.world;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -63,7 +64,12 @@ public class TNTSimulatorListener implements Listener {
startSimulation(event.getPlayer());
break;
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);
addTNT(event.getPlayer(), tntSpawn);
editTNT(event.getPlayer(), tntSpawn);