SteamWar/BauSystem2.0
Archiviert
12
0

Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-12-22 10:03:24 +01:00
Ursprung 2cfed8b84d
Commit 202e03c957

Datei anzeigen

@ -73,6 +73,7 @@ public class SmartPlaceListener implements Plain, Listener {
IGNORED.add(Material.TNT);
IGNORED.add(Material.REDSTONE_ORE);
IGNORED.add(SWItem.getMaterial("BEEHIVE"));
IGNORED.add(SWItem.getMaterial("SEA_PICKLE"));
IGNORED.remove(Material.STONE);
IGNORED.remove(Material.BARRIER);
}
@ -92,7 +93,18 @@ public class SmartPlaceListener implements Plain, Listener {
TinyProtocol.instance.addFilter(useItem, (player, packet) -> {
if (!Config.getInstance().get(player).getPlainValueOrDefault("smartPlace", false)) return packet;
Block block = player.getTargetBlockExact(6);
boolean shouldSneak = !(block != null && (block.getType().isInteractable() || block.getType() == Material.NOTE_BLOCK) && !CONTAINERS.contains(block.getType()) && !IGNORED.contains(block.getType()));
boolean shouldSneak = false;
if (block != null) {
if (block.getType().isInteractable() || block.getType() == Material.NOTE_BLOCK) {
shouldSneak = true;
}
if (!CONTAINERS.contains(block.getType())) {
shouldSneak = false;
}
if (IGNORED.contains(block.getType())) {
shouldSneak = false;
}
}
boolean sneaking = player.isSneaking();
run(player, packet, true, sneaking, shouldSneak);
return null;