SteamWar/BauSystem2.0
Archiviert
12
0

Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-08-03 22:28:04 +02:00
Ursprung 552a1ea7fc
Commit 47d5f29ae6
2 geänderte Dateien mit 1 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.bausystem.features.shieldprinting;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.shieldprinting.impl.*;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
@ -45,12 +44,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;

Datei anzeigen

@ -83,12 +83,6 @@ public class SmartPlaceListener implements Plain, Listener {
}
private static final Class<?> useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem");
private static final Class<?> entityPlayer = Reflection.getClass("{nms.server.level}.EntityPlayer");
private static final Class<?> craftPlayer = Reflection.getClass("{obc}.entity.CraftPlayer");
private static final Reflection.MethodInvoker getHandle = Reflection.getTypedMethod(craftPlayer, "getHandle", entityPlayer);
private static final Class<?> playerConnectionClazz = Reflection.getClass("{nms.server.network}.PlayerConnection");
private static final Reflection.FieldAccessor<?> playerConnection = Reflection.getField(entityPlayer, playerConnectionClazz, 0);
private static final Reflection.MethodInvoker packetExecutor = Reflection.getMethod(playerConnectionClazz, null, useItem);
private static final Set<Player> SMART_PLACING = new HashSet<>();
private static final Set<Player> WAS_EXECUTED = new HashSet<>();
@ -101,7 +95,6 @@ public class SmartPlaceListener implements Plain, Listener {
Block block = rayTraceResult != null ? rayTraceResult.getHitBlock() : null;
BlockFace blockFace = rayTraceResult != null ? rayTraceResult.getHitBlockFace() : null;
boolean shouldSneak = false;
System.out.println(rayTraceResult + " " + block + " " + blockFace);
if (block != null) {
ItemStack itemStack = player.getInventory().getItemInMainHand();
if (block.getType().isInteractable() || block.getType() == Material.NOTE_BLOCK) {
@ -155,7 +148,7 @@ public class SmartPlaceListener implements Plain, Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
if (!SMART_PLACING.contains(event.getPlayer())) {
if (Core.getVersion() >= 20 && CONTAINERS.contains(event.getBlockAgainst().getType())) {