Changed the fix for PacketPlayOutRecipeUpdateFix
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.willfp.eco.spigot;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.willfp.eco.spigot.display.packets.PacketAutoRecipe;
|
||||
import com.willfp.eco.spigot.display.packets.PacketChat;
|
||||
import com.willfp.eco.spigot.display.packets.PacketOpenWindowMerchant;
|
||||
@@ -58,7 +57,7 @@ public class EcoPlugin extends AbstractEcoPlugin {
|
||||
this.getEventManager().registerListener(new DispenserArmorListener());
|
||||
this.getEventManager().registerListener(new EntityDeathByEntityListeners(this));
|
||||
this.getEventManager().registerListener(new RecipeListener(this));
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketPlayOutRecipeUpdateFix(this));
|
||||
//ProtocolLibrary.getProtocolManager().addPacketListener(new PacketPlayOutRecipeUpdateFix(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketPlayOutRecipeUpdateFix extends PacketAdapter {
|
||||
/**
|
||||
@@ -28,16 +27,14 @@ public class PacketPlayOutRecipeUpdateFix extends PacketAdapter {
|
||||
PacketContainer packet = event.getPacket();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
List<Object> packets = InternalProxyUtils.getProxy(PacketPlayOutRecipeUpdateFixProxy.class).splitPackets(packet.getHandle(), player);
|
||||
if (packets.size() > 1) {
|
||||
Object otherPacket = InternalProxyUtils.getProxy(PacketPlayOutRecipeUpdateFixProxy.class).splitAndModifyPacket(packet.getHandle());
|
||||
if (otherPacket != null) {
|
||||
event.setCancelled(true);
|
||||
for (Object o : packets) {
|
||||
PacketContainer container = PacketContainer.fromPacket(o);
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, container);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PacketContainer container = PacketContainer.fromPacket(otherPacket);
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, container);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user