mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-23 17:08:15 +01:00
Add PaperSpigot patch to fix block placement (Applies to all protocols for now, until someone finds an issue with this)
This commit is contained in:
parent
7807e6d9c4
commit
f1b9cd2e56
@ -17,6 +17,7 @@ import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners.ArmorListener;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners.BlockListener;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners.CommandBlockListener;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners.PaperPatch;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.packets.*;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
|
||||
@ -98,6 +99,10 @@ public class Protocol1_9TO1_8 extends Protocol {
|
||||
Bukkit.getPluginManager().registerEvents(new ArmorListener(plugin), plugin);
|
||||
Bukkit.getPluginManager().registerEvents(new CommandBlockListener(plugin), plugin);
|
||||
Bukkit.getPluginManager().registerEvents(new BlockListener(plugin), plugin);
|
||||
if(Bukkit.getVersion().toLowerCase().contains("paper")){
|
||||
plugin.getLogger().info("Enabling PaperSpigot patch: Fixes block placement.");
|
||||
Bukkit.getPluginManager().registerEvents(new PaperPatch(), plugin);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,22 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
public class PaperPatch implements Listener {
|
||||
|
||||
/*
|
||||
This patch is applied when Paper is detected.
|
||||
I'm unsure of what causes this but essentially,
|
||||
placing blocks where your standing works?
|
||||
If there is a better fix then we'll replace this.
|
||||
*/
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
if (e.getPlayer().getLocation().getBlock().equals(e.getBlock())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user