SteamWar/BauSystem2.0
Archiviert
12
0

Fix PistonCalculator for normal Pistons
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-10-17 08:15:04 +02:00
Ursprung 40dcee6eee
Commit c330fdcc1d

Datei anzeigen

@ -50,13 +50,18 @@ public class PistonCalculator implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (event.getPlayer().getInventory().getItemInMainHand().getType() != Material.SLIME_BALL) return;
if (!event.hasItem() || event.getItem().getType() != Material.SLIME_BALL) return;
if (event.getClickedBlock() == null) return;
Block clickedBlock = event.getClickedBlock();
Material blockType = clickedBlock.getType();
if (!(blockType == Material.PISTON || blockType == Material.STICKY_PISTON)) return;
Piston piston = (Piston) clickedBlock.getBlockData();
if (blockType == Material.PISTON && piston.isExtended()) {
BauSystem.MESSAGE.sendPrefixless("PISTON_INFO", event.getPlayer(), ChatMessageType.ACTION_BAR, "§a", 0);
return;
}
boolean pulling = blockType == Material.STICKY_PISTON && (clickedBlock.getRelative(piston.getFacing()).getType() == Material.AIR || piston.isExtended());
CalculationResult result = calc(clickedBlock, piston.getFacing(), (pulling ? piston.getFacing().getOppositeFace() : piston.getFacing()));