Fix PistonCalculator for normal Pistons
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
40dcee6eee
Commit
c330fdcc1d
@ -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()));
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren