Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 08:30:09 +01:00
Improve the patch to check the pipe and to handle above head placement.
Dieser Commit ist enthalten in:
Ursprung
f1b9cd2e56
Commit
cee5b1ee42
@ -1,8 +1,14 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners;
|
package us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners;
|
||||||
|
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import us.myles.ViaVersion.ViaVersionPlugin;
|
||||||
|
import us.myles.ViaVersion.api.ViaVersion;
|
||||||
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||||
|
|
||||||
public class PaperPatch implements Listener {
|
public class PaperPatch implements Listener {
|
||||||
|
|
||||||
@ -15,8 +21,18 @@ public class PaperPatch implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlace(BlockPlaceEvent e) {
|
public void onPlace(BlockPlaceEvent e) {
|
||||||
|
if (ViaVersion.getInstance().isPorted(e.getPlayer())) {
|
||||||
|
UserConnection userConnection = ((ViaVersionPlugin) ViaVersion.getInstance()).getConnection(e.getPlayer());
|
||||||
|
if (userConnection == null) return;
|
||||||
|
if (!userConnection.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) return;
|
||||||
|
|
||||||
if (e.getPlayer().getLocation().getBlock().equals(e.getBlock())) {
|
if (e.getPlayer().getLocation().getBlock().equals(e.getBlock())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
} else {
|
||||||
|
if (e.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).equals(e.getBlock())) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren